Skip to content

Commit 1081d99

Browse files
committed
Non-auto-generated changes
1 parent 57c503c commit 1081d99

8 files changed

Lines changed: 39 additions & 41 deletions

File tree

cuda_bindings/cuda/bindings/_lib/utils.pxi.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ cdef class _HelperKernelParams:
114114
raise TypeError("Unsupported type: " + str(type(ctype)))
115115
idx += 1
116116
else:
117-
raise TypeError("Argument 'kernelParams' is not a valid type: Tuple[Tuple[Any, ...], Tuple[Any, ...]] or PyObject implimenting Buffer Protocol or Int")
117+
raise TypeError("Argument 'kernelParams' is not a valid type: tuple[tuple[Any, ...], tuple[Any, ...]] or PyObject implimenting Buffer Protocol or Int")
118118

119119
def __dealloc__(self):
120120
if self._pyobj_acquired is True:

cuda_bindings/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ select = [
8484
]
8585

8686
ignore = [
87-
"UP006",
8887
"UP007",
8988
"E741", # ambiguous variable name such as I
9089
"B007", # rename unsued loop variable to _name

cuda_core/cuda/core/experimental/_linker.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import weakref
99
from contextlib import contextmanager
1010
from dataclasses import dataclass
11-
from typing import TYPE_CHECKING, List, Tuple, Union
11+
from typing import TYPE_CHECKING, Union
1212
from warnings import warn
1313

1414
if TYPE_CHECKING:
@@ -140,14 +140,14 @@ class LinkerOptions:
140140
fma : bool, optional
141141
Use fast multiply-add.
142142
Default: True.
143-
kernels_used : [Union[str, Tuple[str], List[str]]], optional
143+
kernels_used : [Union[str, tuple[str], list[str]]], optional
144144
Pass a kernel or sequence of kernels that are used; any not in the list can be removed.
145-
variables_used : [Union[str, Tuple[str], List[str]]], optional
145+
variables_used : [Union[str, tuple[str], list[str]]], optional
146146
Pass a variable or sequence of variables that are used; any not in the list can be removed.
147147
optimize_unused_variables : bool, optional
148148
Assume that if a variable is not referenced in device code, it can be removed.
149149
Default: False.
150-
ptxas_options : [Union[str, Tuple[str], List[str]]], optional
150+
ptxas_options : [Union[str, tuple[str], list[str]]], optional
151151
Pass options to PTXAS.
152152
split_compile : int, optional
153153
Split compilation maximum thread count. Use 0 to use all available processors. Value of 1 disables split
@@ -177,10 +177,10 @@ class LinkerOptions:
177177
prec_div: bool | None = None
178178
prec_sqrt: bool | None = None
179179
fma: bool | None = None
180-
kernels_used: Union[str, Tuple[str], List[str]] | None = None
181-
variables_used: Union[str, Tuple[str], List[str]] | None = None
180+
kernels_used: Union[str, tuple[str], list[str]] | None = None
181+
variables_used: Union[str, tuple[str], list[str]] | None = None
182182
optimize_unused_variables: bool | None = None
183-
ptxas_options: Union[str, Tuple[str], List[str]] | None = None
183+
ptxas_options: Union[str, tuple[str], list[str]] | None = None
184184
split_compile: int | None = None
185185
split_compile_extended: int | None = None
186186
no_cache: bool | None = None

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from cuda.core.experimental._utils.cuda_utils cimport (
1111
)
1212

1313
import abc
14-
from typing import Tuple, TypeVar, Union
14+
from typing import TypeVar, Union
1515

1616
from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule
1717
from cuda.core.experimental._stream import Stream, default_stream
@@ -183,8 +183,8 @@ cdef class Buffer:
183183
self,
184184
*,
185185
stream: int | None = None,
186-
max_version: Tuple[int, int] | None = None,
187-
dl_device: Tuple[int, int] | None = None,
186+
max_version: tuple[int, int] | None = None,
187+
dl_device: tuple[int, int] | None = None,
188188
copy: bool | None = None,
189189
) -> PyCapsule:
190190
# Note: we ignore the stream argument entirely (as if it is -1).
@@ -197,12 +197,12 @@ cdef class Buffer:
197197
versioned = False
198198
else:
199199
if not isinstance(max_version, tuple) or len(max_version) != 2:
200-
raise BufferError(f"Expected max_version Tuple[int, int], got {max_version}")
200+
raise BufferError(f"Expected max_version tuple[int, int], got {max_version}")
201201
versioned = max_version >= (1, 0)
202202
capsule = make_py_capsule(self, versioned)
203203
return capsule
204204

