Skip to content

build: enable CUDA 12 development with utility fixes - #3315

Draft
rwgk wants to merge 7 commits into
rwgk/cb12-staged-01-configfrom
rwgk/cb12-staged-02-developer
Draft

rwgk wants to merge 7 commits into
rwgk/cb12-staged-01-configfrom
rwgk/cb12-staged-02-developer

Conversation

@rwgk

@rwgk rwgk commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

— codex GPT-6 on behalf of Ralf —

Layer 2 of 7 of the staged "CUDA 12 bindings on main" stack. Previous: #3314. Next: #3317. Stack map at the bottom.

What this PR does

Makes cuda_bindings_12/ a place a developer can actually work in on main: install it, run its tests, build its docs. It also carries the three runtime fixes that CUDA 13 already has, and the NVML test adaptations the current CI runners need.

The three runtime fixes are also isolated in #3355 (12.9.x) and #3356 (main). They remain here until #3356 lands; rebasing afterward will remove the duplicated runtime changes from this migration layer.

Size: 38 files, +14,028 / -157 of which 13,185 lines are the new cuda_bindings_12/pixi.lock. The hand-written part is about 850 lines, roughly half of it documentation.

After this merges

  • Developers: pixi run --manifest-path cuda_bindings_12 -e cu12 test, or python -m pip install -e . --group test inside cuda_bindings_12/, work.
  • CI: wheel builds, GPU tests, and releases are unchanged. cuda.core still gets its CUDA 12 bindings from the 12.9.x branch. New: the PR-time CPU smoke job also source-builds the CUDA 12 root.
  • CUDA 13 package versions are unchanged.

Where to look

  • ci/tools/bindings_scm_version.py and the lifecycle section of AGENTS.md: the one piece of "magic" in the stack. Check that it can only ever add a local tag.
  • cuda_bindings_12/pyproject.toml: the Python 3.11 floor and the v12.* selector.
  • The three runtime diffs under cuda_bindings_12/cuda/bindings/ (31 lines total), side by side with their CUDA 13 counterparts.
  • cuda_core/pixi.toml: Core's pixi run test now collects tests/ instead of the package root. This retains Core's owned Python and Cython tests while excluding vendored CCCL tests.
All changes (38 files; 37 without the lockfile, +843 / -157)

Tooling: ci/pyproject.toml (new), ci/tools/bindings_config.py (JSON CLI, python.supported), ci/tools/bindings_scm_version.py (new), ci/tools/check_pixi_cuda_version.py (both roots), ci/tools/compute_ci_plan.py (map cuda_bindings_12/ to the bindings module), tests for the new helper and the registry CLI, removal of a workflow-text test.

Workflows: ci-pixi-source-test.yml (cu12/cu13 matrix for build-smoke and full-test, SCM bootstrap, safe.directory), ci.yml and ci-nightly.yml (install ./ci[test] for the tool tests), .pre-commit-config.yaml (pixi hook paths, large-file exception for the lockfiles).

Package: cuda_bindings_12/pyproject.toml, pixi.toml (new), pixi.lock (new), tests/pytest.ini (thread_unsafe marker), runtime fixes in _internal/utils.pyx, _lib/utils.pxd, _lib/utils.pxi, utils/__init__.py, tests in test_nvjitlink.py, test_nvvm.py, test_utils.py, test_cuda.py, NVML tests.

Pixi: root pixi.toml (test-bindings root selection), cuda_core/pixi.toml (test task scope).

Docs: AGENTS.md, README.md, cuda_bindings_12/AGENTS.md (new), cuda_bindings_12/README.md, docs/source/install.md, support.rst, release/12.X.Y-notes.rst.

Validation
  • Full CI passed at the pre-rebase head 4e22130d (run 41183676173, 104 jobs).
  • The pixi source-build workflow was dispatched manually for cu12 at that head (run 41183098858): build smoke (cu12), pixi run test (cu12, GPU), and the cu13/cu12/cu13 round trip all passed. Three earlier dispatches at intermediate commits failed or were cancelled; the fixes they produced (safe.directory, root task forwarding, Core test scope) are included in this layer.
  • Local validation at 1201c7910be4bb889ef480e9f505cb5a02582640: 316 CI-tool tests and configured workflow lint passed. Full-stack CI on #3322 passed at 126ed74fb5bbfbc91a04e50557cf936efef4da7f (105 successful jobs; one expected skip).
Stack map: what main can do after each layer merges
Layer PR After it merges, main ...
1 #3314 behaves exactly as before; CI has one reader for the two bindings roots; CUDA 13 versions can no longer match a v12.* tag
2 #3315 lets a developer build, test, and document cuda_bindings_12/; the PR-time CPU source-build smoke covers both roots; three CUDA 12 runtime fixes are in
3 #3317 builds the CUDA 12 bindings wheel itself and runs its GPU tests; cuda.core and the metapackage still consume 12.9.x artifacts
4 #3318 uses same-run CUDA 12 wheels everywhere; PR CI no longer reads the 12.9.x branch
5 #3319 can release CUDA 12 from a v12.9.N tag on main; CUDA 13 releases are unchanged
6 #3321 builds and tests only what a change needs, per bindings root, reusing baseline artifacts
7 #3322 carries the schema-2 registry, a manual-only backport workflow, a metadata consistency hook, and the maintenance docs; 12.9.x is frozen

Every layer was designed to be mergeable on its own and had a green full CI run at its pre-rebase head on 2026-10-31. The stack is the "individually mergeable pieces" alternative to #3174-#3182; both stacks reach the same end state except that this one keeps compatibility routes for older artifact sources and retained CUDA 13 tags.

@rwgk
rwgk added this pull request to stack #3316 October 31, 2026 05:02
@copy-pr-bot

copy-pr-bot Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module labels Oct 31, 2026
@rwgk rwgk added this to the cuda.bindings next milestone Oct 31, 2026
@rwgk rwgk added the enhancement Any code-related improvements label Oct 31, 2026
@rwgk rwgk self-assigned this Oct 31, 2026

rwgk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b7c7625

rwgk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test eaf85d9

@github-actions

Copy link
Copy Markdown
Contributor

rwgk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 792b7d1

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 31, 2026

rwgk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 4e22130

@mdboom

mdboom commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/ok to test

@mdboom mdboom left a comment

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.

The most important change request here is to drop the bindings_scm_version.py workaround.

The rest are less important, but quite straightforward.

if: ${{ matrix.cuda-env == 'cu12' }}
uses: ./.github/actions/setup-hardened-python
with:
python-version: "3.12"

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.

Why Python 3.12? Odd choice. I think the best conservative choice is 3.11.

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.

— codex GPT-6 on behalf of Ralf —

Changed the new configuration/bootstrap tooling setups to Python 3.11. implementation.

@@ -0,0 +1,124 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

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.

As I said in my review of #3176, this whole lengthy file exists because we don't have a 12.9.x tag on main. The response there was one of timing, that we couldn't remove this until after the logic to ignore 12.9.x was in the cuda_bindings_13 project. However, in this new stack, that is part of #3314, so I think we can merge #3314, add the tag to main, and then proceed with this but /without/ all of this complexity.

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.

— codex GPT-6 on behalf of Ralf —

Agreed: this split provides an earlier route. Once #3314 lands, create the retained v12.9.11a0 milestone on main, then restack both alternatives onto that tagged commit and remove the helper, its tests, callers and bootstrap metadata. This is still pending; the helper remains until that milestone is reachable.

for i, obj_i in enumerate(obj):
if ResT is char:
obj_i_bytes = (<str?>(obj_i)).encode()
obj_i_type = type(obj_i)

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.

All of the changes to shipping CUDA bindings 12 code here are much higher risk than the other ones. My agent tells me that these were made just to bring 12 more consistent with 13, but are not strictly necessary to make the tests pass on this branch. On that basis, it would generally be preferable to separate them out (so that git bisect can find any unintentional breakage independently of the build/CI system changes).

However, as much as that worries me, I think as long as the tests are passing on this branch, I would be ok with merging this, but let's update the PR title/commit message to call out that the scope includes library code.

If the tests don't pass with these changes, I would advocate reverting them and coming back to them after the whole stack is merged.

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.

— codex GPT-6 on behalf of Ralf —

The three fixes are now isolated in #3355 against 12.9.x and #3356 against main, with focused tests and release notes. Both rebuilt with CUDA 12.9 and passed 94 local tests; hosted #3355 passed all 58 CI jobs, including the GPU regression paths. This migration layer still carries the same changes until #3356 lands, after which a rebase removes that duplication. Its title and description disclose the runtime scope.

Comment on lines +8 to +9
``cuda-bindings`` Upcoming CUDA 12 Release Notes
================================================

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.

Revert.

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.

— codex GPT-6 on behalf of Ralf —

Restored the 12.X.Y Release notes template heading while retaining the substantive release notes. implementation.

