Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MPS: Eye op #78408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

MPS: Eye op #78408

wants to merge 7 commits into from

Conversation

kulinseth
Copy link
Collaborator

This can be used as a reference PR was to add Op in MPS backend.

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 27, 2022

🔗 Helpful links

❌ 5 New Failures

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

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

🕵️ 5 new failures recognized by patterns

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

See GitHub Actions build pull / win-vs2019-cpu-py3 / test (default, 1, 2, windows.4xlarge) (1/5)

Step: "Upload test artifacts" (full log | diagnosis details | 🔁 rerun)

2022-05-27T06:47:09.1796166Z test_add_done_ca...arg() takes 0 positional arguments but 1 was given
2022-05-27T06:47:09.1760321Z   C:\Jenkins\Miniconda3\lib\unittest\suite.py(122): run
2022-05-27T06:47:09.1760593Z   C:\Jenkins\Miniconda3\lib\unittest\suite.py(84): __call__
2022-05-27T06:47:09.1760886Z   C:\Jenkins\Miniconda3\lib\site-packages\xmlrunner\runner.py(67): run
2022-05-27T06:47:09.1761189Z   C:\Jenkins\Miniconda3\lib\unittest\main.py(271): runTests
2022-05-27T06:47:09.1761461Z   C:\Jenkins\Miniconda3\lib\unittest\main.py(101): __init__
2022-05-27T06:47:09.1761822Z   C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\build\torch\testing\_internal\common_utils.py(680): run_tests
2022-05-27T06:47:09.1762125Z   test_futures.py(331): <module>
2022-05-27T06:47:09.1762245Z 
2022-05-27T06:47:09.1762313Z ok (0.551s)
2022-05-27T06:47:09.1786048Z   test_add_done_callback_maintains_callback_order (__main__.TestFuture) ... ok (0.003s)
2022-05-27T06:47:09.1796166Z   test_add_done_callback_no_arg_error_is_ignored (__main__.TestFuture) ... [E pybind_utils.h:201] Got the following error when running the callback: TypeError: no_arg() takes 0 positional arguments but 1 was given
2022-05-27T06:47:09.1797235Z ok (0.001s)
2022-05-27T06:47:09.1812792Z   test_add_done_callback_simple (__main__.TestFuture) ... ok (0.000s)
2022-05-27T06:47:09.1859299Z   test_chained_then (__main__.TestFuture) ... ok (0.000s)
2022-05-27T06:47:09.2933447Z   test_collect_all (__main__.TestFuture) ... ok (0.114s)
2022-05-27T06:47:09.2946274Z   test_done (__main__.TestFuture) ... ok (0.000s)
2022-05-27T06:47:09.2964095Z   test_done_exception (__main__.TestFuture) ... ok (0.000s)
2022-05-27T06:47:09.2986872Z   test_interleaving_then_and_add_done_callback_maintains_callback_order (__main__.TestFuture) ... ok (0.000s)
2022-05-27T06:47:09.3001187Z   test_interleaving_then_and_add_done_callback_propagates_error (__main__.TestFuture) ... [E pybind_utils.h:201] Got the following error when running the callback: ValueError: Expected error
2022-05-27T06:47:09.3001509Z 
2022-05-27T06:47:09.3001582Z At:

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7 / test (default, 2, 4, linux.4xlarge.nvidia.gpu) (2/5)

Step: "Upload test artifacts" (full log | diagnosis details | 🔁 rerun)

