Skip to content

fix(pathfinder): remove dead/misleading error handling in platform loaders#2239

Open
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:fix/pathfinder-loader-diagnostics
Open

fix(pathfinder): remove dead/misleading error handling in platform loaders#2239
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:fix/pathfinder-loader-diagnostics

Conversation

@aryanputta

@aryanputta aryanputta commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes two dead error-handling paths in the dynamic-lib platform loaders. Both are unreachable / no-ops today; the Linux one additionally carries a factually wrong message that would mislead anyone debugging a load failure. This aligns with the cuda_pathfinder policy of not masking why discovery/loading failed.

Details

load_dl_linux.load_with_system_search guarded the resolved path with:

abs_path = abs_path_for_dynamic_library(desc.name, handle)
if abs_path is None:
    raise RuntimeError(f"No expected symbol for libname={desc.name!r}")

abs_path_for_dynamic_library never returns None - it returns a resolved path (os.path.join(l_origin, basename)) or raises OSError from dlinfo. So the branch is unreachable, and its message is wrong: it talks about a missing symbol when the only real failure mode is dlinfo path resolution. Dropped the dead branch so the descriptive OSError surfaces directly, and updated the docstring Raises: accordingly.

load_dl_windows.add_dll_directory had:

result = kernel32.AddDllDirectory(dirpath)
if not result:
    # Fallback: just update PATH if AddDllDirectory fails
    pass

The if not result: pass is a no-op - the PATH update below already runs unconditionally. Removed the dead branch and clarified why PATH is updated regardless.

Behavior

No behavior change: both removed branches were unreachable or no-ops.

Testing

ruff check and ruff format --check (v0.15.9, repo-pinned) pass on both changed files.

…aders

Two dead error-handling paths in the dynamic-lib platform loaders:

- load_dl_linux.load_with_system_search guarded abs_path with
  'if abs_path is None: raise RuntimeError("No expected symbol ...")'.
  abs_path_for_dynamic_library never returns None (it returns a resolved
  path or raises OSError), so the branch is unreachable and its message is
  factually wrong (it concerns dlinfo path resolution, not symbols). Drop
  the dead branch and let the descriptive OSError surface, matching the
  deterministic-loader policy of not masking discovery/load failures.

- load_dl_windows.add_dll_directory had 'if not result: pass', a no-op; the
  PATH update below already runs unconditionally. Remove the dead branch and
  clarify the comment on why PATH is updated regardless.

No behavior change: both removed branches were unreachable or no-ops.

Signed-off-by: Aryan <aryansputta@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.pathfinder Everything related to the cuda.pathfinder module label Jun 21, 2026
@aryanputta

Copy link
Copy Markdown
Contributor Author

Note for triage: I can't set labels/milestones as an external contributor. Intended metadata for pr-metadata-check: label cuda.pathfinder, milestone cuda.pathfinder next. Happy to adjust if a different bucket fits better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.pathfinder Everything related to the cuda.pathfinder module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant