From ea2ff6a25bcd07c0ece8445afc14e31479b551a5 Mon Sep 17 00:00:00 2001 From: Rob Parolin Date: Wed, 25 Nov 2026 16:14:13 -0700 Subject: [PATCH] docs(pathfinder): fix two stale references - `AGENTS.md` named `_utils/spawned_process_runner.py`, which was replaced by `_dynamic_libs/dynamic_lib_subprocess.py` in #1777. - A docstring in `load_dl_linux.py` named `LinkMapPrefix`; the class is `_LinkMapLNameView`. Comments and docs only. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Rob Parolin --- cuda_pathfinder/AGENTS.md | 5 +++-- cuda_pathfinder/cuda/pathfinder/__init__.py | 6 +++--- .../pathfinder/_binaries/find_nvidia_binary_utility.py | 7 ++++--- .../cuda/pathfinder/_binaries/supported_nvidia_binaries.py | 3 ++- .../cuda/pathfinder/_dynamic_libs/load_dl_linux.py | 2 +- .../cuda/pathfinder/_dynamic_libs/platform_loader.py | 4 ++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cuda_pathfinder/AGENTS.md b/cuda_pathfinder/AGENTS.md index 271e5797f82c..6fbaa9ff49cf 100644 --- a/cuda_pathfinder/AGENTS.md +++ b/cuda_pathfinder/AGENTS.md @@ -32,8 +32,9 @@ Windows. - `_static_libs/locate_file.py` holds the one search that `find_static_lib.py` and `find_bitcode_lib.py` share. - **Process isolation helper**: - - `cuda/pathfinder/_utils/spawned_process_runner.py` is used where process - global dynamic loader state would otherwise leak across tests. + - `cuda/pathfinder/_dynamic_libs/dynamic_lib_subprocess.py` runs in a fresh + Python process: for the CTK-root canary probe, and for tests where process + global dynamic loader state would otherwise leak. ## Editing guidance diff --git a/cuda_pathfinder/cuda/pathfinder/__init__.py b/cuda_pathfinder/cuda/pathfinder/__init__.py index a64b5ef64c78..d81c058ab5b5 100644 --- a/cuda_pathfinder/cuda/pathfinder/__init__.py +++ b/cuda_pathfinder/cuda/pathfinder/__init__.py @@ -70,8 +70,8 @@ SUPPORTED_HEADERS_CTK = _SUPPORTED_HEADERS_CTK #: Tuple of supported CUDA binary utility names that can be located -#: via ``find_nvidia_binary_utility()``. Platform-aware (e.g., some -#: utilities may be available only on Linux or Windows). +#: via ``find_nvidia_binary_utility()``. The tuple is the same on every +#: platform; some utilities exist only on Linux or only on Windows. #: Example utilities: ``"nvdisasm"``, ``"cuobjdump"``, ``"nvcc"``. SUPPORTED_BINARY_UTILITIES = _SUPPORTED_BINARIES @@ -91,5 +91,5 @@ SUPPORTED_STATIC_LIBS = _SUPPORTED_STATIC_LIBS # Backward compatibility: _find_nvidia_header_directory was added in release 1.2.2. -# It will be removed in release 1.2.4. +# Its removal was planned for release 1.2.4 and has not happened. _find_nvidia_header_directory = find_nvidia_header_directory diff --git a/cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py b/cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py index b5fa3cc8cc30..c40682075990 100644 --- a/cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py +++ b/cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py @@ -175,9 +175,10 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None: Results are cached using ``@functools.cache`` for performance. The cache persists for the lifetime of the process. - On Windows, executables are identified by their file extensions - (``.exe``, ``.bat``, ``.cmd``). On Unix-like systems, executables - are identified by the ``X_OK`` (execute) permission bit. + On Windows, the search looks for ``.exe``. For + ``compute-sanitizer`` and ``ncu`` it tries ``.bat`` + first. On Unix-like systems, a file counts only if it has the + ``X_OK`` (execute) permission bit. Lookup is restricted to the trusted directories and the canary-derived CTK root listed above. diff --git a/cuda_pathfinder/cuda/pathfinder/_binaries/supported_nvidia_binaries.py b/cuda_pathfinder/cuda/pathfinder/_binaries/supported_nvidia_binaries.py index c2f818da6c07..85483656dc1f 100644 --- a/cuda_pathfinder/cuda/pathfinder/_binaries/supported_nvidia_binaries.py +++ b/cuda_pathfinder/cuda/pathfinder/_binaries/supported_nvidia_binaries.py @@ -9,7 +9,8 @@ _NSIGHT_SYSTEMS_BIN = os.path.join("nvidia", "nsight_systems", "bin") _NSIGHT_COMPUTE_BIN = os.path.join("nvidia", "nsight_compute", "bin") -# Common CUDA binary utilities available on both Linux and Windows +# Utility name -> site-packages bin directories to search, in order. +# The table is the same on every platform; some utilities ship for one only. SITE_PACKAGES_BINDIRS = { # Core compilation tools "nvcc": (_CUDA13_BIN, _CUDA_NVCC_BIN), diff --git a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py index 484e5724593a..5552b2296f47 100644 --- a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py +++ b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py @@ -69,7 +69,7 @@ class _LinkMapLNameView(ctypes.Structure): returned by `dlinfo(...)`. - Do **not** instantiate it or pass it **by value** to any C function. - Do **not** access any members beyond those declared here. - - Do **not** rely on `ctypes.sizeof(LinkMapPrefix)` for allocation. + - Do **not** rely on `ctypes.sizeof(_LinkMapLNameView)` for allocation. Rationale: - Defining only the leading fields avoids depending on internal/unstable diff --git a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/platform_loader.py b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/platform_loader.py index 1d65f696f046..283578fcfa84 100644 --- a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/platform_loader.py +++ b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/platform_loader.py @@ -36,6 +36,6 @@ def load_with_abs_path(self, desc: LibDescriptor, found_path: str, found_via: st else: from cuda.pathfinder._dynamic_libs import load_dl_linux as _impl -# The platform modules already expose functions matching the PlatformLoader -# protocol. Wrap in a simple namespace so callers use LOADER.method() syntax. +# LOADER is the platform module itself. Its functions match the PlatformLoader +# protocol, so callers write LOADER.method(). LOADER: PlatformLoader = _impl