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
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,21 @@ class DescriptorSpec:
linux_sonames=("libcudnn.so.9",),
windows_dlls=("cudnn64_9.dll",),
supported_windows_arch=("x64", "arm64"),
# Skip DLLs that do not match the running Python interpreter's architecture,
# allowing the search to continue to a compatible installation.
requires_windows_binary_arch_check=True,
site_packages_linux=("nvidia/cudnn/lib",),
site_packages_windows=WindowsSearchDirs.x64_only("nvidia/cudnn/bin"),
site_packages_windows=WindowsSearchDirs(
x64=("nvidia/cudnn/bin",),
arm64=("nvidia/cudnn/bin",),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
),
dependencies=("cublasLt",),
optional_dependencies=("nvrtc",),
install_root_env_vars_linux=("CUDNN_PATH",),
install_root_env_rel_dirs_linux=("lib", "lib64"),
# The ARM64 layout is verified only for the standalone archive rooted
# at CUDNN_PATH, not for conda, CUDA_PATH, or Program Files installs.
# The ARM64 layouts are verified only for the nvidia-cudnn-cu13 wheel and
# the standalone archive rooted at CUDNN_PATH, not for conda, CUDA_PATH,
# or Program Files installs.
anchor_rel_dirs_windows=WindowsSearchDirs.x64_only("bin/x64", "bin"),
install_root_env_vars_windows=("CUDNN_PATH",),
install_root_env_rel_dirs_windows=WindowsSearchDirs(
Expand Down
4 changes: 4 additions & 0 deletions cuda_pathfinder/docs/nv-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "latest",
"url": "https://nvidia.github.io/cuda-python/cuda-pathfinder/latest/"
},
{
"version": "1.9.1",
"url": "https://nvidia.github.io/cuda-python/cuda-pathfinder/1.9.1/"
},
{
"version": "1.9.0",
"url": "https://nvidia.github.io/cuda-python/cuda-pathfinder/1.9.0/"
Expand Down
19 changes: 19 additions & 0 deletions cuda_pathfinder/docs/source/release/1.9.1-notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
.. SPDX-License-Identifier: Apache-2.0

.. py:currentmodule:: cuda.pathfinder

``cuda-pathfinder`` 1.9.1 Release notes
=======================================

Highlights
----------

* Find cuDNN installed from the ``nvidia-cudnn-cu13`` Windows Arm64 wheel.
The wheel places ``cudnn64_9.dll`` in ``nvidia/cudnn/bin``, the same
directory as the x64 wheel, which ``load_nvidia_dynamic_lib("cudnn")``
previously searched on x64 only. Windows cuDNN discovery checks the DLL's
architecture so that an incompatible wheel does not prevent searching
later installation roots. Conda, ``CUDA_PATH``, and Program Files installs
remain x64-only on Windows Arm64.
(`PR #3489 <https://github.com/NVIDIA/cuda-python/pull/3489>`_)
9 changes: 6 additions & 3 deletions cuda_pathfinder/tests/test_descriptor_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def test_cudnn_metadata_matches_supported_layouts():
assert spec.windows_dlls == ("cudnn64_9.dll",)
assert spec.supported_windows_arch == ("x64", "arm64")
assert spec.site_packages_linux == ("nvidia/cudnn/lib",)
assert spec.site_packages_windows == WindowsSearchDirs.x64_only("nvidia/cudnn/bin")
assert spec.site_packages_windows == WindowsSearchDirs(
x64=("nvidia/cudnn/bin",),
arm64=("nvidia/cudnn/bin",),
)
assert spec.anchor_rel_dirs_windows == WindowsSearchDirs.x64_only("bin/x64", "bin")
assert spec.dependencies == ("cublasLt",)
assert spec.optional_dependencies == ("nvrtc",)
Expand Down Expand Up @@ -203,7 +206,7 @@ def test_only_ctk_libs_define_ctk_root_canary_anchors(spec: DescriptorSpec):


@pytest.mark.agent_authored(model="gpt-5")
def test_only_nvvm_requires_windows_binary_arch_check():
def test_windows_binary_arch_checks_cover_architecture_neutral_layouts():
checked_libs = {spec.name for spec in DESCRIPTOR_CATALOG if spec.requires_windows_binary_arch_check}

assert checked_libs == {"nvvm"}
assert checked_libs == {"nvvm", "cudnn"}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def test_cudnn_arm64_archive_layout_reaches_loader(tmp_path, mocker, monkeypatch
dll.touch()
monkeypatch.delenv("CONDA_PREFIX", raising=False)
monkeypatch.setenv("CUDNN_PATH", str(tmp_path))
mocker.patch("cuda.pathfinder._dynamic_libs.search_platform.find_sub_dirs_all_sitepackages", return_value=[])
mocker.patch("cuda.pathfinder._dynamic_libs.search_platform.windows_pe_matches_arch", return_value=True)

desc = load_mod.LIB_DESCRIPTORS["cudnn"]
ctx = SearchContext(desc, platform=WindowsSearchPlatform(target_arch="arm64"))
Expand Down
53 changes: 44 additions & 9 deletions cuda_pathfinder/tests/test_search_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def test_found_windows(self, mocker, tmp_path):
def test_windows_exact_names_reject_cudnn_sidecar(self, mocker, tmp_path):
bin_dir = tmp_path / "nvidia" / "cudnn" / "bin"
bin_dir.mkdir(parents=True)
(bin_dir / "cudnn_adv64_9.dll").touch()
_write_pe(bin_dir / "cudnn_adv64_9.dll", windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["x64"])

mocker.patch(
f"{_PLAT_MOD}.find_sub_dirs_all_sitepackages",
Expand Down Expand Up @@ -471,6 +471,41 @@ def test_found_windows_arm64_skips_cuda12_when_cuda13_is_absent(self, mocker, tm

assert result is None

@pytest.mark.parametrize(
("target_arch", "wheel_arch", "expected_source"),
(
("x64", "x64", "site-packages"),
("arm64", "arm64", "site-packages"),
("arm64", "x64", "CUDNN_PATH"),
),
)
@pytest.mark.agent_authored(model="gpt-6")
def test_cudnn_wheel_architecture_and_archive_fallback(
self, mocker, tmp_path, target_arch, wheel_arch, expected_source
):
wheel_dir = tmp_path / "nvidia" / "cudnn" / "bin"
wheel_dir.mkdir(parents=True)
cudnn_dll = wheel_dir / "cudnn64_9.dll"
_write_pe(cudnn_dll, windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH[wheel_arch])

archive_root = tmp_path / "archive"
archive_dll = archive_root / "bin" / target_arch / "cudnn64_9.dll"
archive_dll.parent.mkdir(parents=True)
_write_pe(archive_dll, windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH[target_arch])
mocker.patch.dict(os.environ, {"CUDNN_PATH": str(archive_root)})

_patch_site_packages_search(mocker, tmp_path)
mocker.patch(f"{_PLAT_MOD}.is_suppressed_dll_file", return_value=False)

desc = LIB_DESCRIPTORS["cudnn"]
result = run_find_steps(
_ctx(desc, platform=WindowsSearchPlatform(target_arch=target_arch)),
(find_in_site_packages, find_in_install_root_env_vars),
)

expected_dll = cudnn_dll if expected_source == "site-packages" else archive_dll
assert result == FindResult(str(expected_dll), expected_source)

def test_not_found_appends_error(self, mocker, tmp_path):
empty_dir = tmp_path / "nvidia" / "cuda_runtime" / "lib"
empty_dir.mkdir(parents=True)
Expand Down Expand Up @@ -810,7 +845,7 @@ def test_cudnn_path_finds_supported_archive_layouts(self, mocker, tmp_path, targ
bin_dir = tmp_path / archive_bin_rel_dir
bin_dir.mkdir(parents=True)
dll = bin_dir / "cudnn64_9.dll"
dll.touch()
_write_pe(dll, windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH[target_arch])
mocker.patch.dict(os.environ, {"CUDNN_PATH": str(tmp_path)})

result = find_in_install_root_env_vars(
Expand All @@ -831,7 +866,7 @@ def test_cudnn_path_finds_supported_archive_layouts(self, mocker, tmp_path, targ
def test_cudnn_path_does_not_cross_architectures(self, mocker, tmp_path, target_arch, other_arch_bin_rel_dir):
bin_dir = tmp_path / other_arch_bin_rel_dir
bin_dir.mkdir(parents=True)
(bin_dir / "cudnn64_9.dll").touch()
_write_pe(bin_dir / "cudnn64_9.dll", windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH[target_arch])
mocker.patch.dict(os.environ, {"CUDNN_PATH": str(tmp_path)})

result = find_in_install_root_env_vars(
Expand All @@ -845,9 +880,9 @@ def test_program_files_finds_versioned_cudnn_install(self, mocker, tmp_path):
bin_dir = tmp_path / "NVIDIA" / "CUDNN" / "v9.24" / "bin"
x64_bin_dir = bin_dir / "x64"
x64_bin_dir.mkdir(parents=True)
(x64_bin_dir / "cudnn_adv64_9.dll").touch()
_write_pe(x64_bin_dir / "cudnn_adv64_9.dll", windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["x64"])
dll = bin_dir / "cudnn64_9.dll"
dll.touch()
_write_pe(dll, windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["x64"])
mocker.patch.dict(os.environ, {"PROGRAMFILES": str(tmp_path), "PROGRAMW6432": ""})

result = find_in_program_files_roots(
Expand All @@ -862,9 +897,9 @@ def test_program_files_prefers_newest_numeric_cudnn_version_across_layouts(self,
newer_dir = tmp_path / "NVIDIA" / "CUDNN" / "v9.10" / "bin"
older_dir.mkdir(parents=True)
newer_dir.mkdir(parents=True)
(older_dir / "cudnn64_9.dll").touch()
_write_pe(older_dir / "cudnn64_9.dll", windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["x64"])
newer_dll = newer_dir / "cudnn64_9.dll"
newer_dll.touch()
_write_pe(newer_dll, windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["x64"])
mocker.patch.dict(os.environ, {"PROGRAMFILES": str(tmp_path), "PROGRAMW6432": ""})

result = find_in_program_files_roots(
Expand All @@ -884,7 +919,7 @@ def test_cudnn_arm64_archive_layout_is_not_assumed_for_other_roots(self, mocker,
program_files_root / "NVIDIA" / "CUDNN" / "v9.25" / "bin" / "arm64",
):
bin_dir.mkdir(parents=True)
(bin_dir / "cudnn64_9.dll").touch()
_write_pe(bin_dir / "cudnn64_9.dll", windows_arch_mod.WINDOWS_PE_MACHINE_BY_ARCH["arm64"])
mocker.patch.dict(
os.environ,
{
Expand All @@ -899,7 +934,7 @@ def test_cudnn_arm64_archive_layout_is_not_assumed_for_other_roots(self, mocker,
assert find_in_conda(ctx) is None
assert find_in_cuda_path(ctx) is None
assert find_in_program_files_roots(ctx) is None
assert ctx.platform.site_packages_rel_dirs(ctx.desc) == ()
assert ctx.platform.site_packages_rel_dirs(ctx.desc) == ("nvidia/cudnn/bin",)


# ---------------------------------------------------------------------------
Expand Down
Loading