Skip to content

Commit 53bf0ae

Browse files
committed
pathfinder: preload NVRTC builtins for all CTK versions on Linux
Remove the (13, 6) version gate: the builtins preload is harmless for NVRTC versions that can find their own builtins (the file still exists next to the library), so the cutoff just adds fragile version knowledge. Drop the int() conversion in the else branch since there is no longer a numeric comparison to perform. Also update the 1.9.0 release note to drop the "before 13.6" language.
1 parent 2dbc82d commit 53bf0ae

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,14 @@ def _preload_nvrtc_builtins(found_path: str, found_via: str | None) -> None:
193193
return
194194
major, minor = 13, 0
195195
else:
196-
# CTK filenames encode the version; 13.6 fixes the sibling lookup.
197196
if len(version) < 2 or not (version[0].isdigit() and version[1].isdigit()):
198197
warnings.warn(
199198
f"Cannot determine the NVRTC version from {os.path.realpath(found_path)}; not preloading its builtins",
200199
RuntimeWarning,
201200
stacklevel=2,
202201
)
203202
return
204-
major, minor = int(version[0]), int(version[1])
205-
if (major, minor) >= (13, 6):
206-
return
203+
major, minor = version[0], version[1]
207204
sibling = os.path.join(os.path.dirname(found_path), f"libnvrtc-builtins.so.{major}.{minor}")
208205
if not os.path.isfile(sibling):
209206
if found_via != "site-packages":

‎cuda_pathfinder/docs/source/release/1.9.0-notes.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Bugfixes
3434
(`Issue #3413 <https://github.com/NVIDIA/cuda-python/issues/3413>`_,
3535
`PR #3418 <https://github.com/NVIDIA/cuda-python/pull/3418>`_)
3636

37-
* On Linux, preload the matching ``libnvrtc-builtins.so.<major>.<minor>`` next
38-
to an NVRTC from a CUDA Toolkit before 13.6, so that compilation works
39-
without ``LD_LIBRARY_PATH`` or an ``ldconfig`` entry for the toolkit
40-
directory. NVRTC 13.6 finds its builtins itself; wheels keep only the
41-
existing NVRTC 13.0 workaround, and Conda packages are left unchanged.
37+
* On Linux, preload ``libnvrtc-builtins.so.<major>.<minor>`` from the same
38+
directory as NVRTC when loading from a CUDA Toolkit install, so that
39+
compilation works without ``LD_LIBRARY_PATH`` or an ``ldconfig`` entry
40+
for the toolkit directory. Wheels keep only the existing NVRTC 13.0
41+
workaround, and Conda packages are left unchanged.
4242
(`Issue #830 <https://github.com/NVIDIA/cuda-python/issues/830>`_,
4343
`PR #3439 <https://github.com/NVIDIA/cuda-python/pull/3439>`_)
4444

‎cuda_pathfinder/tests/test_load_dl_linux.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,11 @@ def _make_nvrtc_dir(tmp_path, nvrtc_file, *builtins_files):
9595
[
9696
("CUDA_PATH", "libnvrtc.so.13.5.37", "libnvrtc-builtins.so.13.5", True),
9797
("system-ctk-root", "libnvrtc.so.12.9.86", "libnvrtc-builtins.so.12.9", True),
98-
("CUDA_PATH", "libnvrtc.so.13.6.0", "libnvrtc-builtins.so.13.6", False),
9998
("site-packages", "libnvrtc.so.13", "libnvrtc-builtins.so.13.0", True),
10099
("site-packages", "libnvrtc.so.13", "libnvrtc-builtins.so.13.5", False),
101100
("conda", "libnvrtc.so.13.5.37", "libnvrtc-builtins.so.13.5", False),
102101
],
103-
ids=["ctk-13.5", "ctk-12.9", "ctk-13.6", "wheel-13.0", "wheel-13.5", "conda-13.5"],
102+
ids=["ctk-13.5", "ctk-12.9", "wheel-13.0", "wheel-13.5", "conda-13.5"],
104103
)
105104
def test_preload_nvrtc_builtins_policy(mocker, tmp_path, found_via, nvrtc_file, builtins_file, expect_preload):
106105
nvrtc_path = _make_nvrtc_dir(tmp_path, nvrtc_file, builtins_file)

0 commit comments

Comments
 (0)