Skip to content

[MPS] Add test/test_nn.py to test suite #134184

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

Conversation

hvaara
Copy link
Contributor

@hvaara hvaara commented Aug 22, 2024

This PR increases test coverage by including the tests in test/test_nn.py in the test suite of MPS.

Some of the tests are decorated with @expectedFailureMPS for various reasons. Either that the op is not implemented, or that the outputs do not align. Those tests that contain differing results should be investigated further to rule out any live bugs.

$ python test/run_test.py --mps --verbose -k TestNN
Running test batch 'tests to run' cost 84.76 seconds

Ref #133520

cc @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen

@hvaara hvaara requested review from mruberry and a team as code owners August 22, 2024 00:43
Copy link

pytorch-bot bot commented Aug 22, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/134184

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c521e3c with merge base af66488 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: nn release notes category label Aug 22, 2024
@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

@pytorchbot label "module: mps" "topic: not user facing"

@pytorch-bot pytorch-bot bot added module: mps Related to Apple Metal Performance Shaders framework topic: not user facing topic category labels Aug 22, 2024
@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

This will likely fail, but I'll try anyways so maybe I can get some feedback for macOS 13 and 15.

@pytorchbot label "ciflow/mps"

Copy link

pytorch-bot bot commented Aug 22, 2024

Can't add following labels to PR: ciflow/mps. Please ping one of the reviewers for help.

@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

Requesting approval for this change from @kulinseth or @malfet as code owners for MPS.

@skotapati
Copy link
Collaborator

@hvaara thanks for opening this pr. I went ahead and launched your CI run so we can see what happens, but just fyi that I may open a separate pr to add test_nn and a few others to the mps flow

@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

Thanks @skotapati!

but just fyi that I may open a separate pr to add test_nn and a few others to the mps flow

I don't understand. Do you mean you want me to split this up, or did you mean you're already working on something similar? Do you have a PR?

Attempting to add MPS ciflow again.

@pytorchbot label "ciflow/mps"

@pytorch-bot pytorch-bot bot added the ciflow/mps Run MPS tests (subset of trunk) label Aug 22, 2024
@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

Tests pass on macOS 14 and 15.

Detected failure on macOS 13:TestNNDeviceTypeMPS.test_conv_empty_input_mps_bfloat16 due to TypeError: MPS BFloat16 is only supported on MacOS 14 or newer. Skipping this test on macOS 13.

@pytorchbot label keep-going

@pytorch-bot pytorch-bot bot added the keep-going Don't stop on first failure, keep running tests until the end label Aug 22, 2024
@hvaara
Copy link
Contributor Author

hvaara commented Aug 22, 2024

I think that was the last of it in MPS - adding trunk.

@pytorchbot label ciflow/trunk

Copy link

pytorch-bot bot commented Aug 22, 2024

Can't add following labels to PR: ciflow/trunk. Please ping one of the reviewers for help.

@hvaara
Copy link
Contributor Author

hvaara commented Aug 23, 2024

I think the test runner died before starting the build step, but I see no way of restarting the tests. Will force push

image

@hvaara
Copy link
Contributor Author

hvaara commented Aug 23, 2024

Had to force-push again. There's been several incidents with Actions lately, but the tests are running again now.

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.

SGTM
How do you plan to track these disables to work on fixing them?

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@malfet
Copy link
Contributor

malfet commented Aug 26, 2024

@hvaara you need to fix lint before this change can go in (and I can't do it for you, as you do not accept changes from contributors on your fork of PyTorch)

@hvaara
Copy link
Contributor Author

hvaara commented Aug 26, 2024

Thanks for looking, @malfet. Fixed it and ran make lint locally this time to verify resolution.

The following option is enabled

image

am I missing something?

@hvaara
Copy link
Contributor Author

hvaara commented Aug 26, 2024

though in the long run we probably don't need to add those to MPS shard, as they'll be picked up by trunk

How will they be picked up by trunk? Is this something that's planned for the future?

@malfet
Copy link
Contributor

malfet commented Aug 26, 2024

@pytorchbot merge -f "Lint is green and CI was green during previous iteration"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@malfet
Copy link
Contributor

malfet commented Aug 27, 2024

though in the long run we probably don't need to add those to MPS shard, as they'll be picked up by trunk

How will they be picked up by trunk? Is this something that's planned for the future?

test_nn.py is running as part of trunk workflow, and it should cover MPS as well after your change, see https://github.com/pytorch/pytorch/actions/runs/10568390813/job/29279246604

@hvaara
Copy link
Contributor Author

hvaara commented Aug 27, 2024

though in the long run we probably don't need to add those to MPS shard, as they'll be picked up by trunk

How will they be picked up by trunk? Is this something that's planned for the future?

test_nn.py is running as part of trunk workflow, and it should cover MPS as well after your change, see https://github.com/pytorch/pytorch/actions/runs/10568390813/job/29279246604

Do you mean it's sufficient to set allow_mps=True in https://github.com/hvaara/pytorch/blob/c521e3c4df81ea587055cf27f4aae00f3ef269a8/test/test_nn.py#L12997 and not include test_nn in https://github.com/hvaara/pytorch/blob/c521e3c4df81ea587055cf27f4aae00f3ef269a8/test/run_test.py#L1425 ?

@hvaara
Copy link
Contributor Author

hvaara commented Sep 6, 2024

pytorchmergebot pushed a commit that referenced this pull request Sep 9, 2024
Updating the comments with references to better places for context now that the bugs have been identified.

xref #135442 #135447 #134184

Pull Request resolved: #135448
Approved by: https://github.com/ezyang
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Sep 20, 2024
This PR increases test coverage by including the tests in `test/test_nn.py` in the test suite of MPS.

Some of the tests are decorated with `@expectedFailureMPS` for various reasons. Either that the op is not implemented, or that the outputs do not align. Those tests that contain differing results should be investigated further to rule out any live bugs.

```bash
$ python test/run_test.py --mps --verbose -k TestNN
Running test batch 'tests to run' cost 84.76 seconds
```

Ref pytorch#133520

Pull Request resolved: pytorch#134184
Approved by: https://github.com/albanD, https://github.com/malfet
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Sep 20, 2024
Updating the comments with references to better places for context now that the bugs have been identified.

xref pytorch#135442 pytorch#135447 pytorch#134184

Pull Request resolved: pytorch#135448
Approved by: https://github.com/ezyang
apakbin pushed a commit to apakbin/pytorch that referenced this pull request Feb 14, 2025
Updating the comments with references to better places for context now that the bugs have been identified.

xref pytorch#135442 pytorch#135447 pytorch#134184

Pull Request resolved: pytorch#135448
Approved by: https://github.com/ezyang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/mps Run MPS tests (subset of trunk) ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end Merged module: mps Related to Apple Metal Performance Shaders framework open source release notes: nn release notes category topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants