Skip to content

Commit 6df0567

Browse files
authored
Merge branch 'main' into py3.10_leftovers
2 parents 4320c21 + 303fbda commit 6df0567

117 files changed

Lines changed: 27881 additions & 44026 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/ISSUE_TEMPLATE/release_checklist.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ body:
2323
- label: Sweep deprecations whose stated removal version has arrived (`grep -rn 'deprecated::' cuda_core/cuda`) and remove any that are due
2424
- label: "Finalize the doc update, including release notes (\"Note: Touching docstrings/type annotations in code is OK during code freeze, apply your best judgement!\")"
2525
- label: Update the docs for the new version
26-
- label: Create a public release tag
26+
- label: "For cuda-core: create the release branch (`release/cuda-core-vX.Y.x`) from `main` for a minor release, or use the existing one for a patch release"
27+
- label: "Create a public release tag (for cuda-core, on the release branch)"
2728
- label: Wait for the tag-triggered CI run to complete, and use that run ID for release workflows (this will upload the release to PyPI)
2829
- label: Publish the release at https://github.com/NVIDIA/cuda-python/releases (this will trigger the conda package update)
2930
- label: Approve the conda-package update PR

‎.github/RELEASE-core.md‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,23 @@ platforms as appropriate for each release.
8585
## Check (or update if needed) the dependency requirements
8686

8787
Review `cuda_core/pyproject.toml` and verify that all dependency
88-
requirements are current. The `cu12`/`cu13` extras declare the
89-
`cuda-bindings` floors; see "Bumping the cuda-bindings floor" in
90-
`cuda_core/AGENTS.md`.
88+
requirements are current.
89+
90+
The `cu12`/`cu13` extras declare the `cuda-bindings` floors. A release
91+
does not raise a floor to the newest `cuda-bindings`; see "Bumping the
92+
cuda-bindings floor" in `cuda_core/AGENTS.md`. Check the floors instead:
93+
94+
- The minor of each floor equals the minor of the toolkit pin of its
95+
major in `ci/versions.yml` (`build` for the current major, `prev_build`
96+
for the prior major). If a floor's minor is lower, the toolkit-bump
97+
window is open: move the floor before the release.
98+
- In the latest CI run on `main`, the CUDA 13 rows whose CUDA minor
99+
differs from the `build` pin (for example "CUDA 13.0.2") installed the
100+
literal floor. Their logs show `Installing bindings (source: floor)` and
101+
`cuda-bindings==<floor>`, and no "predates ... headers" line. Standard
102+
CI does not install the CUDA 12 floor: its rows use the 12.9.x backport
103+
build.
104+
- The release notes list every floor move since the last release.
91105

92106
Update the `cuda-core` pin in `cuda_python/setup.py` to the new minor
93107
series (`cuda-core~=X.Y.0`), and plan a `cuda-python` release right after
@@ -142,17 +156,45 @@ built and deployed automatically by the release workflow.
142156

143157
---
144158

159+
## Create the release branch
160+
161+
Each `cuda-core` minor series has one release branch,
162+
`release/cuda-core-vX.Y.x`. Releases are tagged on that branch, not on
163+
`main`. Patch releases of the series land there too.
164+
165+
For a minor release (`X.Y.0`), create the branch after every pre-release
166+
pull request has merged into `main`. Branch from the `main` commit that
167+
holds the final release notes:
168+
169+
```bash
170+
git fetch origin main
171+
git push origin origin/main:refs/heads/release/cuda-core-v0.6.x
172+
```
173+
174+
For a patch release (`X.Y.Z`), use the existing branch. Changes reach it
175+
through pull requests that cherry-pick the fixes from `main`, with
176+
`(cherry picked from commit ...)` trailers. The release notes for the patch
177+
release must be on the release branch before the tag: the release workflow
178+
checks for them in the tagged tree. Add them to `main` as well, so the docs
179+
switcher and the `latest` docs list them.
180+
181+
The repository ruleset protects `release/**`: a push to an existing release
182+
branch needs a pull request and passing checks.
183+
184+
---
185+
145186
## Create a public release tag
146187

147188
**Warning:** Pushing a tag is a potentially irrevocable action. Be absolutely
148189
certain the tag points to the correct commit before pushing.
149190

