Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cuda_bindings_12/build_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ def _parse_headers(header_dict, include_path_list, parser_caching):
CUDA_VERSION = parser.defs["macros"].get("CUDA_VERSION", "Unknown")
print(f"Found CUDA_VERSION: {CUDA_VERSION}", flush=True)

found_types += {key for key in parser.defs["types"]}
found_types += {key for key in parser.defs["structs"]}
found_types += {key for key in parser.defs["unions"]}
found_types += {key for key in parser.defs["enums"]}
found_functions += {key for key in parser.defs["functions"]}
found_values += {key for key in parser.defs["values"]}
found_types += {*parser.defs["types"]}
found_types += {*parser.defs["structs"]}
found_types += {*parser.defs["unions"]}
found_types += {*parser.defs["enums"]}
found_functions += {*parser.defs["functions"]}
found_values += {*parser.defs["values"]}

for key, value in parser.defs["structs"].items():
struct_list[key] = _Struct(key, value["members"])
Expand Down
3 changes: 2 additions & 1 deletion cuda_bindings_12/cuda/bindings/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

from typing import Any, Callable
from typing import Any
from collections.abc import Callable

from ._ptx_utils import get_minimal_required_cuda_ver_from_ptx_ver, get_ptx_ver

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def main():
if kernel_number < 8:
selected_kernel = kernels(kernel_number)
else:
print("Error: kernel number should be between 0 to 7, you have entered %d".format())
print(f"Error: kernel number should be between 0 to 7, you have entered {kernel_number}")
sys.exit(-1)

major = checkCudaErrors(
Expand Down
3 changes: 1 addition & 2 deletions cuda_bindings_12/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class TopLevelFinderWithRedirector(_TopLevelFinder):
"""Include the redirector files in the editable wheel."""

def get_implementation(self):
for item in super().get_implementation(): # noqa: UP028
yield item
yield from super().get_implementation()

with open(SITE_PACKAGES / REDIRECTOR_PTH) as f:
yield (REDIRECTOR_PTH, f.read())
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings_12/tests/nvml/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_devices_are_the_same_architecture(all_devices):
# they won't be tested properly. This tests for the (hopefully rare) case
# where a system has devices of different architectures and produces a warning.

all_arches = set(nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices)
all_arches = {nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices}

if len(all_arches) > 1:
warnings.warn( # noqa: B028
Expand Down
3 changes: 2 additions & 1 deletion cuda_bindings_13/cuda/bindings/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

from ._envvar import envvar_bool
from ._nvvm_utils import check_nvvm_compiler_options
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings_13/cuda/bindings/utils/_nvvm_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

from typing import Sequence
from collections.abc import Sequence

_PRECHECK_NVVM_IR = """target triple = "nvptx64-unknown-cuda"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
Expand Down
3 changes: 2 additions & 1 deletion cuda_core/cuda/core/utils/_program_cache/_file_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
import tempfile
import threading
import time
from collections.abc import Callable, Iterable
from pathlib import Path
from typing import Any, Callable, Iterable
from typing import Any

from cuda.core._module import ObjectCode
from cuda.core.utils._cache_dir import _default_cache_dir as _user_cache_dir
Expand Down
3 changes: 2 additions & 1 deletion cuda_core/cuda/core/utils/_program_cache/_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import abc
import collections.abc
import hashlib
from typing import Any, Callable, Sequence
from collections.abc import Callable, Sequence
from typing import Any

# Mutual-dependency contract: this module imports ProgramOptions from
# cuda.core._program at module level, and cuda.core._program imports
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/tests/graph/test_graph_node_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import threading
import time
import weakref
from collections.abc import Callable
from dataclasses import dataclass
from typing import Callable

import pytest
from helpers.graph_kernels import compile_common_kernels
Expand Down
5 changes: 0 additions & 5 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ select = [
]

ignore = [
# typing backward compat — support older Python versions
"UP006", # non-pep585-annotation (e.g. Dict vs dict)
"UP007", # non-pep604-annotation (e.g. Union[X, Y] vs X | Y)
"UP035", # deprecated-import from typing

# security rules too strict for this project
"S311", # allow random.* (not cryptographic)
"S404", # allow subprocess imports
Expand Down
13 changes: 6 additions & 7 deletions samples/cuda_core/greenContext/greenContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import sys
import time
from dataclasses import dataclass
from typing import List, Tuple

import numpy as np

Expand Down Expand Up @@ -142,7 +141,7 @@ def _driver_accepts_split(sm, long_count: int, critical_count: int) -> bool:
return actual == (long_count, critical_count)


def _find_working_split(sm, prefer_critical: int | None = None) -> Tuple[int, int, int] | None:
def _find_working_split(sm, prefer_critical: int | None = None) -> tuple[int, int, int] | None:
"""
Probe the driver for a (long, critical) split it actually accepts.

Expand Down Expand Up @@ -174,14 +173,14 @@ def _find_working_split(sm, prefer_critical: int | None = None) -> Tuple[int, in
while granularity * 2 <= total:
base = max(granularity, _align_down(prefer_critical, granularity))

candidates: List[int] = []
candidates: list[int] = []
seen = set()

# Default-arg binding captures the current loop iteration's values
# (granularity, seen, candidates). push is never stored — it's only
# called in this same iteration — but the explicit binding silences
# ruff B023 and documents the intent.
def push(c: int, granularity: int = granularity, seen: set = seen, candidates: List[int] = candidates) -> None:
def push(c: int, granularity: int = granularity, seen: set = seen, candidates: list[int] = candidates) -> None:
if c >= granularity and c <= total - granularity and c not in seen:
seen.add(c)
candidates.append(c)
Expand Down Expand Up @@ -218,7 +217,7 @@ def _format_suggestion(sm, prefer_critical: int | None) -> str | None:
return f"--split {long_count},{critical_count}"


def parse_split(arg: str | None, device: Device) -> Tuple[int, int]:
def parse_split(arg: str | None, device: Device) -> tuple[int, int]:
"""
Parse the --split "A,B" CLI argument and validate it against the device.

Expand Down Expand Up @@ -487,7 +486,7 @@ def run_baseline(

def run_green_context(
device: Device,
split: Tuple[int, int],
split: tuple[int, int],
delay_kernel,
critical_kernel,
delay_cycles: int,
Expand Down Expand Up @@ -548,7 +547,7 @@ def _fmt_ms(value: float | None, width: int) -> str:
return f"{value:>{width}.3f}"


def print_results(results: List[ScenarioResult]) -> None:
def print_results(results: list[ScenarioResult]) -> None:
print()
header = f"{'scenario':<32}{'SMs (long/crit)':>20}{'long (ms)':>14}{'crit total (ms)':>18}{'crit offset (ms)':>19}"
print(header)
Expand Down
7 changes: 3 additions & 4 deletions samples/cuda_core/processCheckpoint/processCheckpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import sys
import time
from dataclasses import dataclass
from typing import List

import numpy as np

Expand Down Expand Up @@ -118,7 +117,7 @@ def _time_call(fn, *args, **kwargs) -> float:
return (time.monotonic() - t0) * 1000.0


def run_lifecycle(proc: checkpoint.Process, lock_timeout_ms: int) -> List[StepTiming]:
def run_lifecycle(proc: checkpoint.Process, lock_timeout_ms: int) -> list[StepTiming]:
"""
Drive the full `lock -> checkpoint -> restore -> unlock` cycle on
`proc` and return per-step timings with the state observed after
Expand All @@ -128,7 +127,7 @@ def run_lifecycle(proc: checkpoint.Process, lock_timeout_ms: int) -> List[StepTi
the `locked` state. You must still call `unlock()` to return to
`running`.
"""
timings: List[StepTiming] = [StepTiming("initial", 0.0, proc.state)]
timings: list[StepTiming] = [StepTiming("initial", 0.0, proc.state)]

ms = _time_call(proc.lock, timeout_ms=lock_timeout_ms)
timings.append(StepTiming("lock", ms, proc.state))
Expand All @@ -145,7 +144,7 @@ def run_lifecycle(proc: checkpoint.Process, lock_timeout_ms: int) -> List[StepTi
return timings


def print_timings(timings: List[StepTiming]) -> None:
def print_timings(timings: list[StepTiming]) -> None:
print()
header = f"{'step':<14}{'duration (ms)':>18}{'state after':>18}"
print(header)
Expand Down
2 changes: 1 addition & 1 deletion toolshed/find_skipped_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import subprocess
import sys
import tempfile
from collections.abc import Iterable
from pathlib import Path
from typing import Iterable

# Workflows to inspect, with the gh-api filter used to find the latest
# completed run for each. The order here determines report ordering.
Expand Down
Loading