Skip to content

Commit b895775

Browse files
committed
Merge remote-tracking branch 'origin/main' into graph-definition-node-updates
Resolve conflict in _init_memcpy_params by keeping the extracted helper from the graph node updates branch.
2 parents 1b0fdbd + 2a62ae8 commit b895775

60 files changed

Lines changed: 1171 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ jobs:
158158
steps:
159159
- name: Checkout Source
160160
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
161+
with:
162+
ref: ${{ inputs.git-tag }}
161163

162164
- name: Set up Python
163165
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0

‎.pre-commit-config.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ repos:
5050
files: ^cuda_bindings/
5151
types: [text]
5252

53+
- id: check-pixi-cuda-version
54+
name: Check pixi cuda-version pins track ci/versions.yml
55+
entry: python ./ci/tools/check_pixi_cuda_version.py
56+
language: python
57+
additional_dependencies: [pyyaml==6.0.3]
58+
files: '^(ci/versions\.yml|cuda_bindings/pixi\.toml|cuda_core/pixi\.toml)$'
59+
pass_filenames: false
60+
5361
- id: no-markdown-in-docs-source
5462
name: Prevent markdown files in docs/source directories
5563
entry: bash -c
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Check pixi cuda-version pins track ci/versions.yml (cuda.build.version)."""
5+
6+
from __future__ import annotations
7+
8+
import sys
9+
from pathlib import Path
10+
11+
import tomllib
12+
import yaml
13+
14+
ROOT = Path(__file__).resolve().parents[2]
15+
VERSIONS_FILE_PATH = ROOT / "ci" / "versions.yml"
16+
PIXI_FILES = [ROOT / d / "pixi.toml" for d in ("cuda_bindings", "cuda_core")]
17+
18+
19+
def main() -> int:
20+
"""Verify cuda_bindings/cuda_core pixi pins match ci/versions.yml."""
21+
if not VERSIONS_FILE_PATH.is_file():
22+
print(f"error: {VERSIONS_FILE_PATH} not found", file=sys.stderr)
23+
return 2
24+
try:
25+
build_version = yaml.safe_load(VERSIONS_FILE_PATH.read_text(encoding="utf-8"))["cuda"]["build"]["version"]
26+
except (KeyError, TypeError):
27+
print(f"error: cuda.build.version not found in {VERSIONS_FILE_PATH}", file=sys.stderr)
28+
return 2
29+
30+
major, minor, *_ = build_version.split(".")
31+
expected = f"{major}.{minor}.*"
32+
cuda_feature = f"cu{major}"
33+
34+
errors: list[str] = []
35+
checked: list[str] = []
36+
for path in PIXI_FILES:
37+
if not path.is_file():
38+
print(f"error: {path} not found", file=sys.stderr)
39+
return 2
40+
with path.open("rb") as f:
41+
data = tomllib.load(f)
42+
rel = path.relative_to(ROOT)
43+
try:
44+
variants = data["workspace"]["build-variants"]["cuda-version"]
45+
cuda_pin = data["feature"][cuda_feature]["dependencies"]["cuda-version"]
46+
except KeyError as exc:
47+
print(
48+
f"error: {rel} missing feature {cuda_feature!r} or cuda-version key: {exc}",
49+
file=sys.stderr,
50+
)
51+
return 2
52+
if expected not in variants:
53+
errors.append(
54+
f"{rel}: workspace.build-variants.cuda-version={variants!r} "
55+
f"does not include {expected!r} "
56+
f"(from ci/versions.yml cuda.build.version={build_version!r})"
57+
)
58+
if cuda_pin != expected:
59+
errors.append(
60+
f"{rel}: feature.{cuda_feature}.dependencies.cuda-version={cuda_pin!r} "
61+
f"!= {expected!r} "
62+
f"(from ci/versions.yml cuda.build.version={build_version!r})"
63+
)
64+
65+
checked.append(
66+
f"{rel} (workspace.build-variants.cuda-version={variants!r}, "
67+
f"feature.{cuda_feature}.dependencies.cuda-version={cuda_pin!r})"
68+
)
69+
70+
if errors:
71+
print(
72+
f"error: cuda_bindings/cuda_core pixi cuda-version pins out of sync with "
73+
f"ci/versions.yml cuda.build.version={build_version!r} "
74+
f"(expected pin {expected!r}):",
75+
file=sys.stderr,
76+
)
77+
for err in errors:
78+
print(f" - {err}", file=sys.stderr)
79+
return 1
80+
81+
print(
82+
f"OK: pixi cuda-version pins match ci/versions.yml "
83+
f"cuda.build.version={build_version!r} (expected pin {expected!r}):"
84+
)
85+
for item in checked:
86+
print(f" - {item}")
87+
return 0
88+
89+
90+
if __name__ == "__main__":
91+
sys.exit(main())

‎cuda_bindings/tests/cython/test_ccudart.pyx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ cdef extern from *:
5959

6060
def test_ccudart_interoperable():
6161
# struct
62-
cdef dim3 oldDim, newDim
63-
oldDim.x = 1
64-
oldDim.y = 2
65-
oldDim.z = 3
66-
newDim = copy_and_append_dim3(oldDim)
62+
cdef dim3 oldDim = [1, 2, 3]
63+
cdef dim3 newDim = copy_and_append_dim3(oldDim)
6764
assert oldDim.x + 1 == newDim.x
6865
assert oldDim.y + 1 == newDim.y
6966
assert oldDim.z + 1 == newDim.z

‎cuda_core/build_hooks.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pathlib import Path
1818

1919
from Cython.Build import cythonize
20+
from Cython.Compiler import Options as _CythonOptions
2021
from setuptools import Extension
2122
from setuptools import build_meta as _build_meta
2223

@@ -212,6 +213,7 @@ def get_sources(mod_name):
212213
nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", os.cpu_count() // 2))
213214
compile_time_env = {"CUDA_CORE_BUILD_MAJOR": int(_determine_cuda_major_version())}
214215
compiler_directives = {"embedsignature": True, "warn.deprecated.IF": False, "freethreading_compatible": True}
216+
_CythonOptions.warning_errors = True
215217
if COMPILE_FOR_COVERAGE:
216218
compiler_directives["linetrace"] = True
217219
_extensions = cythonize(

‎cuda_core/cuda/core/__init__.py‎

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,45 +69,51 @@ class _PatchedProperty(metaclass=_PatchedPropMeta):
6969

7070

7171
from cuda.core import checkpoint, system, utils
72-
from cuda.core._context import Context, ContextOptions
73-
from cuda.core._device import Device
74-
from cuda.core._device_resources import (
75-
DeviceResources,
76-
SMResource,
77-
SMResourceOptions,
78-
WorkqueueResource,
79-
WorkqueueResourceOptions,
80-
)
81-
from cuda.core._event import Event, EventOptions
82-
from cuda.core._graphics import GraphicsResource
83-
from cuda.core._host import Host
84-
from cuda.core._launch_config import LaunchConfig
85-
from cuda.core._launcher import launch
86-
from cuda.core._linker import Linker, LinkerOptions
87-
from cuda.core._memory import (
88-
Buffer,
89-
DeviceMemoryResource,
90-
DeviceMemoryResourceOptions,
91-
GraphMemoryResource,
92-
LegacyPinnedMemoryResource,
93-
ManagedBuffer,
94-
ManagedMemoryResource,
95-
ManagedMemoryResourceOptions,
96-
MemoryResource,
97-
PinnedMemoryResource,
98-
PinnedMemoryResourceOptions,
99-
VirtualMemoryResource,
100-
VirtualMemoryResourceOptions,
101-
)
102-
from cuda.core._module import Kernel, ObjectCode
103-
from cuda.core._program import Program, ProgramOptions
104-
from cuda.core._stream import (
105-
LEGACY_DEFAULT_STREAM,
106-
PER_THREAD_DEFAULT_STREAM,
107-
Stream,
108-
StreamOptions,
109-
)
110-
from cuda.core._tensor_map import TensorMapDescriptor, TensorMapDescriptorOptions
72+
from cuda.core._context import *
73+
from cuda.core._context import __all__ as _context_all
74+
from cuda.core._device import *
75+
from cuda.core._device import __all__ as _device_all
76+
from cuda.core._device_resources import *
77+
from cuda.core._device_resources import __all__ as _device_resources_all
78+
from cuda.core._event import *
79+
from cuda.core._event import __all__ as _event_all
80+
from cuda.core._graphics import *
81+
from cuda.core._graphics import __all__ as _graphics_all
82+
from cuda.core._host import *
83+
from cuda.core._host import __all__ as _host_all
84+
from cuda.core._launch_config import *
85+
from cuda.core._launch_config import __all__ as _launch_config_all
86+
from cuda.core._launcher import *
87+
from cuda.core._launcher import __all__ as _launcher_all
88+
from cuda.core._linker import *
89+
from cuda.core._linker import __all__ as _linker_all
90+
from cuda.core._memory import *
91+
from cuda.core._memory import __all__ as _memory_all
92+
from cuda.core._module import *
93+
from cuda.core._module import __all__ as _module_all
94+
from cuda.core._program import *
95+
from cuda.core._program import __all__ as _program_all
96+
from cuda.core._stream import *
97+
from cuda.core._stream import __all__ as _stream_all
98+
from cuda.core._tensor_map import *
99+
from cuda.core._tensor_map import __all__ as _tensor_map_all
100+
101+
__all__ = [
102+
*_context_all,
103+
*_device_all,
104+
*_device_resources_all,
105+
*_event_all,
106+
*_graphics_all,
107+
*_host_all,
108+
*_launch_config_all,
109+
*_launcher_all,
110+
*_linker_all,
111+
*_memory_all,
112+
*_module_all,
113+
*_program_all,
114+
*_stream_all,
115+
*_tensor_map_all,
116+
]
111117

112118
# isort: split
113119
# Texture/surface types live under the cuda.core.texture namespace (not the

‎cuda_core/cuda/core/_device.pyi‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,4 +1023,5 @@ class Device:
10231023
.. versionadded:: 1.1.0
10241024
"""
10251025
_tls = threading.local()
1026-
_lock = threading.Lock()
1026+
_lock = threading.Lock()
1027+
__all__ = ['Device']

