Skip to content

ci: use same-run CUDA 12 bindings for Core and metapackages - #3318

Draft
rwgk wants to merge 2 commits into
rwgk/cb12-staged-03-bindings-cifrom
rwgk/cb12-staged-04-consumers
Draft

rwgk wants to merge 2 commits into
rwgk/cb12-staged-03-bindings-cifrom
rwgk/cb12-staged-04-consumers

Conversation

@rwgk

@rwgk rwgk commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

— codex GPT-6 on behalf of Ralf —

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

What this PR does

Cuts the last dependency on the 12.9.x branch inside PR CI. Everything that needs CUDA 12 bindings during a main run now takes the wheel built in the same run.

  • cuda.core's cu12 half is built against the same-run CUDA 12 wheel. The lookup-run-id --branch 12.9.x artifact download disappears from build-wheel.yml.
  • Core's cu12 Cython test extensions are built and uploaded (<core artifact>-cu12-tests), with stale-output cleanup between the two ABI builds.
  • A CUDA 12 metapackage wheel is built (CUDA_PYTHON_BUILD_MAJOR=12) next to the CUDA 13 one.
  • The temporary Maintenance bindings jobs from ci: build and test local CUDA 12 bindings #3317 go away. Instead the regular test matrices annotate each row from the registry (BINDINGS_ROOT, BINDINGS_SOURCE, artifact names): 12.9.1 rows test bindings, Core, and metapackage from this run's wheels; 13.0.x / 12.6.x rows keep testing Core against published floor bindings.
  • sdist checks run once per package root (matrix over the registry), with the SCM preview bootstrap for the CUDA 12 root.
  • cuda_python/setup.py + pyproject.toml: a selector table {"12": "v12.9.*", "13": "v13.4.*"}; CUDA_PYTHON_BUILD_MAJOR (default 13) picks the line; dependencies follow the resolved version, so a CUDA 12 sdist rebuilt outside Git keeps CUDA 12 dependencies. The CUDA 12 metapackage depends on bindings only; CUDA 13 also on Core and Pathfinder. Covered by test_cuda_python_setup.py.

After this merges

Where to look

All changes (14 files, +331 / -237)
  • .github/workflows/build-wheel.yml: same-run CUDA 12 constraint for Core, maintenance metapackage wheel, maintenance Core Cython tests, removal of the prior-branch lookup.
  • .github/workflows/ci.yml: removal of the three temporary jobs; sdist jobs matrixed over package_roots; bindings-config passed to all test jobs.
  • .github/workflows/test-sdist-linux.yml, test-sdist-windows.yml: bindings-package input replaces cuda-version; per-root build, Pathfinder sdist only for the current root.
  • .github/workflows/test-wheel-linux.yml, test-wheel-windows.yml: registry-driven row annotation; bindings-only input removed.
  • ci/tools/env-vars: MAINTENANCE_CUDA_MAJOR, registry-driven test routing, Core Cython artifact suffix, metapackage artifact name.
  • cuda_python/setup.py, cuda_python/pyproject.toml, ci/tools/tests/test_cuda_python_setup.py (new).
  • Docs: cuda_python/AGENTS.md, cuda_python/docs/README.md, cuda_core/docs/source/install.rst.
Validation
  • Full CI passed at the pre-rebase head 2f2eb43e (run 41188280375).
  • Current head 55b92f8674510105d2184ad371df4b75ba71e3f0 includes the follow-up fixes. Local validation: 306 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:27
@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.core Everything related to the cuda.core module labels Oct 31, 2026
@rwgk rwgk added this to the cuda.bindings next milestone Oct 31, 2026
@rwgk rwgk added enhancement Any code-related improvements cuda.bindings Everything related to the cuda.bindings module and removed cuda.core Everything related to the cuda.core module labels Oct 31, 2026
@rwgk rwgk self-assigned this Oct 31, 2026
@rwgk
rwgk force-pushed the rwgk/cb12-staged-04-consumers branch from c8ce319 to ea19ebc Compare October 31, 2026 05:38
@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 31, 2026
@rwgk
rwgk force-pushed the rwgk/cb12-staged-04-consumers branch from ea19ebc to 44b64de Compare October 31, 2026 06:03
@rwgk
rwgk force-pushed the rwgk/cb12-staged-04-consumers branch from 44b64de to 4b8376e Compare October 31, 2026 07:49
@rwgk
rwgk force-pushed the rwgk/cb12-staged-04-consumers branch from 4b8376e to 2f2eb43 Compare October 31, 2026 08:03

rwgk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2f2eb43

@github-actions

Copy link
Copy Markdown
Contributor

