Skip to content

Commit 948cb4e

Browse files
authored
Merge branch 'main' into fea-bf16-dlpack-smv
2 parents 1a21316 + d40517a commit 948cb4e

75 files changed

Lines changed: 14684 additions & 9978 deletions

Some content is hidden

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

‎.git_archival.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
ref-names: $Format:%D$

‎.gitattributes‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
cuda/_version.py export-subst
2-
31
* text eol=lf
42
*.cmd text eol=crlf
53

@@ -16,3 +14,9 @@ cuda_core/cuda/core/_cpp/*.hpp -binary text diff
1614
*.svg binary
1715
# SCM syntax highlighting & preventing 3-way merges
1816
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
17+
18+
# "export-subst" specifies that this file will get filled in with the current
19+
# commit and tag information when running `git archive`. This allows
20+
# `setuptools-scm` to correctly determine the version when building from a git
21+
# archive. See #1609.
22+
.git_archival.txt export-subst

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
language: python
3030
additional_dependencies:
3131
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
32-
exclude: '.*pixi\.lock'
32+
exclude: '(.*pixi\.lock)|(\.git_archival\.txt)'
3333
args: ["--fix"]
3434

3535
- id: no-markdown-in-docs-source

‎LICENSE.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
This repository is structured in a way that files are licensed differently
22
- [`cuda.python`](./cuda_python/LICENSE): NVIDIA Software License
33
- [`cuda.bindings`](./cuda_bindings/LICENSE): NVIDIA Software License
4-
- [`cuda.core`](./cuda_core/LICENSE) and everything else in this repository: Apache 2.0
4+
- [`cuda.core`](./cuda_core/LICENSE): Apache 2.0
5+
- [`cuda.pathfinder`](./cuda_pathfinder/LICENSE): Apache 2.0
6+
- Repo metadata, CI tools, GitHub workflows: Apache 2.0

‎ci/tools/install_gpu_driver.ps1‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -72,8 +72,13 @@ function Install-Driver {
7272
Write-Output "Unknown driver mode: $driver_mode"
7373
exit 1
7474
}
75-
pnputil /disable-device /class Display
76-
pnputil /enable-device /class Display
75+
# Only restart NVIDIA display adapters, not other display devices (e.g. QEMU VGA)
76+
$nvidia_devices = Get-PnpDevice -Class Display -FriendlyName "NVIDIA*"
77+
foreach ($device in $nvidia_devices) {
78+
Write-Output "Restarting device: $($device.FriendlyName) ($($device.InstanceId))"
79+
pnputil /disable-device "$($device.InstanceId)"
80+
pnputil /enable-device "$($device.InstanceId)"
81+
}
7782
# Give it a minute to settle:
7883
Start-Sleep -Seconds 5
7984
}

‎ci/tools/run-tests‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ if [[ "${test_module}" == "pathfinder" ]]; then
3333
"LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
3434
"FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS}"
3535
pytest -ra -s -v --durations=0 tests/ |& tee /tmp/pathfinder_test_log.txt
36-
# Fail if no "INFO test_" lines are found; capture line count otherwise
37-
line_count=$(grep '^INFO test_' /tmp/pathfinder_test_log.txt | wc -l)
36+
# Report the number of "INFO test_" lines (including zero)
37+
# to support quick validations based on GHA log archives.
38+
line_count=$(awk '/^INFO test_/ {count++} END {print count+0}' /tmp/pathfinder_test_log.txt)
3839
echo "Number of \"INFO test_\" lines: $line_count"
3940
popd
4041
elif [[ "${test_module}" == "bindings" ]]; then
@@ -46,9 +47,9 @@ elif [[ "${test_module}" == "bindings" ]]; then
4647
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all] --group test
4748
fi
4849
echo "Running bindings tests"
49-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 tests/
50+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
5051
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
51-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 tests/cython
52+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
5253
fi
5354
popd
5455
elif [[ "${test_module}" == "core" ]]; then
@@ -79,11 +80,11 @@ elif [[ "${test_module}" == "core" ]]; then
7980
pip install $(ls "${CUDA_CORE_ARTIFACTS_DIR}"/*.whl)["cu${TEST_CUDA_MAJOR}"] --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"
8081
fi
8182
echo "Running core tests"
82-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 tests/
83+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
8384
# Currently our CI always installs the latest bindings (from either major version).
8485
# This is not compatible with the test requirements.
8586
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
86-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 tests/cython
87+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
8788
fi
8889
popd
8990
fi

‎cuda_bindings/.git_archival.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.git_archival.txt

‎cuda_bindings/MANIFEST.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33

4-
recursive-include cuda/ *.pyx *.pxd *.pxi
4+
recursive-include cuda/ *.pyx *.pxd *.pxi *.pyx.in *.pxd.in *.pxi.in *.h
55
# at least with setuptools 75.0.0 this folder was added erroneously
66
# to the payload, causing file copying to the build environment failed
77
exclude cuda/bindings cuda?bindings
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
3+
4+
5+
# This code was automatically generated across versions from 12.9.1 to 13.1.1. Do not modify it directly.
6+
7+
8+
"""
9+
This is a replacement for the stdlib enum.IntEnum.
10+
11+
Notably, it has much better import time performance, since it doesn't generate
12+
and evaluate Python code at startup time.
13+
14+
It supports the most important subset of the IntEnum API. See `test_enum` in
15+
`cuda_bindings/tests/test_basics.py` for details.
16+
"""
17+
18+
from typing import Any, Iterator
19+
20+
21+
class FastEnumMetaclass(type):
22+
def __init__(cls, name, bases, namespace):
23+
super().__init__(name, bases, namespace)
24+
25+
cls.__singletons__ = {}
26+
cls.__members__ = {}
27+
for name, value in cls.__dict__.items():
28+
if name.startswith("__") and name.endswith("__"):
29+
continue
30+
31+
if isinstance(value, tuple):
32+
value, doc = value
33+
elif isinstance(value, int):
34+
doc = None
35+
else:
36+
continue
37+
38+
singleton = int.__new__(cls, value)
39+
singleton.__doc__ = doc
40+
singleton._name = name
41+
cls.__singletons__[value] = singleton
42+
cls.__members__[name] = singleton
43+
44+
for name, member in cls.__members__.items():
45+
setattr(cls, name, member)
46+
47+
def __repr__(cls) -> str:
48+
return f"<enum '{cls.__name__}'>"
49+
50+
def __len__(cls) -> int:
51+
return len(cls.__members__)
52+
53+
def __iter__(cls) -> Iterator["FastEnum"]:
54+
return iter(cls.__members__.values())
55+
56+
def __contains__(cls, item: Any) -> bool:
57+
return item in cls.__singletons__
58+
59+
60+
class FastEnum(int, metaclass=FastEnumMetaclass):
61+
def __new__(cls, value: int) -> "FastEnum":
62+
singleton: FastEnum = cls.__singletons__.get(value)
63+
if singleton is None:
64+
raise ValueError(f"{value} is not a valid {cls.__name__}")
65+
return singleton
66+
67+
def __repr__(self) -> str:
68+
return f"<{self.__class__.__name__}.{self._name}: {int(self)}>"
69+
70+
@property
71+
def name(self) -> str:
72+
return self._name
73+
74+
@property
75+
def value(self) -> int:
76+
return int(self)

‎cuda_bindings/cuda/bindings/_internal/utils.pyx‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

@@ -8,6 +8,28 @@ from libcpp.utility cimport move
88
from cython.operator cimport dereference as deref
99

1010

11+
cdef extern from *:
12+
"""
13+
#if defined(__clang__)
14+
#define _COMPILER_VERSION ("Clang " __clang_version__)
15+
#elif defined(__GNUC__) || defined(__GNUG__)
16+
#define _COMPILER_VERSION ("GCC " __VERSION__)
17+
#elif defined(_MSC_VER)
18+
#define _COMPILER_VERSION ("MSVC " Py_STRINGIFY(_MSC_VER))
19+
#else
20+
#define _COMPILER_VERSION ("Unknown Compiler")
21+
#endif
22+
"""
23+
cdef char *_COMPILER_VERSION
24+
25+
26+
cpdef str get_c_compiler():
27+
"""
28+
Returns a string describing the C compiler used to build cuda.bindings
29+
"""
30+
return _COMPILER_VERSION.decode()
31+
32+
1133
cdef bint is_nested_sequence(data):
1234
if not cpython.PySequence_Check(data):
1335
return False

0 commit comments

Comments
 (0)