Skip to content

build: enable CUDA 12 development from main - #3315

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

rwgk wants to merge 6 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.

Size: 37 files, +14,041 / -155, 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.

  • Packaging (cuda_bindings_12/pyproject.toml): Python >= 3.11 (3.10 dropped, as agreed with Mike on cuda.bindings: configure independent CUDA 12 and CUDA 13 packages #3174), 3.14/3.15 classifiers, [dependency-groups] mirroring CUDA 13, standard setuptools-scm tag parsing with selector v12.9.* (the custom tag_regex is gone), and a scm-bootstrap-release = "12.9.11" preview target.
  • Pixi: new cuda_bindings_12/pixi.toml + lock (cu12, docs, cython-tests features). The root test-bindings task picks the root from the environment name. The pin check covers both roots and Core.
  • Version preview bootstrap (ci/tools/bindings_scm_version.py, 124 lines). Copying the sources did not bring the 12.9.x tags along, so a plain checkout derives 12.9.1.devN. In a disposable CI checkout the helper creates one local tag v12.9.11a0.dev0 at HEAD^, so builds get 12.9.11a0.devN. It never pushes, never moves an existing tag, and stands down once a real v12.9.* tag at or above 12.9.10 is reachable. The lifecycle rules are written into AGENTS.md.
  • CI tooling as a package: ci/pyproject.toml, installed with pip install -e ./ci.
  • CPU source-build smoke (ci-pixi-source-test.yml): the PR job runs a cu12 and a cu13 leg; the nightly GPU full-test too. A container checkout needs git config --global --add safe.directory before the SCM bootstrap runs; that was found and fixed here.
  • Runtime fixes ported from CUDA 13: bytes compiler options (Fix get_nested_resource_ptr to accept both str and bytes inputs #1665, Fix get_nested_resource_ptr to accept both str and bytes inputs #1698), coredump buffer ownership (Harden program-cache permissions, binary-path resolution, and coredump helper lifetime #2399), handle-getter error propagation (Do not report a registered type as "Unknown type" in get_cuda_native_handle #2551), each with its test.
  • Test maintenance ported from the CUDA 13 NVML tests: Orin/Thor naming, NotSupportedError for PCI info, driver >= 13.4 refcount skip, removal of the flaky energy test, thread_unsafe markers.
  • Docs: root and package AGENTS.md (the rule that a change in one root must be checked against the other), README, install/support pages (Python 3.11), rewritten 12.X.Y-notes.rst.

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.9.* 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 (37 files; 36 without the lockfile, +856 / -155)

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.
  • Current head 968ad32089f4a0f1ee8f0f223982527cc2c67b24 includes the follow-up fixes. Local validation: 303 CI-tool tests, actionlint passed. Full CI and native Pixi source/GPU checks have not been rerun for it.
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

rwgk added 6 commits November 1, 2026 19:39
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 46e13aa to 968ad32 Compare November 2, 2026 03:53
@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.

@@ -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.

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.

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.

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.

# 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).

Comment thread AGENTS.md
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.

Comment thread AGENTS.md
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.

Comment thread AGENTS.md
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?

Comment thread README.md
## 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

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