205-
def __dlpack_device__(self) -> Tuple[int, int]:
205+
def __dlpack_device__(self) -> tuple[int, int]:
206206
cdef bint d = self.is_device_accessible
207207
cdef bint h = self.is_host_accessible
208208
if d and (not h):

cuda_core/cuda/core/experimental/_program.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import weakref
88
from dataclasses import dataclass
9-
from typing import TYPE_CHECKING, List, Tuple, Union
9+
from typing import TYPE_CHECKING, Union
1010
from warnings import warn
1111

1212
if TYPE_CHECKING:
@@ -33,22 +33,22 @@ def _process_define_macro_inner(formatted_options, macro):
3333
return True
3434
if isinstance(macro, tuple):
3535
if len(macro) != 2 or any(not isinstance(val, str) for val in macro):
36-
raise RuntimeError(f"Expected define_macro Tuple[str, str], got {macro}")
36+
raise RuntimeError(f"Expected define_macro tuple[str, str], got {macro}")
3737
formatted_options.append(f"--define-macro={macro[0]}={macro[1]}")
3838
return True
3939
return False
4040

4141

4242
def _process_define_macro(formatted_options, macro):
43-
union_type = "Union[str, Tuple[str, str]]"
43+
union_type = "Union[str, tuple[str, str]]"
4444
if _process_define_macro_inner(formatted_options, macro):
4545
return
4646
if is_nested_sequence(macro):
4747
for seq_macro in macro:
4848
if not _process_define_macro_inner(formatted_options, seq_macro):
4949
raise RuntimeError(f"Expected define_macro {union_type}, got {seq_macro}")
5050
return
51-
raise RuntimeError(f"Expected define_macro {union_type}, List[{union_type}], got {macro}")
51+
raise RuntimeError(f"Expected define_macro {union_type}, list[{union_type}], got {macro}")
5252

5353

5454
@dataclass
@@ -79,7 +79,7 @@ class ProgramOptions:
7979
Enable device code optimization. When specified along with ‘-G’, enables limited debug information generation
8080
for optimized device code.
8181
Default: None
82-
ptxas_options : Union[str, List[str]], optional
82+
ptxas_options : Union[str, list[str]], optional
8383
Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings.
8484
For example ["-v", "-O2"].
8585
Default: None
@@ -113,17 +113,17 @@ class ProgramOptions:
113113
gen_opt_lto : bool, optional
114114
Run the optimizer passes before generating the LTO IR.
115115
Default: False
116-
define_macro : Union[str, Tuple[str, str], List[Union[str, Tuple[str, str]]]], optional
116+
define_macro : Union[str, tuple[str, str], list[Union[str, tuple[str, str]]]], optional
117117
Predefine a macro. Can be either a string, in which case that macro will be set to 1, a 2 element tuple of
118118
strings, in which case the first element is defined as the second, or a list of strings or tuples.
119119
Default: None
120-
undefine_macro : Union[str, List[str]], optional
120+
undefine_macro : Union[str, list[str]], optional
121121
Cancel any previous definition of a macro, or list of macros.
122122
Default: None
123-
include_path : Union[str, List[str]], optional
123+
include_path : Union[str, list[str]], optional
124124
Add the directory or directories to the list of directories to be searched for headers.
125125
Default: None
126-
pre_include : Union[str, List[str]], optional
126+
pre_include : Union[str, list[str]], optional
127127
Preinclude one or more headers during preprocessing. Can be either a string or a list of strings.
128128
Default: None
129129
no_source_include : bool, optional
@@ -156,13 +156,13 @@ class ProgramOptions:
156156
no_display_error_number : bool, optional
157157
Disable the display of a diagnostic number for warning messages.
158158
Default: False
159-
diag_error : Union[int, List[int]], optional
159+
diag_error : Union[int, list[int]], optional
160160
Emit error for a specified diagnostic message number or comma separated list of numbers.
161161
Default: None
162-
diag_suppress : Union[int, List[int]], optional
162+
diag_suppress : Union[int, list[int]], optional
163163
Suppress a specified diagnostic message number or comma separated list of numbers.
164164
Default: None
165-
diag_warn : Union[int, List[int]], optional
165+
diag_warn : Union[int, list[int]], optional
166166
Emit warning for a specified diagnostic message number or comma separated lis of numbers.
167167
Default: None
168168
brief_diagnostics : bool, optional
@@ -189,7 +189,7 @@ class ProgramOptions:
189189
debug: bool | None = None
190190
lineinfo: bool | None = None
191191
device_code_optimize: bool | None = None
192-
ptxas_options: Union[str, List[str], Tuple[str]] | None = None
192+
ptxas_options: Union[str, list[str], tuple[str]] | None = None
193193
max_register_count: int | None = None
194194
ftz: bool | None = None
195195
prec_sqrt: bool | None = None
@@ -200,11 +200,11 @@ class ProgramOptions:
200200
link_time_optimization: bool | None = None
201201
gen_opt_lto: bool | None = None
202202
define_macro: (
203-
Union[str, Tuple[str, str], List[Union[str, Tuple[str, str]]], Tuple[Union[str, Tuple[str, str]]]] | None
203+
Union[str, tuple[str, str], list[Union[str, tuple[str, str]]], tuple[Union[str, tuple[str, str]]]] | None
204204
) = None
205-
undefine_macro: Union[str, List[str], Tuple[str]] | None = None
206-
include_path: Union[str, List[str], Tuple[str]] | None = None
207-
pre_include: Union[str, List[str], Tuple[str]] | None = None
205+
undefine_macro: Union[str, list[str], tuple[str]] | None = None
206+
include_path: Union[str, list[str], tuple[str]] | None = None
207+
pre_include: Union[str, list[str], tuple[str]] | None = None
208208
no_source_include: bool | None = None
209209
std: str | None = None
210210
builtin_move_forward: bool | None = None
@@ -215,9 +215,9 @@ class ProgramOptions:
215215
device_int128: bool | None = None
216216
optimization_info: str | None = None
217217
no_display_error_number: bool | None = None
218-
diag_error: Union[int, List[int], Tuple[int]] | None = None
219-
diag_suppress: Union[int, List[int], Tuple[int]] | None = None
220-
diag_warn: Union[int, List[int], Tuple[int]] | None = None
218+
diag_error: Union[int, list[int], tuple[int]] | None = None
219+
diag_suppress: Union[int, list[int], tuple[int]] | None = None
220+
diag_warn: Union[int, list[int], tuple[int]] | None = None
221221
brief_diagnostics: bool | None = None
222222
time: str | None = None
223223
split_compile: int | None = None
@@ -453,7 +453,7 @@ def compile(self, target_type, name_expressions=(), logs=None):
453453
target_type : Any
454454
String of the targeted compilation type.
455455
Supported options are "ptx", "cubin" and "ltoir".
456-
name_expressions : Union[List, Tuple], optional
456+
name_expressions : Union[list, tuple], optional
457457
List of explicit name expressions to become accessible.
458458
(Default to no expressions)
459459
logs : Any, optional