150191
Tags should be GPG-signed. The tag name format is `cuda-core-v<VERSION>`
151-
(e.g. `cuda-core-v0.6.0`). The tag must point to a commit on `main`.
192+
(e.g. `cuda-core-v0.6.0`). The tag must point to a commit on the release
193+
branch.
152194

153195
```bash
154-
git checkout main
155-
git pull origin main
196+
git fetch origin release/cuda-core-v0.6.x
197+
git checkout --detach origin/release/cuda-core-v0.6.x
156198
git tag -s cuda-core-v0.6.0 -m "cuda-core v0.6.0"
157199
git push origin cuda-core-v0.6.0
158200
```

‎.github/actions/fetch_ctk/action.yml‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ runs:
118118
# prefixes its output line with "\", which would end up in the cache key.
119119
MANIFEST_SHA256="$(sha256sum < "$CTK_JSON_FILE" | awk '{print $1}')"
120120
HASH=$(echo -n "${CTK_CACHE_COMPONENTS}" | sha256sum | awk '{print $1}')
121+
# Bump the layout tag (l2) whenever the unpacked tree changes shape, so
122+
# caches saved with an older layout are not restored.
121123
{
122-
echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256"
123-
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256.tar.gz"
124+
echo "CTK_CACHE_KEY=mini-ctk-l2-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256"
125+
echo "CTK_CACHE_FILENAME=mini-ctk-l2-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256.tar.gz"
124126
echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}"
125127
echo "CTK_BASE_URL=${CTK_BASE_URL}"
126128
echo "CTK_JSON_FILE=${CTK_JSON_FILE}"
@@ -151,16 +153,16 @@ runs:
151153
# "Set up CTK cache variable".
152154
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
153155
function extract() {
154-
tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1
156+
tar -xvf $1 -C $2 --strip-components=1
155157
}
156158
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
157159
function extract() {
158160
_TEMP_DIR_=$(mktemp -d)
159161
unzip $1 -d $_TEMP_DIR_
160-
cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR
162+
cp -r $_TEMP_DIR_/*/* $2
161163
rm -rf $_TEMP_DIR_
162164
# see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5
163-
chmod 644 $CACHE_TMP_DIR/LICENSE
165+
chmod 644 $2/LICENSE
164166
}
165167
fi
166168
function populate_cuda_path() {
@@ -183,17 +185,34 @@ runs:
183185
--component "$CTK_COMPONENT" \
184186
--metadata-path "$CTK_JSON_FILE")"
185187
echo "${CTK_COMPONENT_SHA256} ${CTK_COMPONENT_COMPONENT_FILENAME}" | sha256sum --check --strict -
186-
extract $CTK_COMPONENT_COMPONENT_FILENAME
188+
# cuda.pathfinder looks for CUPTI only under extras/CUPTI, the CTK installer
189+
# layout; the redistrib archive itself has a flat include/ + lib/ layout.
190+
CTK_COMPONENT_DEST="$CACHE_TMP_DIR"
191+
if [[ "$CTK_COMPONENT" == cuda_cupti ]]; then
192+
CTK_COMPONENT_DEST="$CACHE_TMP_DIR/extras/CUPTI"
193+
fi
194+
mkdir -p "$CTK_COMPONENT_DEST"
195+
extract $CTK_COMPONENT_COMPONENT_FILENAME "$CTK_COMPONENT_DEST"
187196
rm $CTK_COMPONENT_COMPONENT_FILENAME
188197
}
189198
190199
# Get headers and shared libraries in place
191200
for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do
192201
populate_cuda_path "$item"
193202
done
194-
# TODO: check Windows
195-
if [[ "${{ inputs.host-platform }}" == linux* && -d "${CACHE_TMP_DIR}/lib" ]]; then
196-
mv $CACHE_TMP_DIR/lib $CACHE_TMP_DIR/lib64
203+
CUPTI_DIR="$CACHE_TMP_DIR/extras/CUPTI"
204+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
205+
for lib_parent in "$CACHE_TMP_DIR" "$CUPTI_DIR"; do
206+
if [[ -d "$lib_parent/lib" ]]; then
207+
mv "$lib_parent/lib" "$lib_parent/lib64"
208+
fi
209+
done
210+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
211+
# CUPTI archives before 13.4 put the DLLs directly in lib/, where the
212+
# CTK installer uses extras/CUPTI/lib64; later ones use lib/<arch>.
213+
if [[ -d "$CUPTI_DIR/lib" && ! -d "$CUPTI_DIR/lib/x64" && ! -d "$CUPTI_DIR/lib/arm64" ]]; then
214+
mv "$CUPTI_DIR/lib" "$CUPTI_DIR/lib64"
215+
fi
197216
fi
198217
ls -l $CACHE_TMP_DIR
199218

‎.github/workflows/test-wheel-linux.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ jobs:
411411
CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: see_what_works
412412
run: run-tests pathfinder
413413

414+
# The checker and the mini-CTK layout it expects both come from the
415+
# inputs.sha checkout. Nightly runs may check out a commit without them.
416+
- name: Check cuda.pathfinder loads NVRTC and CUPTI from the mini CTK
417+
if: ${{ inputs.test-mode == 'standard' && env.TEST_PATHFINDER == 'true' && matrix.LOCAL_CTK == '1' && hashFiles('ci/tools/check_pathfinder_ctk_libs.py') != '' }}
418+
run: python ci/tools/check_pathfinder_ctk_libs.py nvrtc cupti
419+
414420
- name: Run cuda.bindings tests
415421
if: ${{ inputs.test-mode == 'standard' && env.TEST_BINDINGS == 'true' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
416422
env:

‎.github/workflows/test-wheel-windows.yml‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ jobs:
367367
shell: bash --noprofile --norc -xeuo pipefail {0}
368368
run: run-tests pathfinder
369369

370+
# The checker and the mini-CTK layout it expects both come from the
371+
# inputs.sha checkout. Nightly runs may check out a commit without them.
372+
- name: Check cuda.pathfinder loads NVRTC and CUPTI from the mini CTK
373+
if: ${{ inputs.test-mode == 'standard' && env.TEST_PATHFINDER == 'true' && matrix.LOCAL_CTK == '1' && hashFiles('ci/tools/check_pathfinder_ctk_libs.py') != '' }}
374+
shell: bash --noprofile --norc -xeuo pipefail {0}
375+
run: python ci/tools/check_pathfinder_ctk_libs.py nvrtc cupti
376+
370377
- name: Run cuda.bindings tests
371378
if: ${{ inputs.test-mode == 'standard' && env.TEST_BINDINGS == 'true' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
372379
env:
@@ -426,9 +433,21 @@ jobs:
426433
- name: Install Visual C++ Redistributable (required by PyTorch on Windows)
427434
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
428435
run: |
429-
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "vc_redist.x64.exe"
430-
Start-Process -FilePath ".\vc_redist.x64.exe" -ArgumentList "/install", "/quiet", "/norestart" -Wait
431-
Remove-Item "vc_redist.x64.exe"
436+
$redist = Join-Path $env:RUNNER_TEMP "vc_redist.x64.exe"
437+
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile $redist
438+
$signature = Get-AuthenticodeSignature $redist
439+
if ($signature.Status -ne "Valid") { throw "VC++ runtime signature is not valid: $($signature.Status)" }
440+
# Compare the parsed organization (OID 2.5.4.10); a substring match on Subject also accepts
441+
# e.g. "O=Microsoft Corporation Services Ltd" or a CN containing "O=Microsoft Corporation".
442+
$org = @($signature.SignerCertificate.SubjectName.EnumerateRelativeDistinguishedNames() |
443+
Where-Object { $_.GetSingleElementType().Value -eq "2.5.4.10" } |
444+
ForEach-Object { $_.GetSingleElementValue() })
445+
if ($org.Count -ne 1 -or $org[0] -cne "Microsoft Corporation") {
446+
throw "VC++ runtime is not signed by Microsoft Corporation: O=$($org -join '|')"
447+
}
448+
$process = Start-Process $redist -ArgumentList "/install", "/quiet", "/norestart" -Wait -PassThru
449+
if ($process.ExitCode -notin 0, 1638, 3010) { throw "VC++ runtime installer failed: $($process.ExitCode)" }
450+
Remove-Item $redist
432451
433452
- name: Install cuda-python wheels + PyTorch
434453
if: ${{ inputs.test-mode == 'nightly-pytorch' }}

‎.gitignore‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,15 @@ cuda_bindings_13/cuda/bindings/_internal/runtime_ptds.pyx
4141
cuda_bindings_13/cuda/bindings/utils/_get_handle.pyx
4242

4343
# CUDA 12 bindings source generation
44-
cuda_bindings_12/cuda/bindings/_bindings/cyruntime.pxd
45-
cuda_bindings_12/cuda/bindings/_bindings/cyruntime.pyx
46-
cuda_bindings_12/cuda/bindings/_bindings/cyruntime_ptds.pxd
47-
cuda_bindings_12/cuda/bindings/_bindings/cyruntime_ptds.pyx
4844
cuda_bindings_12/cuda/bindings/_internal/cufile.pyx
4945
cuda_bindings_12/cuda/bindings/_internal/driver.pyx
5046
cuda_bindings_12/cuda/bindings/_internal/nvfatbin.pyx
5147
cuda_bindings_12/cuda/bindings/_internal/nvjitlink.pyx
5248
cuda_bindings_12/cuda/bindings/_internal/nvml.pyx
5349
cuda_bindings_12/cuda/bindings/_internal/nvrtc.pyx
5450
cuda_bindings_12/cuda/bindings/_internal/nvvm.pyx
55-
cuda_bindings_12/cuda/bindings/cyruntime.pxd
56-
cuda_bindings_12/cuda/bindings/cyruntime.pyx
57-
cuda_bindings_12/cuda/bindings/cyruntime_functions.pxi
58-
cuda_bindings_12/cuda/bindings/cyruntime_types.pxi
59-
cuda_bindings_12/cuda/bindings/runtime.pxd
60-
cuda_bindings_12/cuda/bindings/runtime.pyx
51+
cuda_bindings_12/cuda/bindings/_internal/runtime.pyx
52+
cuda_bindings_12/cuda/bindings/_internal/runtime_ptds.pyx
6153

6254
# Version files from setuptools_scm
6355
_version.py
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Check that cuda.pathfinder loads the given libraries from the CTK under CUDA_PATH.
5+
6+
The default cuda.pathfinder tests tolerate libraries that cannot be found, so a
7+
layout mismatch between the mini CTK and pathfinder's search directories would
8+
otherwise go unnoticed. The library may be found through any search step, as
9+
long as it comes from under CUDA_PATH.
10+
11+
Usage: python check_pathfinder_ctk_libs.py LIBNAME [LIBNAME ...]
12+
"""
13+
14+
from __future__ import annotations
15+
16+
import os
17+
import sys
18+
19+
from cuda.pathfinder import load_nvidia_dynamic_lib
20+
21+
22+
def _canonical(path: str) -> str:
23+
return os.path.normcase(os.path.realpath(path))
24+
25+
26+
def main(libnames: list[str]) -> int:
27+
root = _canonical(os.environ["CUDA_PATH"])
28+
failed = False
29+
for libname in libnames:
30+
loaded = load_nvidia_dynamic_lib(libname)
31+
if loaded.abs_path is None:
32+
print(f"FATAL: cuda.pathfinder did not report a path for {libname}", file=sys.stderr)
33+
failed = True
34+
continue
35+
path = _canonical(loaded.abs_path)
36+
print(f"{libname}: {path} (found via {loaded.found_via})")
37+
if not path.startswith(root + os.sep):
38+
print(f"FATAL: {libname} was not loaded from CUDA_PATH ({root})", file=sys.stderr)
39+
failed = True
40+
return 1 if failed else 0
41+
42+
43+
if __name__ == "__main__":
44+
sys.exit(main(sys.argv[1:]))

‎cuda_bindings_12/AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ intentional API, layout, and build differences.
1515
- Handwritten utilities, build helpers, tests, and documentation can be edited
1616
directly. Inspect headers and provenance; a filename extension alone does
1717
not identify generated code.
18-
- Source builds parse CUDA headers and expand `.in` templates before Cython.
19-
Regenerate these outputs from their templates and headers. Preserve the
20-
CUDA 12 parser, legacy APIs, and namespace redirector.
18+
- Source builds do not parse CUDA headers or expand templates; all binding
19+
sources, including `runtime`, are pre-generated. Preserve the CUDA 12
20+
legacy APIs and namespace redirector.
2121

2222
## Build and test guidance
2323

0 commit comments

Comments
 (0)