Comment thread cuda_bindings_12/pyproject.toml Outdated
Comment on lines 50 to 57
test = [
"cython>=3.2,<3.3",
"setuptools>=77.0.0",
"cython>=3.2.5,<3.3",
"setuptools>=80.0.0",
"numpy>=1.21.1",
"pytest>=6.2.4",
"pytest==9.1.0",
"pytest-benchmark>=3.4.1",
"pytest-subtests>=0.11.0",
"pyglet>=2.1.9"
]

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.

This is now duplicated in dependency-groups below. I think it can just be removed.

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.

— codex GPT-6 on behalf of Ralf —

Removed the duplicated test extra. Installation instructions use the dependency group and state the pip prerequisite. implementation; instructions.

Comment thread cuda_bindings_12/pyproject.toml Outdated
# We deliberately do not want to include the version suffixes (a/b/rc) in cuda-bindings versioning
tag_regex = "^(?P<version>v\\d+\\.\\d+\\.\\d+)"
git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "v*[0-9]*"]
git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "v12.9.*"]

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.

Ditto to my comment on #3314 -- it would be preferable for this to be v12.* (though less important because a 12.10 will never happen).

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.

— codex GPT-6 on behalf of Ralf —

Changed the maintenance selector to v12.*, consistently with the CUDA 13 selector, metadata check and metapackage table. implementation.

Comment thread AGENTS.md Outdated
Comment on lines +65 to +67
when its tag is not reachable from `main`. Update `scm-bootstrap-release`
before another build if such a release consumes its target; do not bump the
field per PR or use it to override suitable reachable tags.

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.

I don't understand this sentence.

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.

— codex GPT-6 on behalf of Ralf —

Simplified the temporary milestone guidance. Until the retained milestone exists, the preview target must avoid a release number already consumed on another branch. The bootstrap-only field and instructions can disappear with the helper after the tag/restack step. implementation.

Comment thread AGENTS.md Outdated
Comment on lines +68 to +71
- Moving a package's SCM selector to a new toolkit minor also needs a matching
reachable milestone. Updating the selector alone can produce an incorrect
placeholder version. Validate previews with local tags in an independent
disposable clone until the release history supplies the right milestone.

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.

What about this design is enforcing this requirement? It would be great to fix this because it negates a large part of the usefulness of setuptools-scm.

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.

— codex GPT-6 on behalf of Ralf —

Removed that requirement: major-scoped selectors preserve normal setuptools-scm progression across toolkit-minor updates. implementation.

Comment thread AGENTS.md Outdated
Comment on lines +72 to +75
- For a newly integrated maintenance root, create its first retained internal
milestone only after the integration group has landed and been validated on
`main`. Retained tag creation requires an explicit maintainer decision;
preparation of a PR stack does not authorize creating or pushing it.

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.

I don't think we will ever have another "newly integrated maintenance root". Our next maintenance root will be cuda_bindings_13, which is already here. So maybe just remove this paragraph?

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.

— codex GPT-6 on behalf of Ralf —

Removed the speculative newly-integrated-root rule and described the concrete selector-isolation prerequisite instead. implementation.

Comment thread README.md Outdated
## Bindings source roots

Current CUDA 13 bindings live in [`cuda_bindings_13/`](cuda_bindings_13/), and
CUDA 12.9 sources have a separate

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.

Suggested change
CUDA 12.9 sources have a separate
CUDA 12 bindings sources have a separate

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.

— codex GPT-6 on behalf of Ralf —

Used “CUDA 12 bindings sources have a separate …”. implementation.

rwgk added 6 commits November 3, 2026 22:00
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
@rwgk
rwgk force-pushed the rwgk/cb12-staged-02-developer branch from 968ad32 to 1201c79 Compare November 4, 2026 06:08
@rwgk rwgk changed the title build: enable CUDA 12 development from main build: enable CUDA 12 development with utility fixes Nov 4, 2026

@rwgk rwgk left a comment

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.

— codex GPT-6 on behalf of Ralf —

Thanks for the review. All ten inline comments now have direct replies. The smaller development/packaging changes are applied; the runtime fixes are isolated in #3355 (12.9.x, green CI) and #3356 (main).

The main simplification from your review remains pending: land corrected #3314, create the retained v12.9.11a0 milestone on validated main, then restack both alternatives and remove the bootstrap helper, tests, callers, and temporary metadata. I agree the helper should go; this records the prerequisite rather than treating its removal as complete.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module enhancement Any code-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants