-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
glibc: NVCC aarch64 intrinsics are unsupported #264599
glibc: NVCC aarch64 intrinsics are unsupported #264599
Conversation
7601d28
to
07155f9
Compare
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.
LGTM from the cudaPackages perspective, and I understand you've already verified the patch is sufficient to build cudaPackages.saxpy
Waiting for someone familiar with nixpkgs' glibc to sign off
e96bcac
to
b0ed6a9
Compare
@ofborg build cudaPackages.saxpy |
This is partially correct only: for each release there's an active release branch where patches from their main branch are backported to, we mainly need to update the patchset here.
Please file it upstream anyways. I'd very much prefer to only update our patchlevel rather than maintaining our own patches that nobody else uses.
Agreed 👍 Is there any particular reason though that this is a draft? |
@ofborg build python3Minimal |
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.
Seems to be a noop in non-aarch64, non-linux, non-cuda builds.
I'll defer to @Ma27 for final merge, but I'm fine with this.
I had some trouble rebasing this change from |
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.
The change itself looks good and I agree with the approach. However, I'd like to see this patch being filed against upstream glibc before this gets merged here.
@Ma27 this is a blocker for a number of tasks I'm working on -- is it okay if we do them in parallel? Here's the list of tasks to get them to consider the patch:
EDIT: Updated with status of tasks and note that upstream doesn't intend to fix this. |
@Ma27 @SomeoneSerge @jonringer after some more research:
it's clear that upstream believes compilers should not pretend to implement recent GCC versions if they do not, and does not intend to fix this issue. That's principled and I applaud them for it; however, the fact remains that there's no easy way to patch NVCC because it is a closed source project and relied on heavily in the High Performance Computing (HPC) space. With your blessing, I'd like to merge this to unblock a number of different issues and restore functionality to the CUDA packages Nixpkgs provides. I don't share the same concern as the GLIBC maintainers do about bitrot or forgotten fixes because we maintain our patches alongside the project, rather than embedding them in the source code. If and when support is added and new versions of NVCC are released for all prior versions of CUDA with a fix, we could revisit this patch. Is this agreeable? |
Upstream will not issue such a patch and will leave all released versions of NVCC broken
Just read the ML thraed about the other patch suggested and I agree with your assesment.. Because of that I'm inclined to give an OK to this. There's one thing we should talk about before however given that this patch will probably live a little longer in nixpkgs: are you open to reviewing changes that possibly affect this patch? This includes at least glibc version upgrades and changes to the patch itself. AFAIU I won't be able to do that without nvidia hardware, so I can't do that, correct? If so, please add a note about you maintaining the patch above the inclusion in common.nix. |
I think this is right. We still probably have to patch some downstream apps (torch, opencv?) on master, because otherwise your modules+jetson support PR is blocked for a while
I'm up for reviewing such changes as well
I'll just note that one doesn't need nvidia hardware to run the builds |
I am!
Nah, it's a build failure and the build only requires the CPU. You'd run into this so long as
Will do! |
b0ed6a9
to
2b47345
Compare
Added myself as a maintainer, merging. Thank you for your help and guidance, @Ma27! |
Context
The GLIBC 2.38 update introduces intrinsics for
aarch64-linux
inmath.h
. NVCC (NVIDIA's CUDA Compiler) is now unable to compile any CUDA file foraarch64-linux
because it does not support these intrinsics: https://forums.developer.nvidia.com/t/nvcc-fails-to-build-with-arm-neon-instructions-cpp-vs-cu/248355/2. As a result, PyTorch, Magma, Jax, and any other CUDA-enabled package now fail to build onaarch64-linux
.An alternative approach might be to patch the GLIBC used by NVCC. This approach is not taken for several reasons:
config.cudaSupport = true
would need to bootstrap a second copy of Nixpkgs with aglibc
containing these changes.Description of changes
GLIBC 2.37 -> 2.38 broke CUDA compilation on ARM because it introduced ARM intrinsics in
math.h
. Here are the ones which are causing the errors: https://github.com/bminor/glibc/blob/36f2487f13e3540be9ee0fb51876b1da72176d3f/sysdeps/aarch64/fpu/bits/math-vector.h#L28-L36.NVCC declares itself to be the same compiler as its host compiler. This causes inclusion of unsupported
aarch64-linux
intrinsics.This patch follows the precedent set by upstream by guarding against inclusion of such intrinsics when an unsupported compiler (like NVCC) is detected.
Note: upstream does not intend to fix this. Instead, they place the onus (perhaps rightly) on downstream compilers/pre-processors (like NVCC), with the reasoning that they should not claim to implement a version of a compiler that they do not.
The patch is applied only for
aarch64-linux
.References
Things done
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/
)