cuda_core/cuda/core/experimental/_stream.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ from cuda.core.experimental._utils.cuda_utils cimport (
1212
import os
1313
import warnings
1414
from dataclasses import dataclass
15-
from typing import TYPE_CHECKING, Optional, Protocol, Tuple, Union
15+
from typing import TYPE_CHECKING, Optional, Protocol, Union
1616

1717
if TYPE_CHECKING:
1818
import cuda.bindings
@@ -47,7 +47,7 @@ cdef class StreamOptions:
4747

4848

4949
class IsStreamT(Protocol):
50-
def __cuda_stream__(self) -> Tuple[int, int]:
50+
def __cuda_stream__(self) -> tuple[int, int]:
5151
"""
5252
For any Python object that is meant to be interpreted as a CUDA stream, the intent
5353
can be communicated by implementing this protocol that returns a 2-tuple: The protocol
@@ -201,7 +201,7 @@ cdef class Stream:
201201
self._owner = None
202202
self._handle = None
203203

204-
def __cuda_stream__(self) -> Tuple[int, int]:
204+
def __cuda_stream__(self) -> tuple[int, int]:
205205
"""Return an instance of a __cuda_stream__ protocol."""
206206
return (0, int(self.handle))
207207

cuda_core/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ select = [
9797
]
9898

9999
ignore = [
100-
"UP006",
101100
"UP007",
102101
"E741", # ambiguous variable name such as I
103102
"B007", # rename unsued loop variable to _name

cuda_core/tests/test_memory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ def test_buffer_dunder_dlpack():
229229
buffer.__dlpack__(dl_device=())
230230
with pytest.raises(BufferError, match=r"^Sorry, not supported: copy=True$"):
231231
buffer.__dlpack__(copy=True)
232-
with pytest.raises(BufferError, match=r"^Expected max_version Tuple\[int, int\], got \(\)$"):
232+
with pytest.raises(BufferError, match=r"^Expected max_version tuple\[int, int\], got \(\)$"):
233233
buffer.__dlpack__(max_version=())
234-
with pytest.raises(BufferError, match=r"^Expected max_version Tuple\[int, int\], got \(9, 8, 7\)$"):
234+
with pytest.raises(BufferError, match=r"^Expected max_version tuple\[int, int\], got \(9, 8, 7\)$"):
235235
buffer.__dlpack__(max_version=(9, 8, 7))
236236

237237

0 commit comments

Comments
 (0)