-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: switch to apple-sdk_13 #351778
Conversation
I also want to include tests for MPS but I was a bit unsure were they even working for other platforms than CUDA. Tests in separate PR here: #351782 |
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.
diff lgtm
thanks for putting this together @mikatammi ! I think we can merge this on the condition that we commit to adding tests, either in #351782 or elsewhere
Strangely I noticed tests started failing in accelerate-package, which depends on torch, after this change |
I'm wondering should I just create additional package called torchWithMps, in similar fashion than there now exists torchWithCuda and torchWithRocm. The MPS should then be explicitly disabled in basic torch package, as it gets automatically detected now that the change to use apple-sdk_13 as buildInput was made |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/title-the-darwin-sdks-have-been-updated/55295/1 |
Interesting, do you have logs for these failures?
Not the craziest idea ever, but I feel like it would be simpler to avoid adding another derivation flag and alias if at all possible |
I created a separate PR for fixing up issues in accelerate package. |
|
Apparently my fixes for skipping some of the accelerate tests were already merged before this PR which breaks them |
(I see there's already an approval; feel free to merge, I self-requested a review just so this doesn't get lost) |
|
It would have to be so ancient that I think it's outside our support window. Even in the off chance this gets built and run on a machine w/o Metal, that would be a runtime error avoidable by setting |
Switch to apple-sdk_13 on Darwin. This enables the use of MPS (Metal Performance Shaders) on macOS. Signed-off-by: Mika Tammi <[email protected]>
@@ -364,6 +364,9 @@ buildPythonPackage rec { | |||
# NB technical debt: building without NNPACK as workaround for missing `six` | |||
USE_NNPACK = 0; | |||
|
|||
# Explicitly enable MPS for Darwin | |||
USE_MPS = setBool stdenv.hostPlatform.isDarwin; |
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.
Maybe at some point we should move these to env, and use optionalAttrs
for platform-specific stuff, because the way we do it now we trigger a useless rebuild on linux. But that's OK.
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.
(just waiting for ofborg-eval now)
Since #346043 was merged to staging, switch to apple-sdk_13 on Darwin. This enables the use of MPS (Metal Performance Shaders) on macOS.
Fixes #243868
Quick test:
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
From package tests, tester-compileCpu was broken because there's no OpenMP in macOS. I hacked it so I could run both CPU and MPS tests on macOS, but I'm going to propose fixes to tests in another PR, because it might become lenghty discussion.
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.