Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ reviews:
custom_checks: []

path_instructions:
- path: "cuda_bindings/**/*"
- path: "cuda_bindings_13/**/*"
instructions: |
Focus on Cython binding correctness, API and ABI stability, error-code propagation,
resource ownership and reference counting, GIL handling, cross-platform behavior.
Expand Down Expand Up @@ -122,23 +122,23 @@ knowledge_base:
filePatterns:
- "AGENTS.md"
- "CONTRIBUTING.md"
- "cuda_bindings/AGENTS.md"
- "cuda_bindings_13/AGENTS.md"
- "cuda_core/AGENTS.md"
- "cuda_core/tests/AGENTS.md"
- "cuda_pathfinder/AGENTS.md"
- "cuda_python/AGENTS.md"
- "benchmarks/cuda_bindings/AGENTS.md"
- "benchmarks/cuda_core/AGENTS.md"
- "cuda_bindings/README.md"
- "cuda_bindings_13/README.md"
- "cuda_core/README.md"
- "cuda_pathfinder/DESCRIPTION.rst"
- "cuda_python/DESCRIPTION.rst"
- "cuda_bindings/docs/source/contribute.rst"
- "cuda_bindings_13/docs/source/contribute.rst"
- "cuda_core/docs/source/contribute.rst"
- "cuda_core/docs/source/concurrency.rst"
- "cuda_core/docs/source/error_handling.rst"
- "cuda_pathfinder/docs/source/contribute.rst"
- "cuda_bindings/docs/source/release.rst"
- "cuda_bindings_13/docs/source/release.rst"
- "cuda_core/docs/source/release.rst"
- "cuda_pathfinder/docs/source/release.rst"
- "cuda_python/docs/source/release.rst"
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cuda.bindings:
- changed-files:
- any-glob-to-any-file:
- 'cuda_bindings/**'
- 'cuda_bindings_13/**'
- 'samples/cuda_bindings/**'

cuda.core:
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ jobs:
PYTHON_VERSION_FORMATTED="312" # see above
REPO_DIR=$(pwd)

# Release docs may check out tags from before the source-root rename.
if [[ -d cuda_bindings_13 ]]; then
CUDA_BINDINGS_SOURCE_DIR=cuda_bindings_13
elif [[ -d cuda_bindings ]]; then
CUDA_BINDINGS_SOURCE_DIR=cuda_bindings
else
echo "error: cannot find the cuda.bindings source directory" >&2
exit 1
fi
echo "CUDA_BINDINGS_SOURCE_DIR=${CUDA_BINDINGS_SOURCE_DIR}" >> "$GITHUB_ENV"

if [[ ${{ inputs.is-release }} == "true" ]]; then
FILE_HASH="*"
DOCS_GITHUB_REF="${{ inputs.git-tag }}"
Expand All @@ -130,7 +141,7 @@ jobs:
CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${BUILD_CTK_VER}-linux-64"
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${FILE_HASH}" >> $GITHUB_ENV
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/$CUDA_BINDINGS_SOURCE_DIR/dist")" >> $GITHUB_ENV

- name: Download cuda-python build artifacts
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
Expand Down Expand Up @@ -262,6 +273,9 @@ jobs:
if: ${{ inputs.component != 'all' }}
run: |
COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_')
if [[ "${{ inputs.component }}" == "cuda-bindings" ]]; then
COMPONENT="${CUDA_BINDINGS_SOURCE_DIR}"
fi
pushd ${COMPONENT}/docs/
if [[ "${{ inputs.is-release }}" == "false" ]]; then
./build_docs.sh latest-only
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
if: ${{ env.BUILD_BINDINGS == 'true' }}
uses: pypa/cibuildwheel@b3395e271a35f73dad77f21802abe9b986dfe299 # v4.3.1
with:
package-dir: ./cuda_bindings/
package-dir: ./cuda_bindings_13/
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
extras: uv
env:
Expand Down Expand Up @@ -474,7 +474,7 @@ jobs:
- name: Build cuda.bindings Cython tests
if: ${{ env.TEST_BINDINGS == 'true' }}
run: |
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings/pyproject.toml:test
pip install ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl --group ./cuda_bindings_13/pyproject.toml:test
pushd ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd
Expand Down Expand Up @@ -563,7 +563,7 @@ jobs:
--branch "${OLD_BRANCH}" \
--artifact "${OLD_ARTIFACT_PATTERN}" \
NVIDIA/cuda-python "CI")
PREV_BINDINGS_DIR="cuda_bindings/dist-prev"
PREV_BINDINGS_DIR="cuda_bindings_13/dist-prev"

gh run download \
"${LATEST_PRIOR_RUN_ID}" \
Expand All @@ -580,7 +580,7 @@ jobs:
if: ${{ !inputs.single-cuda-major && env.BUILD_CORE == 'true' }}
run: |
pathfinder_wheels=(cuda_pathfinder/cuda_pathfinder-*.whl)
bindings_wheels=(cuda_bindings/dist-prev/cuda_bindings-"${BUILD_PREV_CUDA_MAJOR}".*.whl)
bindings_wheels=(cuda_bindings_13/dist-prev/cuda_bindings-"${BUILD_PREV_CUDA_MAJOR}".*.whl)
test "${#pathfinder_wheels[@]}" -eq 1
test "${#bindings_wheels[@]}" -eq 1
test -f "${pathfinder_wheels[0]}"
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci-pixi-source-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ on:
# Path-dependency metadata (including cuda_python_test_helpers) feeds the
# solve, so it can break the source build without a pixi.toml edit.
- "**/pyproject.toml"
- "cuda_bindings/build_hooks.py"
- "cuda_bindings_13/build_hooks.py"
- "cuda_core/build_hooks.py"
- "cuda_bindings/cuda/bindings/**" # generated bindings sources
- "cuda_bindings/tests/cython/**"
- "cuda_bindings_13/cuda/bindings/**" # generated bindings sources
- "cuda_bindings_13/tests/cython/**"
- "cuda_core/tests/cython/**"
- "ci/versions.yml"
- "ci/pixi-version.env"
Expand Down Expand Up @@ -103,16 +103,16 @@ jobs:

# bindings + core: force the source build (catches nvrtc/driver
# compile errors like #2182) and import them (catches ABI mismatches).
pixi run --manifest-path cuda_bindings -e "${CUDA_ENV}" \
pixi run --manifest-path cuda_bindings_13 -e "${CUDA_ENV}" \
python -c "import cuda.bindings.driver, cuda.bindings.nvrtc, cuda.bindings.runtime; print('bindings import OK')"
pixi run --manifest-path cuda_core -e "${CUDA_ENV}" \
python -c "import cuda.core; print('core import OK')"

# cython test extensions: build them and confirm each .so landed next
# to its .pyx in tests/cython (catches the placement regression #2180).
pixi run --manifest-path cuda_bindings -e "${CUDA_ENV}" build-cython-tests
pixi run --manifest-path cuda_bindings_13 -e "${CUDA_ENV}" build-cython-tests
pixi run --manifest-path cuda_core -e "${CUDA_ENV}" build-cython-tests
for d in cuda_bindings/tests/cython cuda_core/tests/cython; do
for d in cuda_bindings_13/tests/cython cuda_core/tests/cython; do
if ! compgen -G "${d}/*.cpython-*.so" > /dev/null; then
echo "::error::no compiled cython test .so in ${d} (placement regression)"
exit 1
Expand All @@ -131,7 +131,7 @@ jobs:
# The round trip (not just cu13 -> cu12) is what catches the second half:
# coming back to cu13 must not silently reuse the cu12 extension.
#
# cuda_core only: cuda_bindings cannot be source-built in its cu12
# cuda_core only: cuda_bindings_13 cannot be source-built in its cu12
# environment at all, for reasons unrelated to stale artifacts.
build-identity-roundtrip:
name: "cu13 -> cu12 -> cu13 round trip (linux-64, CPU)"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ jobs:
#
# Dependency graph (verified in pyproject.toml files):
# cuda_pathfinder -> (no internal deps)
# cuda_bindings -> cuda_pathfinder
# cuda_core -> cuda_pathfinder, cuda_bindings
# cuda_python -> cuda_pathfinder, cuda_bindings, cuda_core (meta package)
# cuda_bindings_13 -> cuda_pathfinder
# cuda_core -> cuda_pathfinder, cuda_bindings_13
# cuda_python -> cuda_pathfinder, cuda_bindings_13, cuda_core (meta package)
#
# A change to cuda_pathfinder (or shared infra) forces a rebuild of every
# downstream module. A change to cuda_bindings forces rebuild of cuda_core.
# A change to cuda_core alone skips rebuilding/retesting cuda_bindings and
# downstream module. A change to cuda_bindings_13 forces rebuild of cuda_core.
# A change to cuda_core alone skips rebuilding/retesting cuda_bindings_13 and
# cuda_pathfinder, but still retests the downstream cuda-python metapackage.
# Shared build/orchestration changes run the full pipeline; test-only CI
# infrastructure runs every test suite without rebuilding package wheels.
Expand Down Expand Up @@ -477,7 +477,7 @@ jobs:
python-versions: ${{ needs.ci-vars.outputs.PYTHON_SUPPORTED }}

