Skip to content

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

Description

@andre-motta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds the team's attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions