cuda.bindings: build 12.9 and 13.x selectively from main - #2737
Conversation
Moon migration belongs in PR NVIDIA#2659. Restore the pre-Moon selective-CI planner and workflows from 727ef59.
|
/ok to test b87d0a1 |
|
There was a problem hiding this comment.
I started to comment on some individual things, but then decided to stop because I think there is a more fundamental change that needs to be made across this whole PR (and then I'm happy to come back and review further).
/Today/ the "current" version is 13, and the backport version is 12. But at some point in the future that will switch to 14 and 13. This pervasively hardcodes those version numbers all over this codebase, especially in CI, but in a bunch of the release scripts as well, and even the cuda_bindings_12 directory name as indicators of current vs. backport.
Instead, we should use the config we already have in versions.yml and use that to drive the numbers everywhere. That way when it's time to move on, all that should be required is updating versions.yml, and copying/overwriting the existing cuda_bindings to cuda_bindings_backport (or whatever we want to call it), and move on. I'm sure there are many details I'm missing, but that should be the goal and design -- it would be preferable to reduce it to as close to that as possible. The problem with this as-is is that there are hundreds of context-sensitive places that would need to be updated to do that update -- we are creating a massive pile of technical debt to pay later. I'm sure an agent might get that X% correct, but I always think it's better to engineer for flexibility, especially for something we know will happen. If versions.yml (which requires using yq to parse etc.) makes this too difficult, we could explore a simple VARIABLE=value format which would parse as both bash variables and Python variables and probably be more convenient to use from the many places it is needed. There are really only two actual values in versions.yml today, so that should be fine.
I'm also a little concerned (without any testing-based evidence) that this will break when we tag the same commit with v13.x.y and v12.x.y, which will be the common case, in fact, IMHO, one of the real benefits of moving to this approach. We should get an agent to do a thorough investigation of that use case and make sure it is covered. Ideally, it would be nice for a single release run to do both releases simultaneously but it's not a deal breaker if it still requires kicking off two runs.
Also what is this (from the agent's PR description):
The later NVML memoryview fix is reproduced byte-for-byte from cybind commit
6def52ca508c9e14ef67f4ce26a0c677f3fbad72 with Doxygen 1.17.0:
If there is something like this that wasn't backported, let's deal with that separately so it's not an unrelated tag-along to this PR.
Also a note for future agent reviewers of this PR: The interesting part of this PR is the part outside of the cuda_bindings_backport or cuda_bindings_12 directory. Those are just direct copies from the 12.9.x branch, and any differences between that and the cuda_bindings directory are likely intentional. When reviewing, focus on the scaffolding / CI / overall structure.
| @@ -1,19 +1,15 @@ | |||
| # SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
| # SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
There was a problem hiding this comment.
It seems like this whole workflow because obsolete. I could imagine some automation to copy changes from the 13.x directory to the 12.x, but this workflow won't do that --- At a minimum, I don't see how it continues to work after this change.
| BUILD_PYTHON_CU12: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.python.variants.cu12.needs_build }} | ||
| BUILD_PYTHON_CU13: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.python.variants.cu13.needs_build }} |
There was a problem hiding this comment.
This naming is confusing, since it relates to building cuda-python not python. Maybe BUILD_CUDA_PYTHON_CU1?? (I know that would be inconsistent, but in this case I think it's worth it).
| "cuda/bindings/__init__.pxd", | ||
| "cuda/bindings/__init__.py", | ||
| "cuda/bindings/_internal/__init__.py", | ||
| "cuda/bindings/_internal/_fast_enum.py", |
There was a problem hiding this comment.
This is a generated file. Probably doesn't belong here.
| "cuda/bindings/__init__.py", | ||
| "cuda/bindings/_internal/__init__.py", | ||
| "cuda/bindings/_internal/_fast_enum.py", | ||
| "cuda/bindings/_internal/utils.pxd", |
There was a problem hiding this comment.
This file isn't generated but is cargo-culted from cybind. Also /could/ be closely tied to the generated files, so maybe doesn't belong here.
There was a problem hiding this comment.
These changes seem to regress the diagram?
Made this: #2740
| @@ -19,6 +19,7 @@ dependencies: | |||
| - sphinx-copybutton | |||
| - myst-nb | |||
| - enum_tools | |||
| - furo | |||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
There was a problem hiding this comment.
I think it's fine for now that we copy the directory wholesale.
Eventually (after this PR), it would be better to keep files that we want to be shared shared in some other way (actual shared directories, or symlinks) rather than confirming that files are identical -- it will get annoying.
Description
Closes #1199.
This continues and supersedes #2675. That draft was automatically closed when
its temporary
pull-request/2467base was deleted after #2467 merged. Its headbranch is not maintainer-writable, so this replacement preserves the reviewed
history on a writable fork and targets current
maindirectly.What changes
238955935bd903ac72817c0dfdfe4f6a54ee6bb1:cuda_bindingsascuda_bindings_12/.cu12andcu13variants while retaining its aggregate module gates.
bindings/metapackage pairs from
main.12.9.xbranch as a read-only release record. Routineand emergency CUDA 12 work happens on
main; CI and releases no longersource package artifacts from that branch.
mainafter the importedsnapshot, including free-threading-safe parameter packing, Cython/packaging
corrections, option and handle-helper fixes, and the generated NVML
memoryview fix.
v12.9.8tag instead of forcing12.9.8.dev0forever.Selective CI behavior
cuda-pythonpaircuda_bindings_12/**sourcecuda_bindings/**sourcePer-major decisions live under
modules.{bindings,core,python}.variants.{cu12,cu13}. Core's two build halvesare rebuilt together when either bindings line changes, so the merged core
wheel always comes from one source revision. Stable
v12.9.*tags select theCUDA 12 pair;
v13.*tags select the CUDA 13 pair.Explicit reviewer decisions
Please review and explicitly accept or reject both of these policies:
cuda_bindings/andcuda_bindings_12/, are anintentional transitional design.
mainis the sole active source of truth,and
cuda_bindings_12/MAINTENANCE.mddocuments generation provenance andmaintenance rules, while
ci/cuda-bindings-shared-files.jsonenforces byteequality for the explicitly shared subset. This is not precedent for
staging multiple same-major CTK minors such as 13.4 and 13.5 in full
duplicated roots.
12.9.xbranch receives no further backports. Routine andemergency CUDA 12 fixes are made on
mainand applied to every applicablebindings root there.
Generation provenance
Cybind commit
95d8bb525de46a9ff7ae40d759a98cbe50cf8391reproduces 52 generated paths from the imported snapshot, including all 40
generated paths changed by 12.9.x: Update bindings to latest generator release #2604. Complete-root provenance remains partial
because that revision does not reproduce the snapshot's legacy runtime/v2
storage layout.
The later NVML memoryview fix is reproduced byte-for-byte from cybind commit
6def52ca508c9e14ef67f4ce26a0c677f3fbad72with Doxygen 1.17.0:Validation
pre-commit run --all-filespasses withlychee,check-precommit-installed, andsecret-scan-trufflehogexplicitly skippedpython3 -m unittest ci/tools/tests/test_compute_ci_plan.py(6 tests)stable tag, and post-tag behavior
JSON validation, and final history/tree checks
dependency-metadata, and environment-routing smoke checks; this replacement
reruns the full current matrix
Checklist