Skip to content

[Backport] Fix support for NVVM from conda on Windows + other fixes #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

leofang
Copy link
Member

@leofang leofang commented Apr 23, 2025

Description

Backport of #563.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
(cherry picked from commit 0dfae43)
@leofang leofang added bug Something isn't working P0 High priority - Must do! cuda.bindings Everything related to the cuda.bindings module labels Apr 23, 2025
@leofang leofang added this to the cuda-python 12.9.0 & 11.8.7 milestone Apr 23, 2025
@leofang leofang requested review from rwgk and vzhurba01 April 23, 2025 00:56
@leofang leofang self-assigned this Apr 23, 2025
Copy link
Contributor

copy-pr-bot bot commented Apr 23, 2025

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.

@leofang
Copy link
Member Author

leofang commented Apr 23, 2025

/ok to test e027b05

try:
handle = win32api.LoadLibraryEx("nvrtc64_110_0.dll", 0, LOAD_LIBRARY_SAFE_CURRENT_DIRS)
except:
pass

if not handle:
raise RuntimeError('Failed to LoadLibraryEx nvrtc64_112_0.dll, or nvrtc64_111_0.dll, or nvrtc64_110_0.dll')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm asking mainly from the perspective of working on the path_finder code: Do I need to look around more?

Concretely, what distributions are there with nvrtc64_111_0.dll or nvrtc64_110_0.dll?

I ran unzip -l for all cuda_nvrtc-windows-x86_64*.zip that I found under

https://developer.download.nvidia.com/compute/cuda/redist/

For CTK 11.x, I only see nvrtc64_112_0.dll (see below).

I also looked in the nvidia_cuda_nvrtc_cu11 wheel, it has nvrtc64_112_0.dll, too.

$ grep nvrtc64_......dll *.txt
all_windows-x86_64_unzip_l.txt: 32601600  2021-08-16 03:08   cuda_nvrtc-windows-x86_64-11.4.120-archive/lib/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 32604160  2021-10-12 01:29   cuda_nvrtc-windows-x86_64-11.4.152-archive/lib/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 32961024  2021-11-18 12:45   cuda_nvrtc-windows-x86_64-11.5.119-archive/lib/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 32949248  2021-09-14 01:05   cuda_nvrtc-windows-x86_64-11.5.50-archive/lib/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 33174528  2022-02-10 19:20   cuda_nvrtc-windows-x86_64-11.6.112-archive/bin/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 33175552  2022-03-08 18:51   cuda_nvrtc-windows-x86_64-11.6.124-archive/bin/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 33174528  2021-12-17 19:06   cuda_nvrtc-windows-x86_64-11.6.55-archive/lib/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 33908224  2022-04-05 19:49   cuda_nvrtc-windows-x86_64-11.7.50-archive/bin/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 33909248  2022-06-08 17:38   cuda_nvrtc-windows-x86_64-11.7.99-archive/bin/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 40629248  2022-09-21 11:15   cuda_nvrtc-windows-x86_64-11.8.89-archive/bin/nvrtc64_112_0.dll
all_windows-x86_64_unzip_l.txt: 41392128  2023-01-06 22:09   cuda_nvrtc-windows-x86_64-12.0.140-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 41385984  2022-10-24 20:20   cuda_nvrtc-windows-x86_64-12.0.76-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 42161152  2023-04-03 18:07   cuda_nvrtc-windows-x86_64-12.1.105-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 42159104  2023-01-24 20:29   cuda_nvrtc-windows-x86_64-12.1.55-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 42494976  2023-07-11 04:05   cuda_nvrtc-windows-x86_64-12.2.128-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 42521600  2023-08-15 22:34   cuda_nvrtc-windows-x86_64-12.2.140-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 42499584  2023-06-13 20:23   cuda_nvrtc-windows-x86_64-12.2.91-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45593088  2023-11-03 18:01   cuda_nvrtc-windows-x86_64-12.3.103-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45593088  2023-11-22 11:19   cuda_nvrtc-windows-x86_64-12.3.107-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45592064  2023-09-08 20:10   cuda_nvrtc-windows-x86_64-12.3.52-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 44738048  2024-03-15 15:46   cuda_nvrtc-windows-x86_64-12.4.127-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 44733952  2024-02-27 18:05   cuda_nvrtc-windows-x86_64-12.4.99-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45325312  2024-04-17 19:59   cuda_nvrtc-windows-x86_64-12.5.40-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45325312  2024-06-06 03:48   cuda_nvrtc-windows-x86_64-12.5.82-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45474304  2024-06-14 17:19   cuda_nvrtc-windows-x86_64-12.6.20-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45475328  2024-08-14 11:11   cuda_nvrtc-windows-x86_64-12.6.68-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45865984  2024-09-12 03:24   cuda_nvrtc-windows-x86_64-12.6.77-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 45865984  2024-10-30 02:04   cuda_nvrtc-windows-x86_64-12.6.85-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 86702592  2025-01-15 20:14   cuda_nvrtc-windows-x86_64-12.8.61-archive/bin/nvrtc64_120_0.dll
all_windows-x86_64_unzip_l.txt: 86728192  2025-02-21 21:13   cuda_nvrtc-windows-x86_64-12.8.93-archive/bin/nvrtc64_120_0.dll

Copy link
Member Author

Choose a reason for hiding this comment

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

So this is what I know (learned actually from @kkraus14 long time ago) 🙂 CUDA promised minor version compatibility since CUDA 11, however back then the compiler was actually not stabilized enough to fulfill this story until 11.2. So before that each minor release had a different SONAME (this is same on Linux too), and the reality is minor ver compat is supported since 11.2. Technically we should just drop the support for 11.0/11.1 (they are untested anyway) but Vlad has been kept the old code around for a long time and no body complained. The story will become a lot cleaner once we drop 11.x support.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To close the loop here:

With 38a1d6c the cuda.bindings.path_finder now has this for nvrtc:

    "nvrtc": (
        "nvrtc64_110_0.dll",
        "nvrtc64_111_0.dll",
        "nvrtc64_112_0.dll",
        "nvrtc64_120_0.dll",
    ),

This is the result of downloading all released cuda_*win*.exe files for 11.x and 12.x, and then inspecting the .dll files in all of them automatically (toolshed/build_path_finder_dlls.py).

I believe with this general/systematic approach we can be certain that we will not miss any "already loaded" DLLs.

@leofang leofang merged commit 3d2fd88 into NVIDIA:11.8.x Apr 23, 2025
38 checks passed
@leofang leofang deleted the backport-563-to-11.8.x branch April 23, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants