Skip to content

[Windows][Cuda] DLL Preload Enhancements #202565

Closed

Description

@akarale-nv

🐛 Describe the bug

Creating this to continue discussion of the issue pointed at #202206 (comment)

Problem: Cuda-pathfinder on windows has a bug (NVIDIA/cuda-python#3281) where it did not support cupti64_2026.1.2.dll. This exposed a flaw in the load logic: The one try around all eleven libraries, can miss loading subsequent DLLs if either of the libs does not import on a clean Windows machine. CI does not see it because the T4 runner has the toolkit and cuDNN under Program Files.

This can be fixed in 2 ways:

  1. Add try / except around the load_nvidia_dynamic_lib(lib).
  2. Instead of preloading the DLLs, we prioritize the nvidia dir from the env's site-packages and add it to the dll load paths. This aligns better with the on-going efforts of improving the preloading logic [Windows] Drop the torch/lib DLL preload glob #202206.

@atalman @zklaus @nkhasbag-nv would love your input on this.

Versions

2.16.0 nightly

cc @malfet @atalman @tinglvv @nWEIdia @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @nkhasbag-nv @ptrblck @msaroufim @eqy

Activity

  1. added
    bot-triagedThis is a label only to be used by the auto triage bot
    module: binariesAnything related to official binaries that we release to users
    module: cudaRelated to torch.cuda, and CUDA support in general
    triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
    on Oct 29, 2026
  2. nkhasbag-nv commented on Oct 30, 2026

    @nkhasbag-nv
    Contributor

    Overall this is a good fix.

    Suggestion: Changes to this try/except block are easy to miss, and a later refactor could quietly move the try back around the whole loop. A test with a mock loader would protect against that. It would make load_nvidia_dynamic_lib raise for each library in the list, and check that a warning is emitted and that every other library is still attempted.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot-triagedThis is a label only to be used by the auto triage botmodule: binariesAnything related to official binaries that we release to usersmodule: cudaRelated to torch.cuda, and CUDA support in generalmodule: windowsWindows support for PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions