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
5 changes: 3 additions & 2 deletions cuda_pathfinder/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions cuda_pathfinder/cuda/pathfinder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 ``<utility_name>.exe``. For
``compute-sanitizer`` and ``ncu`` it tries ``<utility_name>.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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading