Skip to content

cudaPackages.cuda_nvcc: patch math_functions.h signatures#484031

Merged
ConnorBaker merged 1 commit into
NixOS:masterfrom
GaetanLepage:cuda-maths
Feb 8, 2026
Merged

cudaPackages.cuda_nvcc: patch math_functions.h signatures#484031
ConnorBaker merged 1 commit into
NixOS:masterfrom
GaetanLepage:cuda-maths

Conversation

@GaetanLepage

@GaetanLepage GaetanLepage commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Things done

Fix compatibility with glibc 2.42

The latest glibc (2.42) brought by the latest staging-next iteration does not play well with cuda 12.8.
This at least breaks bitsandbytes (#483507).

The cospi|sinpi|rsqrt function signatures in include/common/math_functions.h do not match glibc 2.42's.
Indeed, there they are declared with noexcept(true) which is not the case in cuda_nvcc.

This PR patches math_functions.h in cuda_nvcc's output to fix the issue.

cc @NixOS/cuda-maintainers @kirillrdy

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 6.topic: cuda Parallel computing platform and API labels Jan 26, 2026
@GaetanLepage

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 484031 --extra-nixpkgs-config '{ allowUnfree = true; cudaSupport = true; }' --package python3Packages.bitsandbytes
Commit: 0fcee7419cb5778cc60605239ab41cefeb696f91


x86_64-linux

✅ 2 packages built:
  • python3Packages.bitsandbytes
  • python3Packages.bitsandbytes.dist (python3Packages.bitsandbytes.dist.dist)

@GaetanLepage

Copy link
Copy Markdown
Contributor Author

This indeed fixes bitsandbytes' configurePhase with cudaSupport enabled.

@GaetanLepage GaetanLepage marked this pull request as ready for review January 26, 2026 15:17
@ConnorBaker

Copy link
Copy Markdown
Contributor

Remind me, does this affect all versions of CUDA? If that includes CUDA 13.0, do we need to package cuda_crt instead of cuda_nvcc (I can't remember if cuda_crt is the one that provides the CRT headers, if we copy them into cuda_nvcc, or something else).

@ConnorBaker ConnorBaker self-assigned this Jan 26, 2026
@ConnorBaker

Copy link
Copy Markdown
Contributor

As a followup, do we need to worry about backporting these changes? I remember GLIBC was bumped to fix several vulnerabilities -- not sure if patches or the version bump would be backported.

@GaetanLepage

Copy link
Copy Markdown
Contributor Author

As a followup, do we need to worry about backporting these changes? I remember GLIBC was bumped to fix several vulnerabilities -- not sure if patches or the version bump would be backported.

Seems like python3Packages.bitsandbytes builds fine on release-25.11 with cudaSupport.
This is expected as glibc is still at 2.40-66 there.

@SomeoneSerge

Copy link
Copy Markdown
Contributor

Ah this was a simpler diff than I thought, shouldn't have blocked. That said, versionAtLeast glibc.version "2.42"?

@nixpkgs-ci nixpkgs-ci Bot requested a review from a team February 7, 2026 23:02
@GaetanLepage

Copy link
Copy Markdown
Contributor Author

Ah this was a simpler diff than I thought, shouldn't have blocked. That said, versionAtLeast glibc.version "2.42"?

Done!

@ConnorBaker ConnorBaker added this pull request to the merge queue Feb 8, 2026
Merged via the queue into NixOS:master with commit b27eb42 Feb 8, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from New to ✅ Done in CUDA Team Feb 8, 2026
# The cospi|sinpi|rsqrt function signatures in include/common/math_functions.h do not match
# glibc 2.42's.
# Indeed, there they are declared with noexcept(true) which is not the case in cuda_nvcc.
+ lib.optionals (lib.versionAtLeast glibc.version "2.42") ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionalString?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh kill me
Can you make a hotfix and I’ll merge it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry...
Opened #488516.

@GaetanLepage GaetanLepage deleted the cuda-maths branch February 8, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cuda Parallel computing platform and API 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants