Skip to content

Make Windows static library searches architecture-aware - #2491

Open
isVoid wants to merge 3 commits into
NVIDIA:mainfrom
isVoid:agent/pathfinder-static-lib-binary-format
Open

Make Windows static library searches architecture-aware#2491
isVoid wants to merge 3 commits into
NVIDIA:mainfrom
isVoid:agent/pathfinder-static-lib-binary-format

Conversation

@isVoid

@isVoid isVoid commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What changed

Make Windows lookup for the currently supported static library, cudadevrt, follow the Python interpreter architecture:

  • x64 Python searches lib/x64, retaining the x64-only CUDA 12 wheel and legacy Conda fallbacks.
  • Arm64 Python searches only lib/arm64.
  • Linux behavior is unchanged.

Why

CUDA 13.4 ships cudadevrt.lib in separate lib/x64 and lib/arm64 locations. The existing lookup was hardcoded to x64, so Arm64 Python could not find its native library. The Arm64 and x64 CUDA 13.4 kitpick archives confirm the architecture-specific layout.

Validation

  • Focused static-library tests: 8 passed.
  • Full cuda-pathfinder suite: 1,278 passed, 4 skipped.
  • Ruff and mypy passed.

@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 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.

@isVoid isVoid added this to the cuda.pathfinder next milestone Aug 4, 2026 — with ChatGPT Codex Connector
@isVoid isVoid added enhancement Any code-related improvements cuda.pathfinder Everything related to the cuda.pathfinder module labels Aug 4, 2026 — with ChatGPT Codex Connector
@isVoid isVoid changed the title Make static library discovery architecture-aware Make Windows static library searches architecture-aware Aug 4, 2026
@isVoid
isVoid marked this pull request as ready for review August 4, 2026 21:51
@isVoid

isVoid commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f59381f

@isVoid
isVoid requested a review from rwgk August 4, 2026 21:52
@isVoid isVoid self-assigned this Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

@lijinf2 lijinf2 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.

Looks pretty good! Minor comments about potential risk that I don't think would happen. And the solution is already the best under the limitation of mocking-based testing.



def _cudadevrt_info() -> _StaticLibInfo:
if not IS_WINDOWS:

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.

Might be risky if non-windows non-linux (RISC-V)? But yes or no I think this is good enough for now.

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.

Yes, definitely good for now. We have many other existing conditions like this that'd need revisiting.

}

arch_dir = windows_python_arch()
component_wheel_dirs = ("nvidia/cuda_runtime/lib/x64",) if arch_dir == "x64" else ()

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 expect this hardcoded path nvidia/cuda_runtime/lib/x64 and the next path nvidia/cu13/lib/x64 will not be changed in CTK future releases. If the paths are changed, the mock test function would still pass.

@rwgk rwgk 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.

LGTM, but could you please look into the codex test-gap finding below before you merge?


Medium - the Arm64 behavior is table-tested, but not exercised through the public locator or required by CI

References:

  • cuda_pathfinder/tests/test_find_static_lib.py:164
  • .github/workflows/test-wheel-windows.yml:357

The new unit test monkeypatches IS_WINDOWS and windows_python_arch(), calls
the private _cudadevrt_info() helper, and compares its tuples. It never calls
locate_static_lib() or find_static_lib(). In particular,
_SUPPORTED_STATIC_LIBS_INFO was already constructed at import time, so the
public locator does not consume the configuration generated under the test's
monkeypatches.

The live CI result does not close this gap:

  • All Windows jobs are win-64; there is no native Arm64 job.
  • The tested toolkits are CUDA 13.3 or older, not the CUDA 13.4 layout that
    introduces the public Windows Arm64 support relevant to this PR.
  • The workflow step named all_must_work sets strictness for dynamic
    libraries, headers, and bitcode, but omits
    CUDA_PATHFINDER_TEST_FIND_NVIDIA_STATIC_LIB_STRICTNESS. A missing static
    library therefore remains see_what_works and does not fail that step.
  • One inspected x64 wheel job did successfully resolve
    nvidia\cu13\lib\x64\cudadevrt.lib, which is useful x64 evidence but says
    nothing about the new Arm64 route.

I would add public-API tests that create synthetic Windows directory trees and
verify the selected file, not just the generated tuple. With the target-aware
API suggested above, the important cases are:

  • An x64 Python/default request chooses x64.
  • An explicit Arm64 target from the same simulated x64 process chooses Arm64.
  • A toolkit containing both lib/x64 and lib/arm64 returns the requested
    target, including through find_static_lib().
  • Arm64 never falls back to the CUDA 12 x64 component-wheel path or the legacy
    unqualified Conda Library/lib path.
  • x64 continues to use both legacy fallbacks in the existing order.
  • Cached x64 and Arm64 lookups remain distinct.



def _cudadevrt_info() -> _StaticLibInfo:
if not IS_WINDOWS:

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.

Yes, definitely good for now. We have many other existing conditions like this that'd need revisiting.

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 enhancement Any code-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants