Skip to content

Refresh the main integration into 13.4.x again - #2691

Draft
rwgk wants to merge 73 commits into
NVIDIA:13.4.x-merge-main-2026-08-10+0131from
rwgk:13.4.x-merge-main-cont4
Draft

Refresh the main integration into 13.4.x again#2691
rwgk wants to merge 73 commits into
NVIDIA:13.4.x-merge-main-2026-08-10+0131from
rwgk:13.4.x-merge-main-cont4

Conversation

@rwgk

@rwgk rwgk commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

This supersedes the now-frozen #2687 while preserving it as a reference point.

It carries that integration state forward and merges the current public main branch into the 13.4.x release line. The incremental update includes the latest cuda.core fixes and the field-assignment compatibility change from #2688.

The only textual conflict was in generated cuda_bindings output. As in the prior integration PRs, the merge preserves the release branch's complete generated-file tree so it can be regenerated and validated in the subsequent integration step. The #2688 implementation merged cleanly and is identical to public main.

Testing

  • Full pre-commit suite, with generated cuda.core stubs, cuda.core mypy, the temporary check-pixi-cuda-version policy check, and link checking skipped under the established release-branch merge procedure
  • Generated-file seal validation, Ruff, Pathfinder mypy, actionlint, Cython lint, YAML validation, and secret scanning

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

gmanal and others added 30 commits August 11, 2026 14:11
…VIDIA#2589)

Call the centrally maintained NVIDIA/security-workflows security suite rather
than wiring each scan separately: one pinned reference runs the Pulse secret
scan and CodeQL SAST, both explicitly enabled.

Replace .github/workflows/codeql.yml with the suite's SAST scan. Both publish
code scanning results under the category /language:python, so keeping the local
workflow would put two analyses on every commit that overwrite each other's
alerts. The suite performs the same analysis: python, build-mode none,
security-extended queries, on ubuntu-latest.
* fix(cuda.core): avoid truncating graph queries

* perf(cuda.core): retain adjacency stack buffer

* test(cuda.core): cover large predecessor graph queries

Verify exact edge identities so graph query regressions cannot pass through count-only checks.

---------

Co-authored-by: Andy Jost <ajost@nvidia.com>
* Fix Windows binary utility discovery on Arm64

* Clarify binary utility search order

* Expand standalone installation documentation

* Align standalone search step comments

* Preserve literal Nsight launcher lookup

* Cover Windows binary discovery fallbacks

* Document Windows architecture selection

* Harden Windows Arm64 utility discovery

* Fix Windows pre-commit checks

* Fix CUDA path precedence documentation

* Document Windows binary utility discovery

---------

Co-authored-by: Michael Wang <isVoid@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
…VIDIA#2493)

* Migrate _static_libs finders from os.path to pathlib

Part 2 of the series proposed in NVIDIA#2410, following the same conversion
style as part 1 (NVIDIA#2489).

Path construction, joining, and filesystem predicates in
find_static_lib.py and find_bitcode_lib.py now go through pathlib.Path
instead of os.path string manipulation. Both modules keep importing os
solely for os.environ.get("CONDA_PREFIX").

Compatibility is preserved: every entry point still accepts str, and
every function that documents or returns str still returns str. Path is
used strictly as the internal representation and converted back with
str() at each return, so LocatedStaticLib.abs_path, LocatedBitcodeLib
.abs_path, find_static_lib() and find_bitcode_lib() are unchanged in
both type and value. No signature changes.

Signed-off-by: LeSingh1 <sshaurya914@gmail.com>

* Return Path from the _static_libs internals

Follow-up to the review feedback on NVIDIA#2489: the str-compatibility constraint
applies only to the public API.

The try_* methods and _no_such_file_in_dir now work in Path throughout. str()
is applied once, where abs_path is stored on the public LocatedStaticLib and
LocatedBitcodeLib. The relative-path constants go from os.path.join(...) to
forward-slash literals, matching how site_packages_dirs is already written in
the same dicts; Path normalizes the separator on Windows.

One behavior change: a CUDA_PATH or CONDA_PREFIX containing redundant
separators ("//", "/.") now produces a normalized abs_path, because Path
collapses them. Differential fuzzing against the pre-revision code (16k lookups
over randomized trees, comparing located paths and full error text) shows no
other difference, and none at all when those variables are free of redundant
separators.

Signed-off-by: LeSingh1 <sshaurya914@gmail.com>

---------

Signed-off-by: LeSingh1 <sshaurya914@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* chore: fix Apache-2.0 license notice and attribution gaps

An open-source license review flagged several Apache-2.0 compliance gaps.
This addresses three of them, plus the guard that let one class of them
through. Licensing metadata only; no logic changes.

Copyright notices (15 files)
  Two different defects that happened to share a symptom:
  - 14 files under cuda_bindings/examples/ carried a non-standard notice
    ("Copyright 2021-2026 NVIDIA Corporation.  All rights reserved.") with
    no (c), no SPDX-FileCopyrightText prefix, and the wrong entity casing.
  - toolshed/conda_create_for_pathfinder_testing.ps1 had the correct prefix
    and casing but was truncated before "& AFFILIATES. All rights reserved.".
  All now carry the canonical string. Years are preserved as found.

Header guard (toolshed/check_spdx.py)
  COPYRIGHT_REGEX made "& AFFILIATES. All rights reserved." optional, so a
  bare "NVIDIA CORPORATION" satisfied pre-commit. The suffix is now
  required. (The 14 example files were passing for a different reason:
  .spdx-ignore excludes cuda_bindings/examples/ entirely. That exclusion is
  left alone here, but the files now conform, so it can be dropped in a
  follow-up if desired.)

  Tightening the regex surfaced two pre-existing files whose notice was
  split or truncated -- cuda_core/cuda/core/_include/layout.hpp and
  toolshed/build_static_bitcode_input.py. Both are corrected so the
  mandated sentence appears verbatim on one line.

Third-party attribution (cuda_core/NOTICE)
  cuda/core/_include/aoti_shim.h is a vendored subset of PyTorch's AOT
  Inductor stable C ABI, BSD-3-Clause, carrying the upstream Facebook,
  Idiap, Deepmind, NEC and NYU copyright lines, but NOTICE listed only
  DLPack. A PyTorch entry is added with the full copyright block. The
  accompanying aoti_shim.def carries no copyright line of its own and is
  covered explicitly by that entry rather than given an NVIDIA header,
  since it declares the same upstream symbol names. The DLPack entry now
  also records where it is vendored.

LICENSE files (all five)
  Every LICENSE ended at "END OF TERMS AND CONDITIONS", omitting the
  required "APPENDIX: How to apply the Apache License to your work" and
  its boilerplate. Appended to all five. The text is verified identical
  to the canonical Apache 2.0 appendix.

Verified: 0 files with a non-conforming copyright string; check_spdx.py
passes over all 868 in-scope tracked files with the tightened regex.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>

* docs: document per-subproject license files in root README

OSRB (NVBUG 4707569, comment NVIDIA#22) flagged the four sub-component LICENSE
files as redundant with the root LICENSE and asked for either their removal
or a root README Licensing section naming each subproject, its license and
its license path.

Each subproject builds an independent wheel and resolves its license file
relative to its own root, so the copies are kept and documented instead of
removed. Verified that the copies reach the built wheels: building
cuda_pathfinder produces dist-info/licenses/LICENSE even though its
pyproject.toml declares no explicit license-files (setuptools' default
LICEN[CS]E* glob covers it), as is also the case for cuda_core.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: Rob Parolin <rparolin@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…NVIDIA#2496)

* Migrate toolshed and ci helper scripts from os.path to pathlib

Part 7 of the series proposed in NVIDIA#2410.

Path joining and filesystem predicates in the toolshed and ci/tools helper
scripts now go through pathlib. glob.glob in dump_cutile_b64.py becomes
Path.glob, with the mtime key reading Path.stat().

Kept on os.path, with a comment where it is not obvious:

- os.path.abspath in build_static_bitcode_input.py, since sys.path wants a str
  and Path.absolute() does not normalize.
- os.path.isfile in check_generated_file_seals.py. That guard exists to skip
  anything that is not a readable regular file, and Path.is_file() is not a
  drop-in: it propagates OSError for errnos outside pathlib's ignore list
  (EACCES, ENAMETOOLONG) where os.path.isfile returns False.
- os.path.normpath in check_spdx.py, which already carries its own comment.

The plan on NVIDIA#2410 also listed a root conftest.py; there is no such file. The
three conftest.py files live under cuda_pathfinder, cuda_core and
cuda_bindings, and none of them use os.path.

Verified locally: ci/tools/tests/test_check_release_notes.py passes (42
tests), and check_spdx.py and check_generated_file_seals.py produce output
identical to the pre-change scripts when run over every tracked .py file.

Signed-off-by: LeSingh1 <sshaurya914@gmail.com>

* Return Path from notes_path; use Path.is_file in seal checker

Per review: treat these helper scripts as private, so notes_path can return
Path and drop the str/Path round-trip at its call site. Accept the behavioral
change from os.path.isfile to Path.is_file in check_generated_file_seals.

* Review: thread Path through check_release_notes, drop remaining os.path

Follow-up to mdboom's review.

- repo_root is now a Path end to end: load_backport_branch, check_release_notes
  and validate_backport_decision take Path, and --repo-root parses with
  type=Path. That removes the Path(repo_root) re-wrap inside the functions and
  the 19 str(tmp_path) conversions the tests needed to call them. The five
  main() argv lists keep str(): those are command-line strings, which argparse
  then turns back into a Path.
- build_static_bitcode_input: the last os.path use (os.path.abspath) becomes
  Path.resolve(); the os import is now unused and is dropped.

---------

Signed-off-by: LeSingh1 <sshaurya914@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
def supportsCudaAPI(name):
        return name in dir(cuda) or dir(cudart)

parses as `(name in dir(cuda)) or dir(cudart)`. `dir(cudart)` is a non-empty
list for any module, so it is unconditionally truthy and the function returns
a truthy value for every input, including names that exist nowhere.

The left operand is dead too: `cuda` is cuda.bindings.driver and every name
passed in is a cudaXxx runtime symbol. cudaGraphGetId, cudaGreenCtxCreate,
cudaDeviceGetExecutionCtx and cudaGraphConditionalHandleCreate are all defined
in runtime.pyx and appear nowhere in driver.pyx, so `name in dir(cuda)` is
always False and the result is always the `dir(cudart)` list.

Consequence: `not supportsCudaAPI(...)` is always False, so the API-presence
half of all 17 skipif guards that use it (lines 1443-1954) never fires. On a
build whose bindings genuinely lack the API, the test runs and dies with
AttributeError instead of skipping; only the driver_version_less_than() half
of each guard does any work.

Adds test_supportsCudaAPI, pinning all three cases: a runtime-only name, a
driver-only name, and a name that exists in neither. The last two fail before
this change.
* Catch up to current cybind main

* Bugfix for get_buffer_pointer
…VIDIA#2560)

def supports_nvlink(device):
        fields = nvml.FieldValue(1)
        fields[0].field_id = nvml.FI.DEV_NVLINK_GET_STATE

There is no `FI` attribute on cuda.bindings.nvml. The enum is `FieldId`
(nvml.pyx:1229), with DEV_NVLINK_GET_STATE at nvml.pyx:1454, and the sibling
test uses the correct spelling: test_nvlink.py:19 does
`fields[0].field_id = nvml.FieldId.DEV_NVLINK_LINK_COUNT`.

So the helper raises AttributeError on its first line of real work. Nobody
has noticed because it has no callers -- a repo-wide grep for
`supports_nvlink` finds only its own definition. Contrast util.supports_ecc,
which is called from test_page_retirement.py.

Adds tests/nvml/test_util.py, which stubs nvml.device_get_field_values so the
helper can be exercised without an NVLink-capable device, and asserts both
that it returns True and that it queried FieldId.DEV_NVLINK_GET_STATE. It
fails with AttributeError before this change.
…lue (NVIDIA#2535)

`cuda/core/__init__.py` reads `CUDA_CORE_DONT_FIX_TAB_COMPLETION` with a
bare `int(os.environ.get(..., "0"))` at import time. `int()` raises for any
value that is not a base-10 integer, and `os.environ.get` returns the empty
string (not the `"0"` default) when the variable is set but empty, so:

    export CUDA_CORE_DONT_FIX_TAB_COMPLETION=
    python -c "import cuda.core"
    ValueError: invalid literal for int() with base 10: ''

Clearing a variable with `export VAR=` is the usual way to neutralize it in
a shell profile, a Dockerfile, or a CI job spec, and `=true` / `=yes` are
the obvious guesses for a boolean-looking opt-out. All of them make the
whole package unimportable, which is a hard failure for a knob whose only
purpose is to skip an optional `rlcompleter` patch.

Parse the value leniently instead. Integer values keep their existing
meaning (non-zero opts out, so `0` and `00` still install the patch), while
a non-integer, non-empty value is honored as an opt-out rather than being
silently ignored. Unset and empty/whitespace-only both mean "not set".

Also document the variable, which was not listed on the environment
variables page, and drop the stale "only installed in interactive mode"
comment: the interactivity gate was intentionally removed in NVIDIA#2055 ("Always
install the monkeypatch"), so the patch has been unconditional since then.

The new parametrized test asserts the resulting behavior for eight values;
four of them ("", "   ", "true", "yes") fail on main because the subprocess
exits non-zero with the ValueError above.

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Docstrings across cuda_core still spelled parameter types with the
pre-3.10 typing generics. Replace Union[...] and Optional[...] with the
| form the rest of the package already uses, e.g. `stream : Stream |
None, optional` in _memoryview.pyx.

Docstrings only, so the .pyi changes are the stubgen-pyx output for the
edited .pyx files and no runtime behavior moves. In _module.pyx this also
realigns the max_potential_block_size docstring with its signature, which
already reads int | driver.CUoccupancyB2DSize.

Two code-level spellings stay as they are:

- LinkerHandleT in _linker.pyx is a runtime value, not an annotation.
  _program.pyx builds ProgramHandleT from it with `nvrtc.nvrtcProgram |
  int | LinkerHandleT`, and PEP 604 `|` on the forward-reference strings
  it holds raises TypeError.
- The union_type literal in _process_define_macro is error-message text
  rather than a docstring.

Sequence[...] and Iterable[...] elsewhere in cuda_core are
collections.abc generics and are unaffected.

Signed-off-by: Aryan <aryansputta@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* Use subtests where appropriate everywhere

* Fix test

* Test every fan in a separate subtest

* Recognize skipped pytest subtests in CI logs

* Isolate independent inner test cases

* Narrow the cooler unsupported-call scope

* Contain fan-count failures per device

* Use stable identifiers for device subtests

* Fold nested subtest context managers

* Preserve the existing power-limit getter guard

* Guard memory affinity on pre-Kepler devices

* Keep invalid subtest results contained

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
* Update PR guidance for organization-owned forks

* Clarify agent remote-write policy

* Add fork-aware pull request skill
…handle (NVIDIA#2551)

get_cuda_native_handle() wraps both the registry lookup and the getter call
in one try:

    try:
        return _handle_getters[obj_type](obj)
    except KeyError:
        raise TypeError("Unknown type: " + str(obj_type)) from None

The except clause is meant for "this type has no registered getter", but it
also fires for a KeyError raised *inside* the getter. When that happens the
diagnosis is wrong twice over: the reported type is registered, and
`from None` suppresses the context so the traceback that would show the real
failure is gone.

    >>> _add_cuda_native_handle_getter(Registered, getter_that_raises_keyerror)
    >>> get_cuda_native_handle(Registered())
    TypeError: Unknown type: <class 'Registered'>

Move the getter call out of the try. The unregistered-type path is
unchanged, which the existing test_get_handle_error still covers.
…IA#2563)

discover_benchmarks() goes out of its way to avoid def-time binding, and
says so:

    # Resolve the default inside the call so tests (and embedders) can
    # monkeypatch ``BENCH_DIR`` at the module level - Python binds default
    # args at def-time, so a literal default would ignore later patches.
    if bench_dir is None:
        bench_dir = BENCH_DIR

main() then reintroduces exactly that binding:

    def main(
        *,
        bench_dir: Path = BENCH_DIR,
        default_output: Path = DEFAULT_OUTPUT,
        ...
        registry = discover_benchmarks(bench_dir=bench_dir, ...)

Because main() always passes a non-None bench_dir down, the sentinel branch
in discover_benchmarks() can never be taken on this path, and patching
runner.main.BENCH_DIR - the documented mechanism - has no effect on main().
Same for DEFAULT_OUTPUT.

run_pyperf.py calls main() with no arguments, so this is the production
path. The existing tests patch BENCH_DIR and call discover_benchmarks()
directly, which is why the gap is invisible today.

Apply the same sentinel to both parameters. Explicit arguments keep working
unchanged, so the embedder API is unaffected.

Adds test_main_honors_a_monkeypatched_bench_dir, which patches BENCH_DIR to a
tmp dir holding one bench_*.py and drives main() with --list. It fails before
this change (main() lists the repo's real benchmarks instead).
* cuda.core: Add copy_batch to cuda.core.utils

* fallback for CUDA 12 and type annotations

* be more precise about CUDA requirements

* skip tests on Windows that require managed memory

* rework some tests

* Deduplicate _to_cumemlocation

* add missing file

* address review feedback

* review feedback: don't assume NUMA capabilities

* review feedback: clarify buffer requirements for async batched copies

* review feedback: explicitly reject special default streams

* review feedback: explicitly reject capturing streams

* review feedback: drop warning about unsupported PREFER_OVERLAP_WITH_COMPUTE hint

* review feedback: add missing descriptions for copy options values

* review feedback: align CopyOptions validation with existing practice

* review feedback: drop conditional imports for type checking

* account for CUDA 12/13 driver differences

* CUDA 12: drop rejection of unsupported copy options

* simplify tests
…or (NVIDIA#2463)

* fix(cuda.bindings): make cythonization warning-clean and enable -Werror

Clear the Cython warnings that blocked matching cuda.core's warning_errors
setting (NVIDIA#2450): drop ignored except clauses on Python-returning cudla
cpdefs, declare LOAD_LIBRARY_SEARCH_SYSTEM32 as const in windll.pxd, and
enable Cython Options.warning_errors in build_hooks.

Add source-level regression tests so these patterns do not return.

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* style: ruff-format cython warning cleanliness tests

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* test(cuda.bindings): drop cython warning cleanliness tests

Address review feedback: warning_errors in build_hooks already
guards against Cython warning regressions, so the source-level
tests add unnecessary maintenance cost.

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ed (NVIDIA#2539)

`check_generated_file_seals.py` declares three comment styles for the seal
line, one per generated-file family:

    _COMMENT_CHARS = {".py": b"#", ..., ".rst": b"..", ".c": b"//",
                      ".cpp": b"//", ".h": b"//"}

and `validate_generated_file_seal` compares the seal's captured prefix
against `expected_comment_prefix(filepath)` so a `.rst` file cannot be
sealed with a `#`, and so on. But the marker regex only ever accepts two of
the three:

    rb"^(?P<prefix>#|\.\.) "

`//` can never be captured, so `fullmatch` returns None for any sealed
`.c` / `.cpp` / `.h` file and it is rejected as `MALFORMED generated-file
seal` before the prefix comparison runs at all. The `b"//"` entries in
`_COMMENT_CHARS` and the branch that would validate them are dead.

Add `//` to the alternation, with a note tying it to `_COMMENT_CHARS` so
the two do not drift again.

This also adds the first tests for the script, under `toolshed/tests/`, and
runs them alongside the existing `ci/tools/tests` in the nightly tooling
job. The parametrized case is driven from `_COMMENT_CHARS` itself, so a
future entry whose prefix the regex cannot match fails immediately instead
of silently becoming dead code.
…VIDIA#2526)

* cuda.core: capture bound contexts for buffer deallocation streams

Record a DeallocationStream at device-pointer creation so default-stream tokens pin the allocation context (and PTDS the allocating thread) instead of relying on ambient state at free time.

* cuda.core: activate bound context during device-pointer teardown

Make the deallocation stream's context current around free/unmap/MR cleanup so destruction no longer depends on ambient CUDA context, and wire cuCtxSetCurrent into the resource-handles driver table.

* cuda.core: record from_handle deallocation streams at creation

Add keyword-only stream= on Buffer/ManagedBuffer.from_handle when mr owns the pointer, bind it at construction, and cover teardown with no or foreign current context.

* cuda.core: fail loudly on MemoryResource free errors

Stop treating CUDA_ERROR_INVALID_CONTEXT as a successful pool free, and let
explicit mr.deallocate() raise; destruction still contains errors in the
callback. Document PTDS deallocation ordering on the stream parameters and
note the context-safe Buffer teardown fix in the 1.2.0 release notes.

* cuda.core: reject incomplete buffer deallocation recipes

Require default deallocation streams to bind a current context at creation so teardown never relies on an ambiguous ambient token. Expand coverage and documentation for context-independent cleanup and failure reporting.

* cuda.core: initialize context when unpickling IPC buffers

Ensure spawned children can bind the imported buffer's default deallocation stream before their process target starts.

* test(cuda.core): set a current context in DLPack failure tests

Creating a Buffer with an owning memory resource now records a default
deallocation stream, which requires a current context. These two tests
never set one, so they passed or failed depending on whether the
preceding test left a context current under pytest-randomly.

* test(cuda.core): address review feedback on deallocation-stream PR

- Parametrize test_from_handle_mr_records_default_stream,
  test_from_handle_mr_records_explicit_stream, and
  test_from_handle_stream_requires_mr with [Buffer, ManagedBuffer] to
  cover the ManagedBuffer.from_handle entry point directly.
- Add test_close_with_default_stream_requires_context covering the
  _require_deallocation_stream_context guard in Buffer_close.
- Lift Stream_accept and default_stream to module-level imports.
- Replace _require_deallocation_stream_context (a pre-flight that
  duplicated make_deallocation_stream's context check) with
  _apply_deallocation_stream, which calls set_deallocation_stream once
  and translates CUDA_ERROR_INVALID_CONTEXT into a descriptive
  RuntimeError. Removes the redundant cuCtxGetCurrent call on the
  default-stream success path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…#2618)

* cuda.core: minor refactoring to prepare for copy with options

* inline capability check helper
* ci: add selective wheel test plumbing

* ci: update selective wheel test callers

* ci: enable nightly NumPy for metapackage tests

* ci: install exact local wheels in metapackage tests

* ci: simplify local wheel selection
…ont-update-2026-08-14

# Conflicts:
#	.github/workflows/build-wheel.yml
#	.github/workflows/test-sdist-linux.yml
#	.github/workflows/test-sdist-windows.yml
#	cuda_bindings/cuda/bindings/_internal/cudla.pxd
#	cuda_bindings/cuda/bindings/_internal/cudla_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/cudla_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/driver_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/driver_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/nvfatbin_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/nvjitlink.pxd
#	cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/nvrtc_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/nvrtc_windows.pyx
#	cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
#	cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx
#	cuda_bindings/cuda/bindings/_v2/nvrtc.pxd
#	cuda_bindings/cuda/bindings/_v2/nvrtc.pyx
#	cuda_bindings/cuda/bindings/cudla.pxd
#	cuda_bindings/cuda/bindings/cudla.pyx
#	cuda_bindings/cuda/bindings/cufile.pyx
#	cuda_bindings/cuda/bindings/cycudla.pxd
#	cuda_bindings/cuda/bindings/cycudla.pyx
#	cuda_bindings/cuda/bindings/cydriver.pxd
#	cuda_bindings/cuda/bindings/cynvfatbin.pxd
#	cuda_bindings/cuda/bindings/cynvjitlink.pxd
#	cuda_bindings/cuda/bindings/cynvjitlink.pyx
#	cuda_bindings/cuda/bindings/cynvml.pxd
#	cuda_bindings/cuda/bindings/cynvrtc.pxd
#	cuda_bindings/cuda/bindings/nvfatbin.pxd
#	cuda_bindings/cuda/bindings/nvfatbin.pyx
#	cuda_bindings/cuda/bindings/nvjitlink.pxd
#	cuda_bindings/cuda/bindings/nvjitlink.pyx
#	cuda_bindings/cuda/bindings/nvml.pxd
#	cuda_bindings/cuda/bindings/nvml.pyx
#	cuda_bindings/cuda/bindings/nvrtc.pyx
#	cuda_bindings/cuda/bindings/nvvm.pxd
#	cuda_bindings/cuda/bindings/nvvm.pyx
#	cuda_bindings/docs/source/module/driver.rst
#	cuda_bindings/docs/source/module/nvrtc.rst
#	cuda_bindings/docs/source/module/runtime.rst
#	cuda_bindings/tests/nvml/test_device.py
#	cuda_core/tests/system/test_system_device.py
…2619)

* docs(cuda.core): don't document APIs accept dict for options

* test(cuda.core): use Options dataclasses instead of dicts in MR tests
…NVIDIA#2612)

Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
Co-authored-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
mdboom and others added 21 commits August 19, 2026 14:51
* Upgrade stubgen-pyx to 0.2.19

* ci: show diff on pre-commit failure to diagnose Windows stubgen mismatch

Temporary diagnostic to see what content actually differs when the
stubgen-pyx-cuda-core hook reports modified files on Windows CI.

* Fix Windows encoding issue
# Conflicts:
#	ci/tools/lookup-run-id
#	ci/tools/tests/test_lookup_run_id.py
#	cuda_core/cuda/core/_device.pyi
#	cuda_core/cuda/core/system/_device.pyi
…IA#2671)

* CI: guard public-only automation outside NVIDIA

Skip the remaining CI and coverage roots, including their always-run aggregators, outside NVIDIA. Prevent the public triage labeler from mutating private issues.

* CI: guard public release workflows outside NVIDIA

Gate the release workflow roots so inherited definitions cannot create draft releases or reach external publishing operations in the private repository.
…2458)

* test(cuda_core): capture machine state on the first CUDA OOM

* rewrite and reason checker
* Use CUDA driver for CUDA device enumeration

* Adapt CUDA device enumeration to current main

Update the newer foreign-context test to use the CUDA-visible device count and regenerate the Device stub after applying the original public PR NVIDIA#2533 change.

---------

Co-authored-by: isvoid <isVoid@users.noreply.github.com>
* cuda.core: fix some type signatures that are too generic

* update tests
…nfo is enabled (NVIDIA#2679)

* first version after cleaning unnecessary code

* update _program.pyi

* refactor(cuda.core): move NVRTC debug source helpers onto Program

Keep materialize/unlink next to the Program lifetime that owns the temp file,
instead of as module-level functions.

* test(cuda.core): verify cuda-gdb can list materialized NVRTC debug source

Skip when cuda-gdb is missing, and use shorter {caller}_{kernel}_ temp names.

* test(cuda.core): cover NVRTC debug fallback when temp is unwritable

* test(cuda.core): cover concurrent NVRTC debug temp-file uniqueness
* Isolate CUmemLocation construction in a versioned helper

Build CUmemLocation via field assignment in to_cumemlocation() so cuda.core
compiles against both the 13.3 and 13.4 layouts. The localized arm is an
optional helper argument that exists only when CUDA_VERSION >= 13040.
* Add cuDNN discovery and NCCL header support

  - cuDNN: added dynamic-library loading and header discovery.
  - NCCL: dynamic-library loading already existed; added the missing header discovery.

* Fix cuDNN dynamic loading on Windows

* Complete cuDNN and NCCL header discovery

* Unify dynamic library installation root discovery

* Add cuDNN Windows ARM64 archive discovery

* Fix cross-platform header discovery tests

* Restore forward-compatible Windows DLL discovery

* Register directories for already-loaded dependent DLLs

* Add Linux product-root dynamic library discovery

* Constrain Windows DLL fallback matching

* Pin cython-lint to Cython 3.2.9

* Prefer newest already-loaded Windows DLL

* docs(pathfinder): prepare 1.7.0 release notes

* Use numeric-aware path sort naming

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
…ont3

# Conflicts:
#	cuda_core/cuda/core/_memory/_device_memory_resource.pyx
#	cuda_core/cuda/core/_memory/_location.pxd
#	cuda_core/cuda/core/_memory/_managed_memory_ops.pyx
#	cuda_core/cuda/core/_memory/_memory_pool.pyx
#	cuda_core/cuda/core/_memory/_peer_access_utils.pyx
#	cuda_core/cuda/core/graph/_graph_node.pyx
…de packed gpu_id (NVIDIA#2606)

* fix(cuda.core): declare cdef attrs for system event wrappers and decode packed gpu_id

* chore(cuda.core): soften SystemEvent gpu_id decode helper docs

Keep _system_events.pyi in sync with stubgen-pyx 0.2.19.
* TST: Mark tests as thread-unsafe or limit the number of threads

- thread_unsafe: nvml init ref-count, graphMem attr, mock-based tests,
  OpenGL, peer-access pool state, multiprocessing warning, program-cache
  race reproduction, and functools.cache mutation tests
- parallel_threads_limit: IPC / worker-pool tests that spawn subprocesses
  or open file descriptors (limit 4), example tests (limit 8), and the
  event-registration test whose timeouts are slow

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* TST: use tmp_path fixture in cufile (and mark some as unsafe)

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* TST: Move graph definnitions inline and mark "global" ones as thread-unsafe always

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* TST: Fixup memory tests, mostly work around issue when tearing down mempool

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* TST: Thread unsafe markers for test_managed_ops

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* Avoid interactive backend when using run_tests.sh locally

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* Use indirect fixtures for a nicer pattern and avoid thread issues

After my first AI try was a crazy mess, the second run actually found
a neat solution...
These objects can be created in the main thread, but we can't create
them on the fly in many threads as it was...

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* Make latch-kernel helper compile only once

For some reason the latch kernel helper test started failing now
(it did not before my update from CUDA 13.2 to 13.3?).

The reason isn't that it is not thread-safe, but that something
(presumably module loading/unloading) causes synchronizations which
in turn cause threads having to wait on their LatchKernel to finish.

And of course the test itself really needs that not to happen.
Making sure there is only one LatchKernel compiled and loaded exactly
once seems to avoid this problem.

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>

* Limit threads for event test that otherwise seems to ptentially fail

* TST: Mark device-persistence-mode test as thread-unsafe

* TST: Test fails in CI, assume that few enough threads eventually pass...

* TST: Add another sync to guard against potential deadlocks (seems I missed it)

* TST: Limit threads for another LatchKernel test

* TST: Force test_helpers to single threaded on windows to avoid crash

* TST: Many buffer related tests cannot run threaded on windows

* These tests seem to test process global cleanup (not sure I follow)

* TST: Mark LatchKernel tests as thread-unsafe

Concurrent LatchKernel runs can overlap pinned flag alloc/free across
workers; mark them thread-unsafe until a barrier_wait is restored.
Also drop the compile-once LatchKernel helper changes for now.

* Adopt Andy's review suggestion for comment

---------

Signed-off-by: Sebastian Berg <sebastianb@nvidia.com>
* cuda.core: reject operations on closed resources

Add consistent liveness checks so closed handles cannot reach CUDA as valid resources, including graph and cross-object operations.

* test(cuda.core): skip POSIX IPC handle test on Windows

The allocation-handle constructor is intentionally unsupported on Windows, so limit its close-state test to supported platforms.

* test(cuda.core): use shared instrumentation for closed streams

* cuda.core: expose named resource state without changing truthiness

Replace lifecycle-dependent truthiness with explicit is_closed and is_valid properties while preserving the historical truth value of cuda.core objects.

* cuda.core: inline resource state validation

Centralize open and valid state checks so hot Cython call paths use one consistent implementation.

* test(cuda.core): align closed context error check

Expect the shared Context checker message so the green-context test matches the standardized validation path.

* cuda.core: regenerate resource state type stubs

Keep generated type information aligned with the rebased lifecycle APIs.

* WIP: address closed-resource review feedback
…in tests (NVIDIA#2657)

* test(cuda.core): synchronize IPC buffer initialization

Ensure the exporting process completes asynchronous allocation and initialization before an importing child accesses the shared buffer.

* fix(cuda.core): use consistent streams for async allocations

Require PatternGen callers and affected examples/tests to preserve stream ordering, adding explicit synchronization only across host and IPC boundaries.
DLPack places a tensor's first element at data + byte_offset, but
view_as_dlpack set StridedMemoryView.ptr from data alone. A producer
that reports the allocation base in data and expresses a slice as
byte_offset therefore produced a view pointing byte_offset bytes before
the tensor, with nothing raised. The offset was also lost permanently on
a round-trip, because the __dlpack__ re-export writes ptr back out as
data with byte_offset = 0.

The capsule-consuming importer in the same module already folds
byte_offset in, so the two import paths disagreed about the same
capsule. This makes view_as_dlpack match it.

Closes NVIDIA#2592

Signed-off-by: Vyron Vasileiadis <hi@fedonman.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
…ont4

# Conflicts:
#	cuda_bindings/cuda/bindings/nvml.pyx
@rwgk rwgk added this to the cuda.bindings 13.4.0 & 12.9.8 milestone Aug 24, 2026
@rwgk rwgk added enhancement Any code-related improvements P0 High priority - Must do! CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module cuda.pathfinder Everything related to the cuda.pathfinder module labels Aug 24, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@rwgk rwgk self-assigned this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module cuda.pathfinder Everything related to the cuda.pathfinder module enhancement Any code-related improvements P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.