Repository navigation
[no-ci] cuda.bindings: import the CUDA 12 maintenance source on main - #3172
Conversation
Copy cuda_bindings from NVIDIA/cuda-python:12.9.x at ca0f150 into cuda_bindings_12 without modifying the source tree. Package registration and build/test integration follow in later layers. Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
|
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. |
|
Thanks @mdboom! I tweaked the PR Description slightly, but didn't change the source tree after your approval. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 8
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
206b6681-73fc-41f4-848f-c1a1a32b6e3f
⛔ Files ignored due to path filters: 3
cuda_bindings_12/docs/source/_static/images/Nsight-Compute-CLI-625x473.pngis excluded by!**/*.pngcuda_bindings_12/docs/source/_static/logo-dark-mode.pngis excluded by!**/*.pngcuda_bindings_12/docs/source/_static/logo-light-mode.pngis excluded by!**/*.png
📒 Files selected for processing: 213
.pre-commit-config.yamlcuda_bindings_12/.git_archival.txtcuda_bindings_12/DESCRIPTION.rstcuda_bindings_12/LICENSEcuda_bindings_12/MANIFEST.incuda_bindings_12/README.mdcuda_bindings_12/benchmarks/conftest.pycuda_bindings_12/benchmarks/kernels.pycuda_bindings_12/benchmarks/pytest.inicuda_bindings_12/benchmarks/test_cupy.pycuda_bindings_12/benchmarks/test_launch_latency.pycuda_bindings_12/benchmarks/test_numba.pycuda_bindings_12/benchmarks/test_pointer_attributes.pycuda_bindings_12/build_hooks.pycuda_bindings_12/cuda/bindings/__init__.pxdcuda_bindings_12/cuda/bindings/__init__.pycuda_bindings_12/cuda/bindings/_bindings/__init__.pycuda_bindings_12/cuda/bindings/_bindings/cyruntime.pxd.incuda_bindings_12/cuda/bindings/_bindings/cyruntime.pyx.incuda_bindings_12/cuda/bindings/_bindings/cyruntime_ptds.pxd.incuda_bindings_12/cuda/bindings/_bindings/cyruntime_ptds.pyx.incuda_bindings_12/cuda/bindings/_internal/__init__.pycuda_bindings_12/cuda/bindings/_internal/_fast_enum.pycuda_bindings_12/cuda/bindings/_internal/cufile.pxdcuda_bindings_12/cuda/bindings/_internal/cufile_linux.pyxcuda_bindings_12/cuda/bindings/_internal/driver.pxdcuda_bindings_12/cuda/bindings/_internal/driver_linux.pyxcuda_bindings_12/cuda/bindings/_internal/driver_windows.pyxcuda_bindings_12/cuda/bindings/_internal/nvfatbin.pxdcuda_bindings_12/cuda/bindings/_internal/nvfatbin_linux.pyxcuda_bindings_12/cuda/bindings/_internal/nvfatbin_windows.pyxcuda_bindings_12/cuda/bindings/_internal/nvjitlink.pxdcuda_bindings_12/cuda/bindings/_internal/nvjitlink_linux.pyxcuda_bindings_12/cuda/bindings/_internal/nvjitlink_windows.pyxcuda_bindings_12/cuda/bindings/_internal/nvml.pxdcuda_bindings_12/cuda/bindings/_internal/nvml_linux.pyxcuda_bindings_12/cuda/bindings/_internal/nvml_windows.pyxcuda_bindings_12/cuda/bindings/_internal/nvrtc.pxdcuda_bindings_12/cuda/bindings/_internal/nvrtc_linux.pyxcuda_bindings_12/cuda/bindings/_internal/nvrtc_windows.pyxcuda_bindings_12/cuda/bindings/_internal/nvvm.pxdcuda_bindings_12/cuda/bindings/_internal/nvvm_linux.pyxcuda_bindings_12/cuda/bindings/_internal/nvvm_windows.pyxcuda_bindings_12/cuda/bindings/_internal/utils.pxdcuda_bindings_12/cuda/bindings/_internal/utils.pyxcuda_bindings_12/cuda/bindings/_lib/__init__.pycuda_bindings_12/cuda/bindings/_lib/cyruntime/__init__.pycuda_bindings_12/cuda/bindings/_lib/cyruntime/cyruntime.pxdcuda_bindings_12/cuda/bindings/_lib/cyruntime/cyruntime.pxicuda_bindings_12/cuda/bindings/_lib/dlfcn.pxdcuda_bindings_12/cuda/bindings/_lib/utils.pxdcuda_bindings_12/cuda/bindings/_lib/utils.pxicuda_bindings_12/cuda/bindings/_lib/windll.pxdcuda_bindings_12/cuda/bindings/_test_helpers/__init__.pycuda_bindings_12/cuda/bindings/_test_helpers/arch_check.pycuda_bindings_12/cuda/bindings/cufile.pxdcuda_bindings_12/cuda/bindings/cufile.pyxcuda_bindings_12/cuda/bindings/cycufile.pxdcuda_bindings_12/cuda/bindings/cycufile.pyxcuda_bindings_12/cuda/bindings/cydriver.pxdcuda_bindings_12/cuda/bindings/cydriver.pyxcuda_bindings_12/cuda/bindings/cynvfatbin.pxdcuda_bindings_12/cuda/bindings/cynvfatbin.pyxcuda_bindings_12/cuda/bindings/cynvjitlink.pxdcuda_bindings_12/cuda/bindings/cynvjitlink.pyxcuda_bindings_12/cuda/bindings/cynvml.pxdcuda_bindings_12/cuda/bindings/cynvml.pyxcuda_bindings_12/cuda/bindings/cynvrtc.pxdcuda_bindings_12/cuda/bindings/cynvrtc.pyxcuda_bindings_12/cuda/bindings/cynvvm.pxdcuda_bindings_12/cuda/bindings/cynvvm.pyxcuda_bindings_12/cuda/bindings/cyruntime.pxd.incuda_bindings_12/cuda/bindings/cyruntime.pyx.incuda_bindings_12/cuda/bindings/cyruntime_functions.pxi.incuda_bindings_12/cuda/bindings/cyruntime_types.pxi.incuda_bindings_12/cuda/bindings/driver.pxdcuda_bindings_12/cuda/bindings/driver.pyxcuda_bindings_12/cuda/bindings/nvfatbin.pxdcuda_bindings_12/cuda/bindings/nvfatbin.pyxcuda_bindings_12/cuda/bindings/nvjitlink.pxdcuda_bindings_12/cuda/bindings/nvjitlink.pyxcuda_bindings_12/cuda/bindings/nvml.pxdcuda_bindings_12/cuda/bindings/nvml.pyxcuda_bindings_12/cuda/bindings/nvrtc.pxdcuda_bindings_12/cuda/bindings/nvrtc.pyxcuda_bindings_12/cuda/bindings/nvvm.pxdcuda_bindings_12/cuda/bindings/nvvm.pyxcuda_bindings_12/cuda/bindings/runtime.pxd.incuda_bindings_12/cuda/bindings/runtime.pyx.incuda_bindings_12/cuda/bindings/utils/__init__.pycuda_bindings_12/cuda/bindings/utils/_ptx_utils.pycuda_bindings_12/cuda/ccuda.pxdcuda_bindings_12/cuda/ccuda.pyxcuda_bindings_12/cuda/ccudart.pxdcuda_bindings_12/cuda/ccudart.pyxcuda_bindings_12/cuda/cnvrtc.pxdcuda_bindings_12/cuda/cnvrtc.pyxcuda_bindings_12/cuda/cuda.pyxcuda_bindings_12/cuda/cudart.pyxcuda_bindings_12/cuda/nvrtc.pyxcuda_bindings_12/docs/Makefilecuda_bindings_12/docs/README.mdcuda_bindings_12/docs/build_docs.shcuda_bindings_12/docs/make.batcuda_bindings_12/docs/source/_static/javascripts/version_dropdown.jscuda_bindings_12/docs/source/_templates/main.htmlcuda_bindings_12/docs/source/_templates/sidebar/variant-selector.htmlcuda_bindings_12/docs/source/api.rstcuda_bindings_12/docs/source/conduct.mdcuda_bindings_12/docs/source/conf.pycuda_bindings_12/docs/source/contribute.mdcuda_bindings_12/docs/source/environment_variables.mdcuda_bindings_12/docs/source/index.rstcuda_bindings_12/docs/source/install.mdcuda_bindings_12/docs/source/license.rstcuda_bindings_12/docs/source/module/cufile.rstcuda_bindings_12/docs/source/module/driver.rstcuda_bindings_12/docs/source/module/nvfatbin.rstcuda_bindings_12/docs/source/module/nvjitlink.rstcuda_bindings_12/docs/source/module/nvrtc.rstcuda_bindings_12/docs/source/module/nvvm.rstcuda_bindings_12/docs/source/module/runtime.rstcuda_bindings_12/docs/source/module/utils.rstcuda_bindings_12/docs/source/motivation.mdcuda_bindings_12/docs/source/overview.mdcuda_bindings_12/docs/source/release.rstcuda_bindings_12/docs/source/release/11.4.0-notes.mdcuda_bindings_12/docs/source/release/11.5.0-notes.mdcuda_bindings_12/docs/source/release/11.6.0-notes.mdcuda_bindings_12/docs/source/release/11.6.1-notes.mdcuda_bindings_12/docs/source/release/11.7.0-notes.mdcuda_bindings_12/docs/source/release/11.7.1-notes.mdcuda_bindings_12/docs/source/release/11.8.0-notes.mdcuda_bindings_12/docs/source/release/11.8.1-notes.mdcuda_bindings_12/docs/source/release/11.8.2-notes.mdcuda_bindings_12/docs/source/release/11.8.3-notes.mdcuda_bindings_12/docs/source/release/11.8.4-notes.mdcuda_bindings_12/docs/source/release/11.8.5-notes.mdcuda_bindings_12/docs/source/release/11.8.6-notes.mdcuda_bindings_12/docs/source/release/11.8.7-notes.rstcuda_bindings_12/docs/source/release/12.0.0-notes.mdcuda_bindings_12/docs/source/release/12.1.0-notes.mdcuda_bindings_12/docs/source/release/12.2.0-notes.mdcuda_bindings_12/docs/source/release/12.2.1-notes.mdcuda_bindings_12/docs/source/release/12.3.0-notes.mdcuda_bindings_12/docs/source/release/12.4.0-notes.mdcuda_bindings_12/docs/source/release/12.5.0-notes.mdcuda_bindings_12/docs/source/release/12.6.0-notes.mdcuda_bindings_12/docs/source/release/12.6.1-notes.mdcuda_bindings_12/docs/source/release/12.6.2-notes.mdcuda_bindings_12/docs/source/release/12.8.0-notes.mdcuda_bindings_12/docs/source/release/12.9.0-notes.rstcuda_bindings_12/docs/source/release/12.9.10-notes.rstcuda_bindings_12/docs/source/release/12.9.8-notes.rstcuda_bindings_12/docs/source/release/12.9.9-notes.rstcuda_bindings_12/docs/source/release/12.X.Y-notes.rstcuda_bindings_12/docs/source/support.rstcuda_bindings_12/docs/source/tips_and_tricks.rstcuda_bindings_12/docs/versions.jsoncuda_bindings_12/examples/0_Introduction/clock_nvrtc_test.pycuda_bindings_12/examples/0_Introduction/simpleCubemapTexture_test.pycuda_bindings_12/examples/0_Introduction/simpleP2P_test.pycuda_bindings_12/examples/0_Introduction/simpleZeroCopy_test.pycuda_bindings_12/examples/0_Introduction/systemWideAtomics_test.pycuda_bindings_12/examples/0_Introduction/vectorAddDrv_test.pycuda_bindings_12/examples/0_Introduction/vectorAddMMAP_test.pycuda_bindings_12/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.pycuda_bindings_12/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.pycuda_bindings_12/examples/3_CUDA_Features/simpleCudaGraphs_test.pycuda_bindings_12/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.pycuda_bindings_12/examples/common/common.pycuda_bindings_12/examples/common/helper_cuda.pycuda_bindings_12/examples/common/helper_string.pycuda_bindings_12/examples/extra/isoFDModelling_test.pycuda_bindings_12/examples/extra/jit_program_test.pycuda_bindings_12/examples/extra/numba_emm_plugin.pycuda_bindings_12/examples/pytest.inicuda_bindings_12/pyproject.tomlcuda_bindings_12/setup.pycuda_bindings_12/site-packages/_cuda_bindings_redirector.pthcuda_bindings_12/site-packages/_cuda_bindings_redirector.pycuda_bindings_12/tests/cufile.jsoncuda_bindings_12/tests/cython/build_tests.batcuda_bindings_12/tests/cython/build_tests.shcuda_bindings_12/tests/cython/test_ccuda.pyxcuda_bindings_12/tests/cython/test_ccudart.pyxcuda_bindings_12/tests/cython/test_cython.pycuda_bindings_12/tests/cython/test_interoperability_cython.pyxcuda_bindings_12/tests/nvml/README.mdcuda_bindings_12/tests/nvml/__init__.pycuda_bindings_12/tests/nvml/conftest.pycuda_bindings_12/tests/nvml/test_compute_mode.pycuda_bindings_12/tests/nvml/test_cuda.pycuda_bindings_12/tests/nvml/test_device.pycuda_bindings_12/tests/nvml/test_gpu.pycuda_bindings_12/tests/nvml/test_init.pycuda_bindings_12/tests/nvml/test_nvlink.pycuda_bindings_12/tests/nvml/test_page_retirement.pycuda_bindings_12/tests/nvml/test_pynvml.pycuda_bindings_12/tests/nvml/util.pycuda_bindings_12/tests/pytest.inicuda_bindings_12/tests/test_cuda.pycuda_bindings_12/tests/test_cudart.pycuda_bindings_12/tests/test_cufile.pycuda_bindings_12/tests/test_graphics_apis.pycuda_bindings_12/tests/test_interoperability.pycuda_bindings_12/tests/test_kernelParams.pycuda_bindings_12/tests/test_nvfatbin.pycuda_bindings_12/tests/test_nvjitlink.pycuda_bindings_12/tests/test_nvrtc.pycuda_bindings_12/tests/test_nvvm.pycuda_bindings_12/tests/test_utils.pycuda_bindings_12/tests/utils/check_cyclical_import.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
| if [[ $LATEST_ONLY == "0" ]]; then | ||
| cp -r build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest | ||
| else | ||
| mv build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
important: Replace latest before publishing a new build.
If build/html/latest already exists, cp -r or mv places the versioned directory inside latest. The previous documentation remains at latest/, even though the build completes. Remove or replace the existing destination before either operation.
|
|
||
| ddElement.appendChild(aElement); | ||
| // Attach event listeners to version links | ||
| ddElement.addEventListener('click', change_current_version); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
important: Handle clicks on the version link, not its container.
The listener runs when a user clicks the <dd> or its <strong> wrapper. In those cases, event.target.href is undefined, and change_current_version navigates away from the selected documentation. Attach the listener to aElement before wrapping it, and read event.currentTarget in the handler. (developer.mozilla.org)
| author = "NVIDIA" | ||
|
|
||
| # The full version, including alpha/beta/rc tags | ||
| release = os.environ["SPHINX_CUDA_BINDINGS_VER"] |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
important: Allow the direct Sphinx entrypoints to determine the version.
make html and make.bat html do not set SPHINX_CUDA_BINDINGS_VER. Sphinx loads this configuration for either command, so the direct build stops with KeyError unless the caller sets the variable manually. Derive a default release here, or set the variable in both entrypoints. The documented build_docs.sh path already sets it. (sphinx-doc.org)
| `cuda.bindings` supports the same platforms as CUDA. Runtime dependencies are: | ||
|
|
||
| * Linux (x86-64, arm64) and Windows (x86-64) | ||
| * Python 3.9 - 3.13 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
important: Update the Python support range for this release.
This page says support ends at Python 3.13, but docs/source/release/12.9.10-notes.rst says the imported release ships Python 3.15 wheels. Update this range and the matching statement in docs/source/support.rst so users do not rule out a supported installation.
| :maxdepth: 3 | ||
|
|
||
| 12.X.Y <release/12.X.Y-notes.rst> | ||
| 12.9.0 <release/12.9.0-notes.rst> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
important: Include the imported maintenance releases in documentation navigation.
The release-note files for 12.9.8, 12.9.9, and 12.9.10 exist, but this toctree stops at 12.9.0. Readers cannot reach those notes through the release page. Add the entries here and update docs/versions.json when publishing their versioned documentation.
| def checkCmdLineFlag(stringRef): | ||
| return any(stringRef == i and k < len(sys.argv) - 1 for i, k in enumerate(sys.argv)) | ||
|
|
||
|
|
||
| def getCmdLineArgumentInt(stringRef): | ||
| for i, k in enumerate(sys.argv): | ||
| if stringRef == i and k < len(sys.argv) - 1: | ||
| return sys.argv[k + 1] | ||
| return 0 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
suggestion: enumerate(sys.argv) yields (index, value). Both helpers bind the index to i and the argument string to k. As a result, stringRef == i compares a string to an int, and k < len(sys.argv) - 1 compares a string to an int. checkCmdLineFlag therefore always returns False. The device=, wA=, kernel=, and help options in the examples are silently ignored. This file is a byte-identical import, so apply the fix in the integration layer or upstream, for example for k, i in enumerate(sys.argv).
| @pytest.fixture | ||
| def mig_handles(nmigs): | ||
| handles = [nvml.device_get_mig_device_handle_by_index(i) for i in range(nmigs)] | ||
| assert len(handles) == nmigs | ||
| return handles |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -nP -C3 'def device_get_mig_device_handle_by_index\s*\(' cuda_bindings_12/cuda/bindingsRepository: NVIDIA/cuda-python
Length of output: 156
🏁 Script executed:
set -eu
printf '%s\n' '--- changed fixture and nearby tests ---'
nl -ba cuda_bindings_12/tests/nvml/conftest.py | sed -n '1,145p'
rg -n -F -- 'device_get_mig_device_handle_by_index' cuda_bindings_12 cuda_bindings tests || test "$?" -eq 1
printf '%s\n' '--- candidate NVML declarations ---'
rg -n -F -- 'MigDeviceHandleByIndex' cuda_bindings_12 cuda_bindings tests || test "$?" -eq 1
printf '%s\n' '--- test_device_get_attributes references ---'
rg -n -C4 -F -- 'test_device_get_attributes' cuda_bindings_12/tests cuda_bindings/tests || test "$?" -eq 1Repository: NVIDIA/cuda-python
Length of output: 5205
🏁 Script executed:
set -eu
printf '%s\n' '--- resolved binding implementation ---'
nl -ba cuda_bindings_12/cuda/bindings/nvml.pyx | sed -n '35735,35765p'
printf '%s\n' '--- mig_handles consumers ---'
rg -n -C5 -F -- 'mig_handles' cuda_bindings_12/tests
printf '%s\n' '--- test_device_get_attributes ---'
rg -n -C8 -F -- 'test_device_get_attributes' cuda_bindings_12/tests || test "$?" -eq 1
printf '%s\n' '--- NVML test files ---'
find cuda_bindings_12/tests/nvml -maxdepth 2 -type f -print | sortRepository: NVIDIA/cuda-python
Length of output: 5362
🏁 Script executed:
set -eu
printf '%s\n' '--- PR file changes ---'
git diff --name-status efd58e498da894a5f823927268bd307abc7b3120 36807f72b60c03335cd8d14507044e4d8b3c6c64
printf '%s\n' '--- references outside imported tree ---'
rg -n -F --glob '!cuda_bindings_12/**' -- 'cuda_bindings_12' . || test "$?" -eq 1
printf '%s\n' '--- build and hook configuration files ---'
find . -maxdepth 2 -type f \( -name 'pyproject.toml' -o -name 'setup.py' -o -name 'setup.cfg' -o -name 'pre-commit-config.yaml' \) -print
printf '%s\n' '--- configuration references ---'
rg -n -C3 -F -- 'cuda_bindings' pyproject.toml setup.py setup.cfg pre-commit-config.yaml 2>/dev/null || test "$?" -eq 1Repository: NVIDIA/cuda-python
Length of output: 11405
important: When this tree is integrated, pass the parent device handle to nvml.device_get_mig_device_handle_by_index. Make mig_handles depend on handles, use handles[0], and handle nvml.NvmlError for unpopulated MIG slots. The current call omits the required device argument and raises TypeError whenever nmigs > 0, before test_device_get_attributes can run.
| def supportsCudaAPI(name): | ||
| return name in dir(cuda) or dir(cudart) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
suggestion: name in dir(cuda) or dir(cudart) parses as (name in dir(cuda)) or dir(cudart). The non-empty list makes the expression always truthy. As a result, the cudaGraphConditionalHandleCreate guard on test_cudart_conditional has no effect. This copy must stay byte-identical, so apply the fix in the integration layer or upstream: return name in dir(cuda) or name in dir(cudart).
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
|
I'm deliberately ignoring all CodeRabbit findings: all findings are for files under the |
Summary
Import the CUDA 12 maintenance sources into
cuda_bindings_12/onmain, as the first step in rebuilding #2737 as a reviewable stack. The CUDA 13 source-root rename has landed in #3147.The imported directory is byte-for-byte identical to
cuda_bindings/at12.9.xcommit ca0f150. It includes the 12.9.10 release notes and host-function graph replay fix. This PR does not register, build, test, or release the copied package. Later layers add that integration.A temporary three-line pre-commit exclusion keeps this inactive historical source untouched by repository hooks. A temporary exclusion in the independent Bandit/Ruff security scan also skips
cuda_bindings_12/, whose tests retain historical security annotations. The integration layer (#3173) removes both exclusions, adapts those annotations, and adds the relevant per-root checks.Stack / Review Boundary
Layer 1 of 7. Next: #3173. All layers and integrated validation.
The seven PRs are review boundaries for one change. Only the top PR, #3178, is fully integrated and is the full-CI target.
Validation
pre-commit run --all-files --show-diff-on-failurepassed.Native CUDA 12 validation belongs to the layers that enable this source tree.
Checklist