2022-05-27T07:02:26.2247090Z Could not load sym...as.so.11: undefined symbol: cublasGetSmCountTarget
2022-05-27T07:02:19.8204760Z �[0;32m[       OK ] �[mRNNTest.EndToEndLSTM (2197 ms)
2022-05-27T07:02:19.8205222Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndLSTMProj
2022-05-27T07:02:21.9944956Z �[0;32m[       OK ] �[mRNNTest.EndToEndLSTMProj (2173 ms)
2022-05-27T07:02:21.9945600Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndGRU
2022-05-27T07:02:23.9319649Z �[0;32m[       OK ] �[mRNNTest.EndToEndGRU (1937 ms)
2022-05-27T07:02:23.9320244Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndRNNRelu
2022-05-27T07:02:24.9829932Z �[0;32m[       OK ] �[mRNNTest.EndToEndRNNRelu (1051 ms)
2022-05-27T07:02:24.9830825Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndRNNTanh
2022-05-27T07:02:26.1832843Z �[0;32m[       OK ] �[mRNNTest.EndToEndRNNTanh (1200 ms)
2022-05-27T07:02:26.1833699Z �[0;32m[ RUN      ] �[mRNNTest.Sizes_CUDA
2022-05-27T07:02:26.2247090Z Could not load symbol cublasGetSmCountTarget from libcublas.so.11. Error: /usr/local/cuda/lib64/libcublas.so.11: undefined symbol: cublasGetSmCountTarget
2022-05-27T07:02:26.2265738Z �[0;32m[       OK ] �[mRNNTest.Sizes_CUDA (43 ms)
2022-05-27T07:02:26.2266582Z �[0;32m[ RUN      ] �[mRNNTest.SizesProj_CUDA
2022-05-27T07:02:26.2305074Z �[0;32m[       OK ] �[mRNNTest.SizesProj_CUDA (3 ms)
2022-05-27T07:02:26.2305949Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndLSTM_CUDA
2022-05-27T07:02:27.8136073Z �[0;32m[       OK ] �[mRNNTest.EndToEndLSTM_CUDA (1582 ms)
2022-05-27T07:02:27.8136933Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndLSTMProj_CUDA
2022-05-27T07:02:29.4239714Z �[0;32m[       OK ] �[mRNNTest.EndToEndLSTMProj_CUDA (1610 ms)
2022-05-27T07:02:29.4240611Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndGRU_CUDA
2022-05-27T07:02:30.7653230Z �[0;32m[       OK ] �[mRNNTest.EndToEndGRU_CUDA (1341 ms)
2022-05-27T07:02:30.7654108Z �[0;32m[ RUN      ] �[mRNNTest.EndToEndRNNRelu_CUDA

See GitHub Actions build pull / win-vs2019-cpu-py3 / test (default, 2, 2, windows.4xlarge) (3/5)

Step: "Upload test artifacts" (full log | diagnosis details | 🔁 rerun)

2022-05-27T06:38:41.0822045Z test_cast (__mai...Error: VariableType::ID() not implemented (0.000s)
2022-05-27T06:38:41.0028415Z   test_call_python_mod_from_tracing_fn (__main__.TestScript) ... ok (0.009s)
2022-05-27T06:38:41.0087344Z   test_call_script_fn_from_script_fn (__main__.TestScript) ... ok (0.006s)
2022-05-27T06:38:41.0176809Z   test_call_script_fn_from_script_module (__main__.TestScript) ... ok (0.009s)
2022-05-27T06:38:41.0284972Z   test_call_script_fn_from_tracing_fn (__main__.TestScript) ... ok (0.007s)
2022-05-27T06:38:41.0356254Z   test_call_script_mod_from_script_fn (__main__.TestScript) ... ok (0.000s)
2022-05-27T06:38:41.0480576Z   test_call_script_mod_from_script_module (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.0491485Z   test_call_script_mod_from_tracing_fn (__main__.TestScript) ... skip: error in first class mode (0.000s)
2022-05-27T06:38:41.0625082Z   test_call_traced_fn_from_tracing_fn (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.0635984Z   test_call_traced_mod_from_tracing_fn (__main__.TestScript) ... skip: error in first class mode (0.000s)
2022-05-27T06:38:41.0813611Z   test_canonicalize_control_outputs (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.0822045Z   test_cast (__main__.TestScript) ... skip: RuntimeError: VariableType::ID() not implemented (0.000s)
2022-05-27T06:38:41.1017741Z   test_cat (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.1103874Z   test_cat_lifts (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.1158677Z   test_chr (__main__.TestScript) ... ok (0.000s)
2022-05-27T06:38:41.1173838Z   test_circular_dependency (__main__.TestScript)
2022-05-27T06:38:41.1655527Z https://github.com/pytorch/pytorch/issues/25871 ... ok (0.054s)
2022-05-27T06:38:41.1892389Z   test_class_as_attribute (__main__.TestScript) ... ok (0.031s)
2022-05-27T06:38:41.1929850Z   test_class_attribute (__main__.TestScript) ... ok (0.000s)
2022-05-27T06:38:41.1969094Z   test_class_attribute_in_script (__main__.TestScript) ... ok (0.000s)
2022-05-27T06:38:41.2039031Z   test_class_with_comment_at_lower_indentation (__main__.TestScript) ... ok (0.016s)
2022-05-27T06:38:41.2049195Z   test_code_with_constants (__main__.TestScript)

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7 / test (distributed, 2, 2, linux.8xlarge.nvidia.gpu) (4/5)

Step: "Upload test artifacts" (full log | diagnosis details | 🔁 rerun)

2022-05-27T06:53:53.1929156Z RuntimeError: hello
2022-05-27T06:53:53.1924395Z -- Process 0 terminated with the following error:
2022-05-27T06:53:53.1924727Z Traceback (most recent call last):
2022-05-27T06:53:53.1925439Z   File "/opt/conda/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap
2022-05-27T06:53:53.1925819Z     fn(i, *args)
2022-05-27T06:53:53.1926318Z   File "/opt/conda/lib/python3.7/site-packages/torch/distributed/elastic/multiprocessing/api.py", line 369, in _wrap
2022-05-27T06:53:53.1926718Z     ret = record(fn)(*args_)
2022-05-27T06:53:53.1927271Z   File "/opt/conda/lib/python3.7/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 345, in wrapper
2022-05-27T06:53:53.1927685Z     return f(*args, **kwargs)
2022-05-27T06:53:53.1928062Z   File "/var/lib/jenkins/workspace/test/distributed/elastic/multiprocessing/api_test.py", line 138, in echo2
2022-05-27T06:53:53.1928880Z     raise RuntimeError(msg)
2022-05-27T06:53:53.1929156Z RuntimeError: hello
2022-05-27T06:53:53.1929322Z 
2022-05-27T06:53:53.1941452Z ok (1.286s)
2022-05-27T06:53:53.1967748Z   test_function_with_tensor (__main__.StartProcessesTest) ... ok (0.002s)
2022-05-27T06:53:53.1984615Z   test_invalid_log_dir (__main__.StartProcessesTest) ... ok (0.002s)
2022-05-27T06:53:53.2151117Z   test_multiprocess_context_close (__main__.StartProcessesTest) ... Closing process 110523 via signal SIGTERM
2022-05-27T06:53:53.2271447Z ok (0.029s)
2022-05-27T06:53:53.2310004Z   test_multiprocessing_context_poll_raises_exception (__main__.StartProcessesTest) ... failed (exitcode: -1) local_rank: 0 (pid: 123) of fn: echo0 (start_method: spawn)
2022-05-27T06:53:53.2310519Z Traceback (most recent call last):
2022-05-27T06:53:53.2311043Z   File "/opt/conda/lib/python3.7/site-packages/torch/distributed/elastic/multiprocessing/api.py", line 453, in _poll
2022-05-27T06:53:53.2311475Z     self._pc.join(-1)

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7 / test (default, 1, 4, linux.4xlarge.nvidia.gpu) (5/5)

Step: "Upload test artifacts" (full log | diagnosis details | 🔁 rerun)

2022-05-27T07:12:28.5225642Z test_rnn_backwar...as.so.11: undefined symbol: cublasGetSmCountTarget
2022-05-27T07:12:27.9885424Z   test_min_max_median_backprops_to_all_values_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.007s)
2022-05-27T07:12:28.0040800Z   test_mv_grad_stride_0_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.015s)
2022-05-27T07:12:28.0058771Z   test_non_differentiable_ops_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.0079989Z   test_parameter_resize_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.0136854Z   test_pin_memory_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.006s)
2022-05-27T07:12:28.0153403Z   test_profiler_emit_nvtx_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.0209991Z   test_pyscalar_conversions_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.006s)
2022-05-27T07:12:28.2426513Z   test_reentrant_parent_error_on_cpu_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.221s)
2022-05-27T07:12:28.2451682Z   test_requires_grad_factory_cuda_float32 (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.003s)
2022-05-27T07:12:28.2475293Z   test_requires_grad_factory_cuda_float64 (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.5225642Z   test_rnn_backward_to_input_but_not_parameters_cuda (__main__.TestAutogradDeviceTypeCUDA) ... Could not load symbol cublasGetSmCountTarget from libcublas.so.11. Error: /usr/local/cuda/lib64/libcublas.so.11: undefined symbol: cublasGetSmCountTarget
2022-05-27T07:12:28.5690463Z ok (0.321s)
2022-05-27T07:12:28.5712578Z   test_scatter_index_reduce_amin_amax_backprops_to_all_values_cuda (__main__.TestAutogradDeviceTypeCUDA) ... /opt/conda/lib/python3.7/site-packages/torch/autograd/gradcheck.py:1427: UserWarning: scatter_reduce() is in beta and the API may change at any time. (Triggered internally at  /var/lib/jenkins/workspace/aten/src/ATen/native/TensorAdvancedIndexing.cpp:1561.)
2022-05-27T07:12:28.5713364Z   func_out = func(*tupled_inputs)
2022-05-27T07:12:28.5826798Z /opt/conda/lib/python3.7/site-packages/torch/autograd/gradcheck.py:1427: UserWarning: index_reduce() is in beta and the API may change at any time. (Triggered internally at  /var/lib/jenkins/workspace/aten/src/ATen/native/cuda/Indexing.cu:880.)
2022-05-27T07:12:28.5827365Z   func_out = func(*tupled_inputs)
2022-05-27T07:12:28.5932216Z ok (0.024s)
2022-05-27T07:12:28.6331035Z   test_scatter_index_reduce_prod_gradgrad_error_cuda (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.040s)
2022-05-27T07:12:28.6352751Z   test_set_requires_grad_only_for_floats_cuda_float16 (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.6374195Z   test_set_requires_grad_only_for_floats_cuda_float32 (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)
2022-05-27T07:12:28.6395177Z   test_set_requires_grad_only_for_floats_cuda_float64 (__main__.TestAutogradDeviceTypeCUDA) ... ok (0.002s)

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.

@kulinseth kulinseth added ciflow/trunk Trigger trunk jobs on your pull request ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR labels May 27, 2022
@kulinseth kulinseth added this to the 1.12.0 milestone May 27, 2022
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

That sounds quite good.
We should mention in the PR description though that this is a temporary way to do testing until MPS gets integrated with the more generic testing we have.

@kulinseth
Copy link
Collaborator Author

@pytorchbot merge this please

@pytorchmergebot
Copy link
Collaborator

Merge failed due to Refusing to merge as mandatory check(s) Lint failed for rule superuser
Raised by https://github.com/pytorch/pytorch/actions/runs/2394605784

@kulinseth
Copy link
Collaborator Author

The build failures seem un-related to this checkin:

Prepare all required actions
[2](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:2)
Getting action download info
[3](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:3)
Download action repository 'actions/upload-artifact@v2' (SHA:82c141cc518b40d92cc801eee768e7aafc9c2fa2)
[4](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:4)
Warning: Failed to download action 'https://api.github.com/repos/actions/upload-artifact/tarball/82c141cc518b40d92cc801eee768e7aafc9c2fa2'. Error: Response status code does not indicate success: 401 (Unauthorized).
[5](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:5)
Warning: Back off 19.944 seconds before retry.
[6](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:6)
Warning: Failed to download action 'https://api.github.com/repos/actions/upload-artifact/tarball/82c141cc518b40d92cc801eee768e7aafc9c2fa2'. Error: Response status code does not indicate success: 401 (Unauthorized).
[7](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:7)
Warning: Back off 12.776 seconds before retry.
[8](https://github.com/pytorch/pytorch/runs/6620803046?check_suite_focus=true#step:11:8)
Error: Response status code does not indicate success: 401 (Unauthorized).

can we merge this @albanD

@kulinseth
Copy link
Collaborator Author

@pytorchbot merge this please

@github-actions
Copy link
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.

@malfet malfet added the module: mps Related to Apple Metal Performance Shaders framework label May 27, 2022
facebook-github-bot pushed a commit that referenced this pull request May 31, 2022
Summary:
This can be used as a reference PR was to add Op in MPS backend.

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

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

Reviewed By: seemethere

Differential Revision: D36783514

Pulled By: seemethere

fbshipit-source-id: 5022b45572f1729989eb1ce61f3ad7af5bd90adc
atalman pushed a commit to atalman/pytorch that referenced this pull request Jun 6, 2022
Summary:
This can be used as a reference PR was to add Op in MPS backend.

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

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

Reviewed By: seemethere

Differential Revision: D36783514

Pulled By: seemethere

fbshipit-source-id: 5022b45572f1729989eb1ce61f3ad7af5bd90adc
atalman pushed a commit to atalman/pytorch that referenced this pull request Jun 6, 2022
Summary:
This can be used as a reference PR was to add Op in MPS backend.

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

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

Reviewed By: seemethere

Differential Revision: D36783514

Pulled By: seemethere

fbshipit-source-id: 5022b45572f1729989eb1ce61f3ad7af5bd90adc
atalman pushed a commit to atalman/pytorch that referenced this pull request Jun 6, 2022
This can be used as a reference PR was to add Op in MPS backend.

Pull Request resolved: pytorch#78408
Approved by: https://github.com/albanD
malfet pushed a commit that referenced this pull request Jun 7, 2022
This can be used as a reference PR was to add Op in MPS backend.

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

(cherry picked from commit 8552acb)
MPSGraphTensor* outputTensor = [mpsGraph bandPartWithTensor:onesTensor
numLower:0
numUpper:0
name:nil];

Choose a reason for hiding this comment

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

To check understanding —the mapping of the native operation here is calling the MPS bandPartWithTensor function with a tensor full of 1.0 and the shape of result to implement the eye operation of producing a diagonal vector full of ones?

@sezelt sezelt mentioned this pull request Dec 17, 2024
pytorchmergebot pushed a commit that referenced this pull request Jan 4, 2025
This adds an MPS backend implementation for `aten::angle` and `aten::angle_out` (mentioned in issue #77764), following the example #78408.

Pull Request resolved: #143449
Approved by: https://github.com/malfet
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 module: mps Related to Apple Metal Performance Shaders framework open source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants