Skip to content

refactor(pathfinder): author candidates in search order - #2708

Merged
rwgk merged 3 commits into
NVIDIA:mainfrom
rwgk:pathfinder_catalog_order_search_order_cleanup
Aug 27, 2026
Merged

refactor(pathfinder): author candidates in search order#2708
rwgk merged 3 commits into
NVIDIA:mainfrom
rwgk:pathfinder_catalog_order_search_order_cleanup

Conversation

@rwgk

@rwgk rwgk commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #2689 and the ordering discussion in
#2689 (comment).

Pathfinder historically authored dynamic-library filenames in ascending order,
then reversed them at each runtime lookup site. That distinction no longer
serves the descriptor catalog and makes preference mistakes easier.

This PR:

  • authors Linux SONAMEs and Windows DLL names directly in runtime preference
    order, most preferred first;
  • makes filesystem discovery, already-loaded detection, and native loader
    search consume the descriptor tuples as-is;
  • preserves the historical order of the private legacy SUPPORTED_*
    projections at their compatibility boundary; and
  • documents that ordered candidates for dynamic libraries, headers, binary
    utilities, static libraries, and bitcode libraries are consumed first to
    last.

The tuple rewrite is mechanically behavior-neutral: every multi-name dynamic
library tuple is the exact reverse of its previous catalog representation, and
the corresponding runtime reversal is removed.

Validation

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • Full cuda-pathfinder suite: 1,608 passed, 5 skipped on CUDA 13.3.
  • Repository-wide pre-commit suite (excluding the network-only link
    checker).

@rwgk rwgk added this to the cuda.pathfinder next milestone Aug 27, 2026
@rwgk rwgk added the cuda.pathfinder Everything related to the cuda.pathfinder module label Aug 27, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk rwgk self-assigned this Aug 27, 2026
@rwgk

rwgk commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e7705a7

@github-actions

This comment has been minimized.

@rwgk rwgk added the P1 Medium priority - Should do label Aug 27, 2026
@rwgk
rwgk marked this pull request as ready for review August 27, 2026 14:55
@rwgk
rwgk requested a review from isVoid August 27, 2026 14:55

@isVoid isVoid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming one thing below, else lgtm.

Comment on lines +69 to +71
SUPPORTED_LINUX_SONAMES_CTK = {
desc.name: _legacy_least_preferred_first(desc.linux_sonames) for desc in _CTK_DESCRIPTORS if desc.linux_sonames
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the order of libnames are actually non-essential here, is that correct? Not a change request, just confirming my thoughts. I see that the only place uses the global variable is here and this test. And neither depend on the order, actually, they use set-like operation at either places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is correct. There are a few additional in-tree uses of these mappings, but they are all order-insensitive: they use dictionary keys, membership, parametrization, or uniqueness checks. Runtime discovery and loading consume the descriptor tuples directly.

The reversal here is deliberately conservative. supported_nvidia_libs.py is retained for legacy compatibility, and although these constants are private implementation details, client code could have imported and iterated, indexed, or compared their tuple values. Preserving their historical order costs only this small conversion and keeps the refactor mechanically strictly behavior-neutral.

@rwgk
rwgk merged commit ecc7bd9 into NVIDIA:main Aug 27, 2026
213 of 215 checks passed
@rwgk
rwgk deleted the pathfinder_catalog_order_search_order_cleanup branch August 27, 2026 17:15
@github-actions

Copy link
Copy Markdown
Doc Preview CI
Preview removed because the pull request was closed or merged.

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 P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants