[Testing] Add MPS to NATIVE_DEVICES (#153835)

This would allow me to enable more opinfo tests against MPS device eventually and supposed to be a very simple test, but actually required minor adjustments to lots of test files, namely:
- Introduce `all_mps_types_and` that is very similar to `all_types_and`, but skips `float64`
- Decorate lots of tests with `@dtypesIfMPS(*all_mps_types())`
- Skip `test_from_dlpack_noncontinguous` as it currently crashes (need to be fixed)
- Add lots of `expectedFailureIfMPS`
- Delete all `@onlyNativeDeviceTypesAnd("mps")`

<sarcasm> I love how well documented this variable are </sarcasm>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/153835
Approved by: https://github.com/Skylion007
This commit is contained in:
Nikita Shulga
2025-08-05 18:57:35 +00:00
committed by PyTorch MergeBot
parent 0ba09a6d34
commit e06b110f73
8 changed files with 88 additions and 9 deletions

View File

@ -297,7 +297,7 @@ if os.getenv("SLOW_TESTS_FILE", ""):
if os.getenv("DISABLED_TESTS_FILE", ""):
disabled_tests_dict = maybe_load_json(os.getenv("DISABLED_TESTS_FILE", ""))
NATIVE_DEVICES = ('cpu', 'cuda', 'xpu', 'meta', torch._C._get_privateuse1_backend_name())
NATIVE_DEVICES = ('cpu', 'cuda', 'xpu', 'meta', 'mps', torch._C._get_privateuse1_backend_name())
# used for managing devices testing for torch profiler UTs
# for now cpu, cuda and xpu are added for testing torch profiler UTs