-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
python3Packages.torch.tests: MPS tests for darwin #351782
base: master
Are you sure you want to change the base?
Conversation
437e3f9
to
58c970d
Compare
Also got bitten by nixfmt check, fixing that made the diff quite hard to read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of the diff appears to be just formatting changes. let's try to keep the git blame clean
pkgs/development/python-modules/torch/mk-torch-compile-check.nix
Outdated
Show resolved
Hide resolved
pkgs/development/python-modules/torch/mk-torch-compile-check.nix
Outdated
Show resolved
Hide resolved
pkgs/development/python-modules/torch/mk-torch-compile-check.nix
Outdated
Show resolved
Hide resolved
58c970d
to
5a97a78
Compare
I re force-pushed the whole thing and now the diff only shows the lines I changed, however I now get complaint from the nix formatting checks. |
692e739
to
3b563f0
Compare
Made another commit on top to clearly show which part is formatting and which is not |
d88b8a6
to
07596eb
Compare
Actually are you doing merge commits nowadays? Should I make separate PR for the .git-blame-ignore-revs in case the commit hash gets mangled |
pkgs/development/python-modules/torch/mk-torch-compile-check.nix
Outdated
Show resolved
Hide resolved
Yes we do, I think it's ok to keep it in 1 PR |
8d5b802
to
83a4928
Compare
I changed this now so there's a separate test for Darwin. I think in the end it is cleaner this way |
libraries, | ||
pythonPackages, | ||
}: | ||
(cudaPackages.writeGpuTestPython.override { python3Packages = pythonPackages; }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need writeGpuTestPython
then (it adds a gpuCheck
attribute with requiredSystemFeatures
set to access CUDA in the sandbox).
FWIW you make this a simple
runCommand "test-torch-mps" { nativeBuildInputs = [ (python.withPackages ...) ]; } ''
python << \EOF
import torch
...
EOF
''
This maybe has the undesired side-effect that getting a script to run outside the sandbox would take an extra step, but also I don't think anyone would actually need that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this version? I made it to use writeShellApplcation and simply put the python script to separate file because it doesn't need any generated things from Nix side
805896a
to
9a5874a
Compare
tester-darwin = callPackage ./mk-darwin-check.nix { | ||
libraries = ps: [ ps.torch ]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not run the test as part of the derivation though:)
Good idea to move the script into a separate file
It's still a bit disappointing that the script is essentially the same as for cuda/rocm, the difference is just one line which we could simply parameterize (e.g. instead of the @
decorator syntax, we could f = compile(f)
under an if
guard)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow also add this as part of the tests for the package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this good to go in now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow also add this as part of the tests for the package?
We need to make a derivation which runs this script during the build, and we need to put that derivation under passthru.tests
Tests for Darwin. Both CPU and MPS are tested. Signed-off-by: Mika Tammi <[email protected]>
9a5874a
to
2a0e1d1
Compare
Things done
Depends on #351778. Add new test to pytorch for Darwin platform. It tests CPU without torch.compile decorator, and MPS if MPS device is present.
Modify pytorch tests so it also tests MPS during CPU tests on Darwin. I'm not sure is this the right way to do this but at least this is a good starting point for discussion. I was also unsure do the tests work for other platforms. MPS is built for macOS by default if #351778 gets merged in its current state, so it does not need specific torchWithMps build.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.