‎cuda_core/cuda/core/_device.pyx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ _tls = threading.local()
6161
_lock = threading.Lock()
6262
cdef bint _is_cuInit = False
6363

64+
__all__ = ['Device']
65+
6466

6567
cdef class DeviceProperties:
6668
"""
@@ -1316,7 +1318,6 @@ class Device:
13161318
cdef object res
13171319
cdef SMResource sm_res
13181320
cdef WorkqueueResource wq_res
1319-
cdef GreenCtxHandle h_green
13201321

13211322
if options is None:
13221323
raise ValueError(
@@ -1348,7 +1349,7 @@ class Device:
13481349
else:
13491350
raise TypeError(f"Unsupported context resource type: {type(res)}")
13501351

1351-
h_green = create_green_ctx_handle(
1352+
cdef GreenCtxHandle h_green = create_green_ctx_handle(
13521353
c_resources.data(),
13531354
<unsigned int>(c_resources.size()),
13541355
<cydriver.CUdevice>(self._device_id),

‎cuda_core/cuda/core/_device_resources.pyx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ cdef object _resolve_split_by_count_request(SMResourceOptions options):
250250
cdef list counts = _broadcast_field(options.count, n_groups)
251251
cdef object first = counts[0]
252252
cdef object value
253-
cdef unsigned int min_count
254253

255254
if options.coscheduled_sm_count is not None:
256255
raise RuntimeError(
@@ -270,7 +269,7 @@ cdef object _resolve_split_by_count_request(SMResourceOptions options):
270269
"use CUDA 13.1 or newer for per-group counts"
271270
)
272271

273-
min_count = _to_sm_count(first)
272+
cdef unsigned int min_count = _to_sm_count(first)
274273
return n_groups, min_count
275274

276275

‎cuda_core/cuda/core/_dlpack.pyx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ cdef inline int setup_dl_tensor_device(DLTensor* dl_tensor, object buf) except -
115115

116116

117117
cdef inline int setup_dl_tensor_dtype(DLTensor* dl_tensor) except -1 nogil:
118-
cdef DLDataType* dtype = &dl_tensor.dtype
119-
dtype.code = <uint8_t>kDLInt
120-
dtype.lanes = <uint16_t>1
121-
dtype.bits = <uint8_t>8
118+
dl_tensor.dtype = DLDataType(
119+
code=<uint8_t>kDLInt, bits=<uint8_t>8, lanes=<uint16_t>1)
122120
return 0
123121

124122

0 commit comments

Comments
 (0)