NVIDIA / NVIDIA/cuda-python

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

Open
#2,699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Cython
Stars
3.4k
Forks
329
Avg merge
1d 23h
Merged PRs (30d)
116

Description

Is this a duplicate?
Type of Bug

Compile-time Error

Component

cuda.core

Describe the bug

Building cuda-core from source against cuda-bindings==13.0.x fails at Cython compilation time. This is distinct from the runtime import failure fixed in #2063/#2064 -- that fix addressed cuDevSmResourceSplit not being found at import time. This issue is about the build itself failing.

The root cause is that build_hooks.py only passes CUDA_CORE_BUILD_MAJOR (integer 12 or 13) to Cython's compile-time environment. Several IF CUDA_CORE_BUILD_MAJOR >= 13: guards in _device_resources.pyx reference types, enum values, and struct fields that were only introduced in cuda-bindings 13.1.0, not 13.0.x.

When building with CUDA 13.0 headers, CUDA_CORE_BUILD_MAJOR is set to 13, which activates all >= 13 guards, including those that reference:

  • CUdevSmResource_st.flags field
  • CU_DEV_SM_RESOURCE_GROUP_PARAMS struct
  • CUdevSmResourceGroup_flags enum
  • CUdevWorkqueueConfigScope enum
  • CUdevWorkqueueConfigResource / CUdevWorkqueueResource structs
  • CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIG / CU_DEV_RESOURCE_TYPE_WORKQUEUE enum values
  • CUdevResource_st.wqConfig, .wq fields

None of these exist in cuda-bindings 13.0.x's cydriver.pxd, causing Cython to fail.

The issue is scoped to 10 guards, all in _device_resources.pyx. The remaining 40+ IF CUDA_CORE_BUILD_MAJOR >= 13: guards across the codebase (graph, memory, tensor_map, device modules) use only types available in cuda-bindings 13.0.x and are unaffected.

How to Reproduce
  1. Install CUDA 13.0 toolkit (so CUDA_HOME points to a 13.0 installation)
  2. pip install cuda-bindings==13.0.3
  3. Attempt to build cuda-core from source: pip install --no-binary cuda-core cuda-core
  4. Cython compilation fails with errors about unknown types/fields from cydriver.pxd
Expected behavior

cuda-core should build successfully against any cuda-bindings 13.0.x release, with 13.1+ features gracefully disabled at compile time.

System information

Any system with CUDA 13.0 toolkit and cuda-bindings 13.0.x installed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build_hooks.py and the 10 CUDA_CORE_BUILD_MAJOR guards in _device_resources.pyx. Reproduce with CUDA 13.0 and cuda-bindings==13.0.3 using pip install --no-binary cuda-core cuda-core, then inspect the Cython errors. Done means cuda-core builds successfully against cuda-bindings 13.0.x while 13.1-only features remain disabled.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.