Skip to content

Commit 810b102

Browse files
committed
inline capability check helper
1 parent 40e30da commit 810b102

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

‎cuda_core/cuda/core/_memory/_copy_attributes.pxd‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
# without either depending on the other.
88

99
from cuda.bindings cimport cydriver
10+
from cuda.core._utils.version cimport cy_binding_version, cy_driver_version # no-cython-lint
1011

1112

12-
cdef bint _with_attributes_available()
13+
IF CUDA_CORE_BUILD_MAJOR >= 13:
14+
cdef inline bint _with_attributes_available():
15+
return cy_driver_version() >= (13, 2, 0) and cy_binding_version() >= (13, 2, 0)
16+
ELSE:
17+
cdef inline bint _with_attributes_available():
18+
return False
19+
1320
cdef cydriver.CUmemcpyAttributes _to_cu_memcpy_attributes(object attr)

‎cuda_core/cuda/core/_memory/_copy_attributes.pyx‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,10 @@ from libc.string cimport memset
66

77
from cuda.bindings cimport cydriver
88
from cuda.core._memory._location cimport to_cumemlocation
9-
from cuda.core._utils.version cimport cy_binding_version, cy_driver_version # no-cython-lint
109

1110
from cuda.core._memory._managed_location import _coerce_location
1211

1312

14-
cdef bint _with_attributes_available():
15-
"""Whether cuMemcpyWithAttributesAsync is callable here.
16-
17-
Requires cuda.core built against CUDA 13 headers and both cuda.bindings
18-
and the driver reporting CUDA 13.2 or newer.
19-
"""
20-
IF CUDA_CORE_BUILD_MAJOR >= 13:
21-
return cy_driver_version() >= (13, 2, 0) and cy_binding_version() >= (13, 2, 0)
22-
ELSE:
23-
return False
24-
25-
2613
cdef cydriver.CUmemcpyAttributes _to_cu_memcpy_attributes(object attr):
2714
"""Convert a CopyOptions to a cydriver.CUmemcpyAttributes struct."""
2815
cdef cydriver.CUmemcpyAttributes cu_attr

0 commit comments

Comments
 (0)