# NOTE: test-sdist jobs are split by platform (mirroring build-* and test-wheel-*)
# so platform-specific sources (e.g. cuda_bindings/*_windows.pyx selected by
# so platform-specific sources (e.g. cuda_bindings_13/*_windows.pyx selected by
# build_hooks.py) are exercised on their target OS. Keep these job definitions
# textually identical except for:
# - host-platform value
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ jobs:
run: |
export PIP_BUILD_CONSTRAINT="$(pwd)/wheel-constraints/cuda-bindings.txt"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
.venv/bin/pip wheel -v --no-deps ./cuda_bindings -w ./wheels/
.venv/bin/pip install -v ./wheels/cuda_bindings*.whl --group ./cuda_bindings/pyproject.toml:test
.venv/bin/pip wheel -v --no-deps ./cuda_bindings_13 -w ./wheels/
.venv/bin/pip install -v ./wheels/cuda_bindings*.whl --group ./cuda_bindings_13/pyproject.toml:test

- name: Constrain cuda-core to the local cuda-bindings wheel
run: |
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
continue-on-error: true
run: |
cd $INSTALL_ROOT
$REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_bindings/tests
$REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_bindings_13/tests

- name: Run cuda.core tests
continue-on-error: true
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:
run: |
export PIP_BUILD_CONSTRAINT="$(cygpath -w "$(pwd)/wheel-constraints/cuda-bindings.txt")"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
cd cuda_bindings
cd cuda_bindings_13
../.venv/Scripts/pip wheel -v --no-deps . -w ../wheels/

- name: Constrain cuda.core to the local cuda.bindings wheel
Expand Down Expand Up @@ -423,7 +423,7 @@ jobs:
run: |
.venv/Scripts/pip install coverage pytest-cov Cython
.venv/Scripts/pip install --group ./cuda_pathfinder/pyproject.toml:test
.venv/Scripts/pip install --group ./cuda_bindings/pyproject.toml:test
.venv/Scripts/pip install --group ./cuda_bindings_13/pyproject.toml:test
.venv/Scripts/pip install --group ./cuda_core/pyproject.toml:test

- name: Get install root
Expand All @@ -448,7 +448,7 @@ jobs:
--cwd "${{ steps.install-root.outputs.INSTALL_ROOT }}" \
-v --cov=./cuda --cov-append --cov-context=test \
--cov-config="$GITHUB_WORKSPACE/.coveragerc" \
"$GITHUB_WORKSPACE/cuda_bindings/tests"
"$GITHUB_WORKSPACE/cuda_bindings_13/tests"

- name: Run cuda.core tests (with 8MB stack)
continue-on-error: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-sdist-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ inputs.cuda-version }}

# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
# cuda_bindings_13/setup.py parses CUDA headers at import time, so CUDA_PATH
# (set by fetch_ctk) must be available for both sdist and wheel builds.
- name: Build cuda.bindings sdist and wheel-from-sdist
if: ${{ env.BUILD_BINDINGS == 'true' }}
Expand All @@ -119,22 +119,22 @@ jobs:
export CXX="sccache c++"
export PIP_BUILD_CONSTRAINT="$(pwd)/wheel-constraints/cuda-bindings.txt"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
python -m build --sdist cuda_bindings/
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
python -m build --sdist cuda_bindings_13/
pip wheel --no-deps --wheel-dir cuda_bindings_13/dist cuda_bindings_13/dist/*.tar.gz

- name: Download cuda.bindings wheel
if: ${{ env.BUILD_BINDINGS != 'true' && env.BUILD_CORE == 'true' }}
uses: ./.github/actions/download-artifact-retry
with:
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
path: cuda_bindings/dist
path: cuda_bindings_13/dist

- name: Constrain cuda.core to the local cuda.bindings wheel
if: ${{ env.BUILD_CORE == 'true' }}
run: |
CUDA_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
bindings_wheels=(cuda_bindings/dist/cuda_bindings-"${CUDA_MAJOR}".*.whl)
bindings_wheels=(cuda_bindings_13/dist/cuda_bindings-"${CUDA_MAJOR}".*.whl)
test "${#pathfinder_wheels[@]}" -eq 1
test "${#bindings_wheels[@]}" -eq 1
test -f "${pathfinder_wheels[0]}"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-sdist-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

# Windows counterpart of test-sdist-linux.yml. Exists so that platform-gated
# sources (e.g. cuda_bindings/*_windows.pyx selected by build_hooks.py) are
# sources (e.g. cuda_bindings_13/*_windows.pyx selected by build_hooks.py) are
# exercised by the sdist completeness test. Keep the shape of this file in
# sync with test-sdist-linux.yml aside from Windows-specific setup (MSVC,
# no sccache, no proxy cache).
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ inputs.cuda-version }}

# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
# cuda_bindings_13/setup.py parses CUDA headers at import time, so CUDA_PATH
# (set by fetch_ctk) must be available for both sdist and wheel builds.
# Constraint paths are passed as native Windows paths because the pip
# subprocesses run outside Git Bash.
Expand All @@ -118,22 +118,22 @@ jobs:
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
export PIP_BUILD_CONSTRAINT="$(cygpath -w "$(pwd)/wheel-constraints/cuda-bindings.txt")"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
python -m build --sdist cuda_bindings/
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
python -m build --sdist cuda_bindings_13/
pip wheel --no-deps --wheel-dir cuda_bindings_13/dist cuda_bindings_13/dist/*.tar.gz

- name: Download cuda.bindings wheel
if: ${{ env.BUILD_BINDINGS != 'true' && env.BUILD_CORE == 'true' }}
uses: ./.github/actions/download-artifact-retry
with:
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
path: cuda_bindings/dist
path: cuda_bindings_13/dist

- name: Constrain cuda.core to the local cuda.bindings wheel
if: ${{ env.BUILD_CORE == 'true' }}
run: |
CUDA_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
bindings_wheels=(cuda_bindings/dist/cuda_bindings-"${CUDA_MAJOR}".*.whl)
bindings_wheels=(cuda_bindings_13/dist/cuda_bindings-"${CUDA_MAJOR}".*.whl)
test "${#pathfinder_wheels[@]}" -eq 1
test "${#bindings_wheels[@]}" -eq 1
test -f "${pathfinder_wheels[0]}"
Expand Down
26 changes: 13 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __pycache__/
.benchmarks/
*.cpp
!*_impl.cpp
!cuda_bindings/cuda/bindings/_bindings/loader.cpp
!cuda_bindings_13/cuda/bindings/_bindings/loader.cpp
!cuda_core/cuda/core/_cpp/**/*.cpp
cache_driver
cache_runtime
Expand All @@ -27,17 +27,17 @@ cuda_core/tests/test_binaries/*.a
cuda_core/tests/test_binaries/*.lib

# CUDA Python specific (auto-generated)
cuda_bindings/cuda/bindings/_internal/cudla.pyx
cuda_bindings/cuda/bindings/_internal/driver.pyx
cuda_bindings/cuda/bindings/_internal/nvrtc.pyx
cuda_bindings/cuda/bindings/_internal/cufile.pyx
cuda_bindings/cuda/bindings/_internal/nvfatbin.pyx
cuda_bindings/cuda/bindings/_internal/nvjitlink.pyx
cuda_bindings/cuda/bindings/_internal/nvml.pyx
cuda_bindings/cuda/bindings/_internal/nvvm.pyx
cuda_bindings/cuda/bindings/_internal/runtime.pyx
cuda_bindings/cuda/bindings/_internal/runtime_ptds.pyx
cuda_bindings/cuda/bindings/utils/_get_handle.pyx
cuda_bindings_13/cuda/bindings/_internal/cudla.pyx
cuda_bindings_13/cuda/bindings/_internal/driver.pyx
cuda_bindings_13/cuda/bindings/_internal/nvrtc.pyx
cuda_bindings_13/cuda/bindings/_internal/cufile.pyx
cuda_bindings_13/cuda/bindings/_internal/nvfatbin.pyx
cuda_bindings_13/cuda/bindings/_internal/nvjitlink.pyx
cuda_bindings_13/cuda/bindings/_internal/nvml.pyx
cuda_bindings_13/cuda/bindings/_internal/nvvm.pyx
cuda_bindings_13/cuda/bindings/_internal/runtime.pyx
cuda_bindings_13/cuda/bindings/_internal/runtime_ptds.pyx
cuda_bindings_13/cuda/bindings/utils/_get_handle.pyx

# Version files from setuptools_scm
_version.py
Expand Down Expand Up @@ -178,7 +178,7 @@ cython_debug/
# Dont ignore
!.github/actions/build/
# pixi environments
# Per-workspace commands such as `pixi lock --manifest-path cuda_bindings`
# Per-workspace commands such as `pixi lock --manifest-path cuda_bindings_13`
# create a .pixi/ next to that manifest, so match at any depth.
**/.pixi/*
!**/.pixi/config.toml
Expand Down
Loading
Loading