rwgk added 2 commits November 1, 2026 19:41
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-04-consumers branch from b252422 to 55b92f8 Compare November 2, 2026 03:53

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

In addition to my comments below, my bot had this to say:

🤖 Registry join can silently disable bindings tests (medium): matrix rows are matched to the registry by exact CUDA_VER == toolkit_version. If versions.yml goes from 13.4.2 to 13.4.3 and the matrix rows aren't updated, those rows silently become floor and skip the bindings and Cython tests with no error. The old logic compared major and minor only. The fix is to join on ctk_target.

Comment on lines +50 to +58
BUILD_MAINTENANCE_BINDINGS: >-
${{ !inputs.single-cuda-major &&
(inputs.workplan == '' ||
fromJSON(inputs.workplan).modules.bindings.needs_build ||
fromJSON(inputs.workplan).modules.bindings.needs_test ||
fromJSON(inputs.workplan).modules.core.needs_build ||
fromJSON(inputs.workplan).modules.core.needs_test ||
fromJSON(inputs.workplan).modules.python.needs_build ||
fromJSON(inputs.workplan).modules.python.needs_test) }}

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 should be a single entry in the workplan JSON and computed from compute_ci_plan.py (so we don't have this logic reimplemented in JS and scattered in the .yml files).

Comment on lines 168 to 172
- name: Prepare local maintenance SCM milestone
if: ${{ !inputs.single-cuda-major && (env.BUILD_BINDINGS == 'true' || env.TEST_BINDINGS == 'true') }}
if: ${{ env.BUILD_MAINTENANCE_BINDINGS == 'true' }}
run: |
python -m ci.tools.bindings_scm_version \
--package-root "${MAINTENANCE_BINDINGS_ROOT}" --sha "${{ github.sha }}"

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.

See many previous comments about bindings_scm_version workaround and how it simplifies all of this.

Comment on lines +716 to +749
- name: Build maintenance cuda.core Cython tests
if: ${{ !inputs.single-cuda-major && env.TEST_CORE == 'true' }}
run: |
# The current package's test extensions were built in this same source tree.
# Remove generated outputs so Cython and the compiler cannot reuse them.
find "${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}" -maxdepth 1 -type f \
\( -name 'test_*.cpp' -o -name 'test_*.so' -o -name 'test_*.pyd' \) -delete
if [[ -d "${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/build" ]]; then
find "${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/build" -type f -delete
fi
pip uninstall -y cuda-bindings cuda-core
pip install ${{ env.MAINTENANCE_BINDINGS_ARTIFACTS_DIR }}/*.whl
if ${{ env.BUILD_CORE == 'true' }}; then
core_wheel=$(find "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${MAINTENANCE_CUDA_MAJOR}" -maxdepth 1 -type f -name '*.whl' -print -quit)
else
core_wheel=$(find "${{ env.CUDA_CORE_ARTIFACTS_DIR }}" -maxdepth 1 -type f -name '*.whl' -print -quit)
fi
if [[ -z "${core_wheel}" ]]; then
echo "No cuda.core wheel found" >&2
exit 1
fi
pip install "${core_wheel}" --group ./cuda_core/pyproject.toml:test
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd

- name: Upload maintenance cuda.core Cython tests
if: ${{ !inputs.single-cuda-major && env.TEST_CORE == 'true' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-cu${{ env.MAINTENANCE_CUDA_MAJOR }}-tests
path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }}
if-no-files-found: error

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.

Any way to reduce the duplication here between the current and maintenance versions?

@@ -0,0 +1,65 @@
# 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.

These tests seem to be so full of monkeypatches as to provide minimal value.

Let's ask the agent if any of these issues would "fail naturally" in the course of running the CI itself, and if so, remove them.

Comment thread cuda_python/setup.py
Comment on lines +20 to +22
build_major = os.environ.get("CUDA_PYTHON_BUILD_MAJOR", "13")
if build_major not in {"12", "13"}:
raise ValueError(f"CUDA_PYTHON_BUILD_MAJOR must be 12 or 13, got {build_major!r}")

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.

Using an environment variable for this seems like a big foot gun. For example, if I'm making a release on a tag v12.9.10 but forget to set this environment variable, the build will fail in an obscure way. I would expect this to need to be set in the release.yml workflow in order to do the right thing, but I don't see that change in this or any PRs further up the stack.

I think it would be better to implement our own custom version number lookup before importing setuptools_scm. It would look for an exact tag match for v12.X.Z and if so, set SETUPTOOLS_SCM_PRETEND_VERSION to that exact value. Otherwise fallback to setuptools_scm's default behavior with the 13.* pattern. Then this will do the right thing by default.

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