Skip to content

Enable PyTorch operations on MPS Backend. - #77343

Closed
kulinseth wants to merge 33 commits into
pytorch:masterfrom
kulinseth:mps_all_rebased
Closed

kulinseth wants to merge 33 commits into
pytorch:masterfrom
kulinseth:mps_all_rebased

Conversation

@kulinseth

@kulinseth kulinseth commented May 12, 2022 •

Copy link
Copy Markdown
Collaborator

@facebook-github-bot

facebook-github-bot commented May 12, 2022 •

Copy link
Copy Markdown
Contributor

🔗 Helpful links

❌ 9 New Failures, 57 Pending

As of commit c0fddd7 (more details on the Dr. CI page):

Expand to see more
  • 9/9 failures introduced in this PR

🕵️ 9 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See GitHub Actions build pull / linux-xenial-py3-clang5-mobile-build / build (1/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:08:12.9555640Z collect2: error: ld returned 1 exit status
2022-05-12T19:08:12.9545942Z /var/lib/jenkins/workspace/build_test_custom_build/build_default_libtorch/install/lib/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o): In function `at::compositeimplicitautograd::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)':
2022-05-12T19:08:12.9546731Z RegisterCompositeImplicitAutograd.cpp:(.text+0x41eb7): undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:12.9547637Z /var/lib/jenkins/workspace/build_test_custom_build/build_default_libtorch/install/lib/libtorch_cpu.a(RegisterFunctionalization_1.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)) & [clone .isra.383] [clone .constprop.1107]':
2022-05-12T19:08:12.9548606Z RegisterFunctionalization_1.cpp:(.text+0x8eb2): undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:12.9549517Z /var/lib/jenkins/workspace/build_test_custom_build/build_default_libtorch/install/lib/libtorch_cpu.a(RegisterFunctionalization_2.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)) & [clone .isra.361] [clone .constprop.946]':
2022-05-12T19:08:12.9550568Z RegisterFunctionalization_2.cpp:(.text+0x4312): undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:08:12.9551695Z /var/lib/jenkins/workspace/build_test_custom_build/build_default_libtorch/install/lib/libtorch_cpu.a(RegisterFunctionalization_2.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)) & [clone .isra.392] [clone .constprop.997]':
2022-05-12T19:08:12.9553025Z RegisterFunctionalization_2.cpp:(.text+0x9992): undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:12.9554411Z /var/lib/jenkins/workspace/build_test_custom_build/build_default_libtorch/install/lib/libtorch_cpu.a(RegisterFunctionalization_3.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)>(char const*, at::Tensor (*&&)(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)) & [clone .isra.381] [clone .constprop.990]':
2022-05-12T19:08:12.9555227Z RegisterFunctionalization_3.cpp:(.text+0xa482): undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:08:12.9555640Z collect2: error: ld returned 1 exit status
2022-05-12T19:08:12.9556108Z CMakeFiles/Predictor.dir/build.make:94: recipe for target 'Predictor' failed
2022-05-12T19:08:12.9556358Z make[2]: *** [Predictor] Error 1
2022-05-12T19:08:12.9556698Z CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/Predictor.dir/all' failed
2022-05-12T19:08:12.9557038Z make[1]: *** [CMakeFiles/Predictor.dir/all] Error 2
2022-05-12T19:08:12.9557420Z Makefile:83: recipe for target 'all' failed
2022-05-12T19:08:12.9557738Z make: *** [all] Error 2
2022-05-12T19:08:12.9557933Z + sccache_epilogue
2022-05-12T19:08:12.9558294Z + echo '::group::Sccache Compilation Log'
2022-05-12T19:08:12.9558802Z ##[group]Sccache Compilation Log
2022-05-12T19:08:12.9559226Z + echo '=================== sccache compilation log ==================='

See GitHub Actions build trunk / linux-bionic-py3.7-clang9-slow / build (2/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:06:36.9609367Z ../lib/libtorch_cp..., c10::ArrayRef, c10::ArrayRef, long)'
2022-05-12T19:06:36.5187506Z make[2]: *** [bin/ProcessGroupGlooTest] Error 1
2022-05-12T19:06:36.5188400Z CMakeFiles/Makefile2:8930: recipe for target 'test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all' failed
2022-05-12T19:06:36.5188781Z make[1]: *** [test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all] Error 2
2022-05-12T19:06:36.5567540Z [ 92%] �[32m�[1mLinking CXX executable ../bin/scalar_test�[0m
2022-05-12T19:06:36.9545400Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:36.9547433Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:36.9564182Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:36.9565798Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:36.9594956Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:36.9601781Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:36.9609367Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:36.9655869Z clang: �[0;1;31merror: �[0mlinker command failed with exit code 1 (use -v to see invocation)�[0m
2022-05-12T19:06:36.9684378Z caffe2/CMakeFiles/scalar_test.dir/build.make:110: recipe for target 'bin/scalar_test' failed
2022-05-12T19:06:36.9684783Z make[2]: *** [bin/scalar_test] Error 1
2022-05-12T19:06:36.9685404Z CMakeFiles/Makefile2:5669: recipe for target 'caffe2/CMakeFiles/scalar_test.dir/all' failed
2022-05-12T19:06:36.9685728Z make[1]: *** [caffe2/CMakeFiles/scalar_test.dir/all] Error 2
2022-05-12T19:06:36.9688245Z Makefile:145: recipe for target 'all' failed
2022-05-12T19:06:36.9688470Z make: *** [all] Error 2
2022-05-12T19:06:37.0138461Z + cleanup
2022-05-12T19:06:37.0138696Z + retcode=1
2022-05-12T19:06:37.0138858Z + set +x

See GitHub Actions build Lint / lintrunner (3/9)

Step: "Run lintrunner on all files" (full log | diagnosis details | 🔁 rerun)

2022-05-12T18:55:29.6061847Z �[2m14858�... # AssertionError: Scalars are not equal!
2022-05-12T18:55:29.6041186Z         �[2m14794�[0m  |               DecorateInfo(unittest.skip("Skipped!"), 'TestJit', 'test_variant_consistency_jit',
2022-05-12T18:55:29.6041634Z     >>> �[2m14795�[0m  |�[33m                         device_type='mps', dtypes=[torch.float32]),
2022-05-12T18:55:29.6041926Z �[0m        �[2m14796�[0m  |           )),
2022-05-12T18:55:29.6042180Z         �[2m14797�[0m  |    UnaryUfuncInfo('angle',
2022-05-12T18:55:29.6042355Z         �[2m14798�[0m  |                   ref=np.angle,
2022-05-12T18:55:29.6042364Z 
2022-05-12T18:55:29.6042529Z   �[43m�[1mWarning�[0m (FLAKE8) �[4mE128�[0m
2022-05-12T18:55:29.6042740Z     continuation line under-indented for visual indent
2022-05-12T18:55:29.6042886Z     See https://www.flake8rules.com/rules/E128.html
2022-05-12T18:55:29.6042893Z 
2022-05-12T18:55:29.6061847Z         �[2m14858�[0m  |               # AssertionError: Scalars are not equal!
2022-05-12T18:55:29.6062322Z         �[2m14859�[0m  |               DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'),
2022-05-12T18:55:29.6062831Z         �[2m14860�[0m  |               DecorateInfo(unittest.skip("Skipped!"), 'TestCommon', 'test_out',
2022-05-12T18:55:29.6063544Z     >>> �[2m14861�[0m  |�[33m                         device_type='mps', dtypes=[torch.float32]),
2022-05-12T18:55:29.6063886Z �[0m        �[2m14862�[0m  |               DecorateInfo(unittest.skip("Skipped!"), 'TestCommon', 'test_variant_consistency_eager',
2022-05-12T18:55:29.6064140Z         �[2m14863�[0m  |                         device_type='mps', dtypes=[torch.float32]),
2022-05-12T18:55:29.6064457Z         �[2m14864�[0m  |               DecorateInfo(unittest.skip("Skipped!"), 'TestJit', 'test_variant_consistency_jit',
2022-05-12T18:55:29.6064470Z 
2022-05-12T18:55:29.6065660Z   �[43m�[1mWarning�[0m (FLAKE8) �[4mE128�[0m
2022-05-12T18:55:29.6065922Z     continuation line under-indented for visual indent
2022-05-12T18:55:29.6066101Z     See https://www.flake8rules.com/rules/E128.html

See GitHub Actions build pull / linux-xenial-py3.7-clang7-onnx / build (4/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:06:38.6889380Z ../lib/libtorch_cp..., c10::ArrayRef, c10::ArrayRef, long)'
2022-05-12T19:06:38.6314665Z test_cpp_c10d/CMakeFiles/example_allreduce.dir/build.make:106: recipe for target 'bin/example_allreduce' failed
2022-05-12T19:06:38.6315001Z make[2]: *** [bin/example_allreduce] Error 1
2022-05-12T19:06:38.6318007Z CMakeFiles/Makefile2:15328: recipe for target 'test_cpp_c10d/CMakeFiles/example_allreduce.dir/all' failed
2022-05-12T19:06:38.6318418Z make[1]: *** [test_cpp_c10d/CMakeFiles/example_allreduce.dir/all] Error 2
2022-05-12T19:06:38.6837760Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:38.6838900Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:38.6852863Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:38.6853451Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:38.6878158Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:38.6883519Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:38.6889380Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:38.6939375Z clang: �[0;1;31merror: �[0mlinker command failed with exit code 1 (use -v to see invocation)�[0m
2022-05-12T19:06:38.6961622Z caffe2/CMakeFiles/pattern_net_transform_test.dir/build.make:110: recipe for target 'bin/pattern_net_transform_test' failed
2022-05-12T19:06:38.6962016Z make[2]: *** [bin/pattern_net_transform_test] Error 1
2022-05-12T19:06:38.6963044Z CMakeFiles/Makefile2:6186: recipe for target 'caffe2/CMakeFiles/pattern_net_transform_test.dir/all' failed
2022-05-12T19:06:38.6963376Z make[1]: *** [caffe2/CMakeFiles/pattern_net_transform_test.dir/all] Error 2
2022-05-12T19:06:38.6965837Z Makefile:140: recipe for target 'all' failed
2022-05-12T19:06:38.6966049Z make: *** [all] Error 2
2022-05-12T19:06:38.7344473Z + cleanup
2022-05-12T19:06:38.7344767Z + retcode=1
2022-05-12T19:06:38.7345008Z + set +x

See GitHub Actions build pull / linux-xenial-py3.7-clang7-asan / build (5/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:09:57.4695180Z ../lib/libtorch_cp..., c10::ArrayRef, c10::ArrayRef, bool)'
2022-05-12T19:09:57.1704715Z test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/build.make:106: recipe for target 'bin/ProcessGroupGlooTest' failed
2022-05-12T19:09:57.1705284Z make[2]: *** [bin/ProcessGroupGlooTest] Error 1
2022-05-12T19:09:57.1708115Z CMakeFiles/Makefile2:10309: recipe for target 'test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all' failed
2022-05-12T19:09:57.1708776Z make[1]: *** [test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all] Error 2
2022-05-12T19:09:57.4566451Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:09:57.4571065Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:09:57.4580590Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:09:57.4581211Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:09:57.4620765Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:09:57.4680509Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:09:57.4695180Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:09:57.4785458Z clang: �[0;1;31merror: �[0mlinker command failed with exit code 1 (use -v to see invocation)�[0m
2022-05-12T19:09:57.4807172Z caffe2/CMakeFiles/op_allowlist_test.dir/build.make:108: recipe for target 'bin/op_allowlist_test' failed
2022-05-12T19:09:57.4807593Z make[2]: *** [bin/op_allowlist_test] Error 1
2022-05-12T19:09:57.4808867Z CMakeFiles/Makefile2:5196: recipe for target 'caffe2/CMakeFiles/op_allowlist_test.dir/all' failed
2022-05-12T19:09:57.4809247Z make[1]: *** [caffe2/CMakeFiles/op_allowlist_test.dir/all] Error 2
2022-05-12T19:09:57.4811643Z Makefile:140: recipe for target 'all' failed
2022-05-12T19:09:57.4811873Z make: *** [all] Error 2
2022-05-12T19:09:57.5245736Z + cleanup
2022-05-12T19:09:57.5246105Z + retcode=1
2022-05-12T19:09:57.5246416Z + set +x

See GitHub Actions build pull / linux-xenial-py3-clang5-mobile-custom-build-static / build (6/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:08:29.8453130Z collect2: error: ld returned 1 exit status
2022-05-12T19:08:29.8424375Z /var/lib/jenkins/workspace/build_test_custom_build/build_custom_libtorch_static/install/lib/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o): In function `at::compositeimplicitautograd::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)':
2022-05-12T19:08:29.8425954Z RegisterCompositeImplicitAutograd.cpp:(.text+0x430e7): undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:29.8431223Z /var/lib/jenkins/workspace/build_test_custom_build/build_custom_libtorch_static/install/lib/libtorch_cpu.a(RegisterFunctionalization_1.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)) & [clone .isra.382] [clone .constprop.1104]':
2022-05-12T19:08:29.8432584Z RegisterFunctionalization_1.cpp:(.text+0xb7a2): undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:29.8438827Z /var/lib/jenkins/workspace/build_test_custom_build/build_custom_libtorch_static/install/lib/libtorch_cpu.a(RegisterFunctionalization_2.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)) & [clone .isra.360] [clone .constprop.943]':
2022-05-12T19:08:29.8440497Z RegisterFunctionalization_2.cpp:(.text+0x7552): undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:08:29.8445502Z /var/lib/jenkins/workspace/build_test_custom_build/build_custom_libtorch_static/install/lib/libtorch_cpu.a(RegisterFunctionalization_2.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)>(char const*, at::Tensor (*&&)(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)) & [clone .isra.391] [clone .constprop.994]':
2022-05-12T19:08:29.8448350Z RegisterFunctionalization_2.cpp:(.text+0x88e2): undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:08:29.8451565Z /var/lib/jenkins/workspace/build_test_custom_build/build_custom_libtorch_static/install/lib/libtorch_cpu.a(RegisterFunctionalization_3.cpp.o): In function `torch::Library& torch::Library::impl<char const*, at::Tensor (*)(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)>(char const*, at::Tensor (*&&)(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)) & [clone .isra.380] [clone .constprop.987]':
2022-05-12T19:08:29.8452696Z RegisterFunctionalization_3.cpp:(.text+0xa162): undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:08:29.8453130Z collect2: error: ld returned 1 exit status
2022-05-12T19:08:29.8467067Z CMakeFiles/Predictor.dir/build.make:94: recipe for target 'Predictor' failed
2022-05-12T19:08:29.8467359Z make[2]: *** [Predictor] Error 1
2022-05-12T19:08:29.8474030Z CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/Predictor.dir/all' failed
2022-05-12T19:08:29.8474374Z make[1]: *** [CMakeFiles/Predictor.dir/all] Error 2
2022-05-12T19:08:29.8475585Z Makefile:83: recipe for target 'all' failed
2022-05-12T19:08:29.8475822Z make: *** [all] Error 2
2022-05-12T19:08:29.8479767Z + sccache_epilogue
2022-05-12T19:08:29.8480395Z + echo '::group::Sccache Compilation Log'
2022-05-12T19:08:29.8481061Z ##[group]Sccache Compilation Log
2022-05-12T19:08:29.8481355Z + echo '=================== sccache compilation log ==================='

See GitHub Actions build pull / linux-bionic-py3.7-clang9 / build (7/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:06:33.1745344Z ../lib/libtorch_cp..., c10::ArrayRef, c10::ArrayRef, long)'
2022-05-12T19:06:32.8369487Z test_cpp_c10d/CMakeFiles/example_allreduce.dir/build.make:106: recipe for target 'bin/example_allreduce' failed
2022-05-12T19:06:32.8369972Z make[2]: *** [bin/example_allreduce] Error 1
2022-05-12T19:06:32.8370659Z CMakeFiles/Makefile2:8958: recipe for target 'test_cpp_c10d/CMakeFiles/example_allreduce.dir/all' failed
2022-05-12T19:06:32.8371010Z make[1]: *** [test_cpp_c10d/CMakeFiles/example_allreduce.dir/all] Error 2
2022-05-12T19:06:33.1684691Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:33.1686006Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:33.1703232Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:33.1704002Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:33.1732107Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:33.1738315Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:33.1745344Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:33.1789326Z clang: �[0;1;31merror: �[0mlinker command failed with exit code 1 (use -v to see invocation)�[0m
2022-05-12T19:06:33.1817849Z caffe2/CMakeFiles/scalar_test.dir/build.make:110: recipe for target 'bin/scalar_test' failed
2022-05-12T19:06:33.1818284Z make[2]: *** [bin/scalar_test] Error 1
2022-05-12T19:06:33.1819026Z CMakeFiles/Makefile2:5669: recipe for target 'caffe2/CMakeFiles/scalar_test.dir/all' failed
2022-05-12T19:06:33.1819539Z make[1]: *** [caffe2/CMakeFiles/scalar_test.dir/all] Error 2
2022-05-12T19:06:33.1821557Z Makefile:145: recipe for target 'all' failed
2022-05-12T19:06:33.1821917Z make: *** [all] Error 2
2022-05-12T19:06:33.2226387Z + cleanup
2022-05-12T19:06:33.2226754Z + retcode=1
2022-05-12T19:06:33.2227038Z + set +x

See GitHub Actions build pull / pytorch-linux-xenial-py3-clang5-android-ndk-r19c-gradle-custom-build-single / build-and-test (8/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:08:11.1082954Z FAILED: ../../.....ake/release/obj/armeabi-v7a/libpytorch_jni_lite.so
2022-05-12T19:08:11.1078811Z   [11/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/lyra/lyra_breakpad.cpp.o
2022-05-12T19:08:11.1079233Z   [12/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/lyra/cxa_throw.cpp.o
2022-05-12T19:08:11.1079635Z   [13/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/lyra/lyra.cpp.o
2022-05-12T19:08:11.1080039Z   [14/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/fbjni/fbjni.cpp.o
2022-05-12T19:08:11.1080450Z   [15/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/lyra/lyra_exceptions.cpp.o
2022-05-12T19:08:11.1080902Z   [16/20] Building CXX object fbjni/armeabi-v7a/CMakeFiles/fbjni.dir/cxx/fbjni/detail/Exceptions.cpp.o
2022-05-12T19:08:11.1081354Z   [17/20] Linking CXX shared library ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libfbjni.so
2022-05-12T19:08:11.1081719Z   [18/20] Building CXX object CMakeFiles/pytorch_jni_lite.dir/src/main/cpp/pytorch_jni_common.cpp.o
2022-05-12T19:08:11.1082061Z   [19/20] Building CXX object CMakeFiles/pytorch_jni_lite.dir/src/main/cpp/pytorch_jni_lite.cpp.o
2022-05-12T19:08:11.1082516Z   [20/20] Linking CXX shared library ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so
2022-05-12T19:08:11.1082954Z   FAILED: ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so 
2022-05-12T19:08:11.1086032Z   : && /opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --gcc-toolchain=/opt/ndk/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++  -Oz -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libpytorch_jni_lite.so -o ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libpytorch_jni_lite.so CMakeFiles/pytorch_jni_lite.dir/src/main/cpp/pytorch_jni_common.cpp.o CMakeFiles/pytorch_jni_lite.dir/src/main/cpp/pytorch_jni_lite.cpp.o  ../../../../build/intermediates/cmake/release/obj/armeabi-v7a/libfbjni.so -Wl,--gc-sections -Wl,--whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libtorch.a ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a -Wl,--no-whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libc10.a ../../../../src/main/jniLibs/armeabi-v7a/libnnpack.a ../../../../src/main/jniLibs/armeabi-v7a/libXNNPACK.a ../../../../src/main/jniLibs/armeabi-v7a/libpytorch_qnnpack.a ../../../../src/main/jniLibs/armeabi-v7a/libpthreadpool.a ../../../../src/main/jniLibs/armeabi-v7a/libeigen_blas.a ../../../../src/main/jniLibs/armeabi-v7a/libcpuinfo.a ../../../../src/main/jniLibs/armeabi-v7a/libclog.a libVulkanWrapper.a -landroid -llog -ldl -latomic -lm && :
2022-05-12T19:08:11.1088990Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeExplicitAutograd.cpp.o):RegisterCompositeExplicitAutograd.cpp:function at::compositeexplicitautograd::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool): error: undefined reference to 'at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool)'
2022-05-12T19:08:11.1090568Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeExplicitAutograd.cpp.o):RegisterCompositeExplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool): error: undefined reference to 'at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool)'
2022-05-12T19:08:11.1092238Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeExplicitAutograd.cpp.o):RegisterCompositeExplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool): error: undefined reference to 'at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, bool)'
2022-05-12T19:08:11.1093936Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeExplicitAutograd.cpp.o):RegisterCompositeExplicitAutograd.cpp:function at::compositeexplicitautograd::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long): error: undefined reference to 'at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long)'
2022-05-12T19:08:11.1095695Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeExplicitAutograd.cpp.o):RegisterCompositeExplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long): error: undefined reference to 'at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long)'
2022-05-12T19:08:11.1097414Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o):RegisterCompositeImplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long): error: undefined reference to 'at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long)'
2022-05-12T19:08:11.1099201Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o):RegisterCompositeImplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_convolution_transpose_backward_weight(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long): error: undefined reference to 'at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long)'
2022-05-12T19:08:11.1101273Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o):RegisterCompositeImplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_convolution_backward_input(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long, bool): error: undefined reference to 'at::native::mps_convolution_backward_input(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long, bool)'
2022-05-12T19:08:11.1103085Z   ../../../../src/main/jniLibs/armeabi-v7a/libtorch_cpu.a(RegisterCompositeImplicitAutograd.cpp.o):RegisterCompositeImplicitAutograd.cpp:function at::(anonymous namespace)::(anonymous namespace)::wrapper__mps_convolution_backward_weights(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long, bool): error: undefined reference to 'at::native::mps_convolution_backward_weights(c10::ArrayRef<long long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long long>, c10::ArrayRef<long long>, c10::ArrayRef<long long>, long long, bool)'

See GitHub Actions build pull / linux-vulkan-bionic-py3.7-clang9 / build (9/9)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-05-12T19:06:37.9716393Z ../lib/libtorch_cp..., c10::ArrayRef, c10::ArrayRef, long)'
2022-05-12T19:06:37.4476203Z make[2]: *** [bin/ProcessGroupGlooTest] Error 1
2022-05-12T19:06:37.4480042Z CMakeFiles/Makefile2:11176: recipe for target 'test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all' failed
2022-05-12T19:06:37.4480443Z make[1]: *** [test_cpp_c10d/CMakeFiles/ProcessGroupGlooTest.dir/all] Error 2
2022-05-12T19:06:37.6254082Z [ 85%] �[32m�[1mLinking CXX executable ../bin/undefined_tensor_test�[0m
2022-05-12T19:06:37.9664354Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_weights(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:37.9665222Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution(at::Tensor const&, at::Tensor const&, c10::optional<at::Tensor> const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:37.9679070Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_input(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:37.9679921Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_backward_input(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long, bool)'
2022-05-12T19:06:37.9703743Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d_backward(at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:37.9709847Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_max_pool2d(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool)'
2022-05-12T19:06:37.9716393Z ../lib/libtorch_cpu.so: undefined reference to `at::native::mps_convolution_transpose_backward_weight(c10::ArrayRef<long>, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long)'
2022-05-12T19:06:37.9759289Z clang: �[0;1;31merror: �[0mlinker command failed with exit code 1 (use -v to see invocation)�[0m
2022-05-12T19:06:37.9790081Z caffe2/CMakeFiles/undefined_tensor_test.dir/build.make:108: recipe for target 'bin/undefined_tensor_test' failed
2022-05-12T19:06:37.9790571Z make[2]: *** [bin/undefined_tensor_test] Error 1
2022-05-12T19:06:37.9794908Z CMakeFiles/Makefile2:5938: recipe for target 'caffe2/CMakeFiles/undefined_tensor_test.dir/all' failed
2022-05-12T19:06:37.9795280Z make[1]: *** [caffe2/CMakeFiles/undefined_tensor_test.dir/all] Error 2
2022-05-12T19:06:37.9797012Z Makefile:140: recipe for target 'all' failed
2022-05-12T19:06:37.9797322Z make: *** [all] Error 2
2022-05-12T19:06:38.0195340Z + cleanup
2022-05-12T19:06:38.0195704Z + retcode=1
2022-05-12T19:06:38.0196019Z + set +x

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@IvanYashchuk
IvanYashchuk removed their request for review May 12, 2022 07:51
@albanD albanD added ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/trunk Trigger trunk jobs on your pull request labels May 12, 2022

@albanD albanD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial

Comment thread CMakeLists.txt Resolved
Comment thread aten/src/ATen/Context.cpp Resolved
Comment thread aten/src/ATen/native/Convolution.cpp Resolved
@lezcano
lezcano removed their request for review May 12, 2022 15:59

@albanD albanD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did docs and test except test_mps.

Comment thread aten/src/ATen/native/DispatchStub.h Resolved
Comment thread aten/src/ATen/native/RNN.cpp Resolved
Comment thread aten/src/ATen/native/TensorShape.cpp Resolved
Comment thread aten/src/ATen/test/CMakeLists.txt Resolved
Comment thread docs/source/mps.rst Resolved
Comment thread docs/source/notes/mps.rst Resolved
Comment thread torchgen/dest/register_dispatch_key.py Resolved
Comment thread aten/src/ATen/Context.cpp Resolved
Comment thread tools/autograd/derivatives.yaml Resolved
Comment thread tools/autograd/derivatives.yaml Resolved
Comment thread tools/autograd/derivatives.yaml Resolved
Comment thread torch/csrc/Module.cpp Resolved
@albanD
albanD force-pushed the mps_all_rebased branch 2 times, most recently from 9138073 to d071e8d Compare May 13, 2022 12:45
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@albanD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@albanD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@albanD albanD added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 13, 2022

@albanD albanD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_mps.py will re-quire a post-merge cleanup as well

@albanD

albanD commented May 13, 2022

Copy link
Copy Markdown
Collaborator

@pytorchbot merge this please

CI failures are due to bad handling of the label which makes the pytorch version ciflow/binaries_wheel/77403 but a couple scripts rely on it being \d.\d (utils test) or match the compile time version (for onnx)

@github-actions

Copy link
Copy Markdown
Contributor

Hey @kulinseth.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

facebook-github-bot pushed a commit that referenced this pull request May 16, 2022
Summary:
Add PyTorch operations to MPS backend.

- #77394

Pull Request resolved: #77343
Approved by: https://github.com/albanD

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/e011a8e18bf469a6a612fd1e7647159c353730a9

Reviewed By: gchanan

Differential Revision: D36374948

fbshipit-source-id: 59f5ae225f07e16bf07083e2a73ae5de1e419b7c
@sidroopdaska

sidroopdaska commented Aug 1, 2022 •

Copy link
Copy Markdown

hey @kulinseth, any thoughts on this issue. Am I missing something here?

malfet added a commit that referenced this pull request Mar 24, 2026
`mps_linear_backward` passed `grad_output.suggest_memory_format()` to
`at::empty()` when allocating the weight and bias gradient tensors. When
`grad_output` happened to have NHWC-like strides (e.g. from a permute
chain), `suggest_memory_format()` returned `ChannelsLast`, which requires
rank 4 — but the weight gradient is 2D and the bias gradient is 1D,
triggering "required rank 4 tensor to use channels_last format".

Replace the verbose `at::empty(size, scalar_type, nullopt, kMPS, nullopt,
suggest_memory_format())` calls with `at::empty(size, grad_output.options())`
which carries dtype and device without propagating an incorrect memory format.

The bug has existed since the original MPS backend introduction in #77343.

Fixes #178222


ghstack-source-id: c8e9c2a
Pull-Request: #178278
pytorchmergebot pushed a commit that referenced this pull request Aug 31, 2026
For 1D input `nll_loss` has a single loss element and only `target[0]` is used. The Metal kernel added in #195153 unconditionally dispatched `target.numel()` threads. When `aten.nll_loss_backward` is called directly with a 1D input and a multi-element target (as the inductor decomposition test does), the extra threads read the single-element `grad_output` out of bounds and scatter that garbage into `grad_input[target[i]]`.

In clean memory the out-of-bounds read is zero, so the result happens to match the reference; when the caching allocator hands back a dirty buffer it is garbage (e.g. `FLT_MAX`). That is why `test_nll_loss_backward_1d_input_mps` was flaky (#195391, #195392).

## How the previous (MPSGraph) op handled this
The MPSGraph implementation that #195153 replaced reshaped a 1D input `[C]` to `[1, C]` (an explicit batch of one) up front:
```objc
auto grad_input = grad_input_arg.dim() == 1 ? grad_input_arg.view({1, grad_input_arg.size(0)}) : grad_input_arg;
```
so the number of output rows was structurally pinned to 1, independent of the target's element count. The Metal migration dropped this normalization and instead derives the iteration count from `target.numel()`, which is where the out-of-bounds read comes from.

Note this 1D handling was **not** present in the original MPS op (#77343) -- it was added later in #81290 ("[MPS] Handle 1D inputs for NLL") and then lost in the migration.

## Fix
Dispatch a single thread for 1D input, matching the CPU and decomposition semantics ("the C++ kernel only uses `target[0]`") and re-instating the old `view({1, C})` invariant as a thread count. The 2D and 2D-loss paths are unchanged since `target.numel()` already equals the number of loss elements there.

## Test
Added a device-generic regression test that backs `grad_output` with a larger sentinel-filled tensor and views out a single element, so the out-of-bounds read is a deterministic non-zero value rather than relying on allocator state. It fails before the fix and passes after (`@onlyAccelerator`; the CPU path is correct and used as the reference).

Fixes #195389
Fixes #195390
Fixes #195391
Fixes #195392

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: #195411
Approved by: https://github.com/Isalia20, https://github.com/Skylion007

Co-authored-by: Claude Opus 4.8 <[email protected]>
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
For 1D input `nll_loss` has a single loss element and only `target[0]` is used. The Metal kernel added in pytorch#195153 unconditionally dispatched `target.numel()` threads. When `aten.nll_loss_backward` is called directly with a 1D input and a multi-element target (as the inductor decomposition test does), the extra threads read the single-element `grad_output` out of bounds and scatter that garbage into `grad_input[target[i]]`.

In clean memory the out-of-bounds read is zero, so the result happens to match the reference; when the caching allocator hands back a dirty buffer it is garbage (e.g. `FLT_MAX`). That is why `test_nll_loss_backward_1d_input_mps` was flaky (pytorch#195391, pytorch#195392).

## How the previous (MPSGraph) op handled this
The MPSGraph implementation that pytorch#195153 replaced reshaped a 1D input `[C]` to `[1, C]` (an explicit batch of one) up front:
```objc
auto grad_input = grad_input_arg.dim() == 1 ? grad_input_arg.view({1, grad_input_arg.size(0)}) : grad_input_arg;
```
so the number of output rows was structurally pinned to 1, independent of the target's element count. The Metal migration dropped this normalization and instead derives the iteration count from `target.numel()`, which is where the out-of-bounds read comes from.

Note this 1D handling was **not** present in the original MPS op (pytorch#77343) -- it was added later in pytorch#81290 ("[MPS] Handle 1D inputs for NLL") and then lost in the migration.

## Fix
Dispatch a single thread for 1D input, matching the CPU and decomposition semantics ("the C++ kernel only uses `target[0]`") and re-instating the old `view({1, C})` invariant as a thread count. The 2D and 2D-loss paths are unchanged since `target.numel()` already equals the number of loss elements there.

## Test
Added a device-generic regression test that backs `grad_output` with a larger sentinel-filled tensor and views out a single element, so the out-of-bounds read is a deterministic non-zero value rather than relying on allocator state. It fails before the fix and passes after (`@onlyAccelerator`; the CPU path is correct and used as the reference).

Fixes pytorch#195389
Fixes pytorch#195390
Fixes pytorch#195391
Fixes pytorch#195392

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#195411
Approved by: https://github.com/Isalia20, https://github.com/Skylion007

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
For 1D input `nll_loss` has a single loss element and only `target[0]` is used. The Metal kernel added in pytorch#195153 unconditionally dispatched `target.numel()` threads. When `aten.nll_loss_backward` is called directly with a 1D input and a multi-element target (as the inductor decomposition test does), the extra threads read the single-element `grad_output` out of bounds and scatter that garbage into `grad_input[target[i]]`.

In clean memory the out-of-bounds read is zero, so the result happens to match the reference; when the caching allocator hands back a dirty buffer it is garbage (e.g. `FLT_MAX`). That is why `test_nll_loss_backward_1d_input_mps` was flaky (pytorch#195391, pytorch#195392).

## How the previous (MPSGraph) op handled this
The MPSGraph implementation that pytorch#195153 replaced reshaped a 1D input `[C]` to `[1, C]` (an explicit batch of one) up front:
```objc
auto grad_input = grad_input_arg.dim() == 1 ? grad_input_arg.view({1, grad_input_arg.size(0)}) : grad_input_arg;
```
so the number of output rows was structurally pinned to 1, independent of the target's element count. The Metal migration dropped this normalization and instead derives the iteration count from `target.numel()`, which is where the out-of-bounds read comes from.

Note this 1D handling was **not** present in the original MPS op (pytorch#77343) -- it was added later in pytorch#81290 ("[MPS] Handle 1D inputs for NLL") and then lost in the migration.

## Fix
Dispatch a single thread for 1D input, matching the CPU and decomposition semantics ("the C++ kernel only uses `target[0]`") and re-instating the old `view({1, C})` invariant as a thread count. The 2D and 2D-loss paths are unchanged since `target.numel()` already equals the number of loss elements there.

## Test
Added a device-generic regression test that backs `grad_output` with a larger sentinel-filled tensor and views out a single element, so the out-of-bounds read is a deterministic non-zero value rather than relying on allocator state. It fails before the fix and passes after (`@onlyAccelerator`; the CPU path is correct and used as the reference).

Fixes pytorch#195389
Fixes pytorch#195390
Fixes pytorch#195391
Fixes pytorch#195392

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#195411
Approved by: https://github.com/Isalia20, https://github.com/Skylion007

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/trunk Trigger trunk jobs on your pull request cla signed Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants