Skip to content

cuda.core: fix build compatibility with cuda-bindings 13.0.x - #2700

Open
andre-motta wants to merge 1 commit into
NVIDIA:mainfrom
andre-motta:fix/cuda-core-build-cuda-13.0-compat
Open

cuda.core: fix build compatibility with cuda-bindings 13.0.x#2700
andre-motta wants to merge 1 commit into
NVIDIA:mainfrom
andre-motta:fix/cuda-core-build-cuda-13.0-compat

Conversation

@andre-motta

@andre-motta andre-motta commented Aug 25, 2026

Copy link
Copy Markdown

Description

closes #2699

Building cuda-core from source against cuda-bindings==13.0.x fails at Cython compilation time because build_hooks.py only passes CUDA_CORE_BUILD_MAJOR to Cython, making it impossible to distinguish 13.0 from 13.1+. Ten IF CUDA_CORE_BUILD_MAJOR >= 13: guards in _device_resources.pyx reference types only available in cuda-bindings 13.1+ (workqueue types, CUdevSmResource.flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS).

This is distinct from the runtime import fix in #2064 -- that addressed cuDevSmResourceSplit not being found at import time via PyCapsule. This PR fixes the build-time failure.

Changes:

  • build_hooks.py: Refactor _determine_cuda_major_version into _determine_cuda_version that returns (major, minor). Extract minor version from CUDA_VERSION macro (e.g. 13000 -> minor 0, 13010 -> minor 1). Pass CUDA_CORE_BUILD_MINOR alongside CUDA_CORE_BUILD_MAJOR in Cython's compile_time_env. Also supports explicit override via CUDA_CORE_BUILD_MINOR env var when CUDA_CORE_BUILD_MAJOR is set.
  • _device_resources.pyx: Tighten 10 guards from IF CUDA_CORE_BUILD_MAJOR >= 13: to IF CUDA_CORE_BUILD_MAJOR > 13 or (CUDA_CORE_BUILD_MAJOR == 13 and CUDA_CORE_BUILD_MINOR >= 1): for code that uses 13.1-only declarations. The remaining 40+ >= 13 guards across other files are unaffected (they use only types present in 13.0).

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Build hooks now extract and pass CUDA_CORE_BUILD_MINOR alongside
CUDA_CORE_BUILD_MAJOR so Cython compile-time conditionals can
distinguish 13.0 from 13.1+. Ten guards in _device_resources.pyx that
referenced 13.1-only declarations (workqueue types, CUdevSmResource.flags,
CU_DEV_SM_RESOURCE_GROUP_PARAMS) are tightened from >= 13 to >= 13.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Andre Lustosa <alustosa@redhat.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Aug 25, 2026
@leofang leofang self-assigned this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cuda.core fails to build from source against cuda-bindings 13.0.x

2 participants