Skip to content
Open
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 @@ -18,7 +18,6 @@

from cuda.pathfinder._dynamic_libs.lib_descriptor import LibDescriptor
from cuda.pathfinder._dynamic_libs.load_dl_common import DynamicLibNotFoundError
from cuda.pathfinder._dynamic_libs.supported_nvidia_libs import is_suppressed_dll_file
from cuda.pathfinder._utils.find_sub_dirs import find_sub_dirs_all_sitepackages
from cuda.pathfinder._utils.found_via import FOUND_VIA_SITE_PACKAGES
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
Expand Down Expand Up @@ -153,8 +152,6 @@ def _find_descriptor_dll_under_dir(
def candidate_is_usable(path: str) -> bool:
if not os.path.isfile(path):
return False
if is_suppressed_dll_file(os.path.basename(path)):
return False
return target_arch is None or windows_pe_matches_arch(path, target_arch)

for dll_basename in desc.windows_dlls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,3 @@
else:
assert IS_WINDOWS_ARM64
SUPPORTED_LIBNAMES = SUPPORTED_LIBNAMES_WINDOWS_ARM64


def is_suppressed_dll_file(path_basename: str) -> bool:
if path_basename.startswith("nvrtc"):
# nvidia_cuda_nvrtc_cu12-12.8.93-py3-none-win_amd64.whl:
# nvidia\cuda_nvrtc\bin\
# nvrtc-builtins64_128.dll
# nvrtc64_120_0.alt.dll
# nvrtc64_120_0.dll
return path_basename.endswith(".alt.dll") or "-builtins" in path_basename
return path_basename.startswith(("cudart32_", "nvvm32"))
13 changes: 13 additions & 0 deletions cuda_pathfinder/tests/test_descriptor_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,16 @@ 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", "cudnn"}


@pytest.mark.agent_authored(model="claude-fable-5-2")
def test_no_windows_dll_name_is_a_helper_or_32_bit_file():
"""The DLL search used to skip these file kinds at run time. The catalog must never name one."""

def is_helper_or_32_bit_file(dll_name: str) -> bool:
if dll_name.startswith("nvrtc"):
return dll_name.endswith(".alt.dll") or "-builtins" in dll_name
return dll_name.startswith(("cudart32_", "nvvm32"))

named = [dll for spec in DESCRIPTOR_CATALOG for dll in spec.windows_dlls if is_helper_or_32_bit_file(dll)]
assert named == []
6 changes: 0 additions & 6 deletions cuda_pathfinder/tests/test_search_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def test_found_windows(self, mocker, tmp_path):
f"{_PLAT_MOD}.find_sub_dirs_all_sitepackages",
return_value=[str(bin_dir)],
)
mocker.patch(f"{_PLAT_MOD}.is_suppressed_dll_file", return_value=False)

desc = _make_desc(
name="cudart",
Expand Down Expand Up @@ -400,7 +399,6 @@ def test_found_windows_arm64_prefers_cuda13_arch_dir_to_cuda12(self, mocker, tmp
arm64_dll.touch()

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

desc = LIB_DESCRIPTORS["cudart"]
result = find_in_site_packages(_ctx(desc, windows_arch="arm64"))
Expand All @@ -422,7 +420,6 @@ def test_found_windows_x64_prefers_cuda13_arch_dir_to_cuda12(self, mocker, tmp_p
(cuda12_dir / "cudart64_12.dll").touch()

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

desc = LIB_DESCRIPTORS["cudart"]
result = find_in_site_packages(_ctx(desc, windows_arch="x64"))
Expand All @@ -438,7 +435,6 @@ def test_found_windows_x64_uses_cuda12_when_cuda13_is_absent(self, mocker, tmp_p
cuda12_dll.touch()

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

desc = LIB_DESCRIPTORS["cudart"]
result = find_in_site_packages(_ctx(desc, windows_arch="x64"))
Expand All @@ -453,7 +449,6 @@ def test_found_windows_arm64_skips_cuda12_when_cuda13_is_absent(self, mocker, tm
(cuda12_dir / "cudart64_12.dll").touch()

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

desc = LIB_DESCRIPTORS["cudart"]
ctx = _ctx(desc, windows_arch="arm64")
Expand Down Expand Up @@ -487,7 +482,6 @@ def test_cudnn_wheel_architecture_and_archive_fallback(
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(
Expand Down
Loading