Skip to content

fix(build): bundle NVRTC builtins library in CUDA backend - #1183

Open
bkbatchelor wants to merge 1 commit into
jamiepine:mainfrom
bkbatchelor:fix/bundle-nvrtc-builtins
Open

bkbatchelor wants to merge 1 commit into
jamiepine:mainfrom
bkbatchelor:fix/bundle-nvrtc-builtins

Conversation

@bkbatchelor

Copy link
Copy Markdown

Problem

The Linux CUDA backend (voicebox-server-cuda) fails on the first generation that needs a torch JIT kernel (for example, complex abs):

nvrtc: error: failed to open libnvrtc-builtins.so.12.8.
  Make sure that libnvrtc-builtins.so.12.8 is installed correctly.

libnvrtc.so.12 is bundled, but NVRTC loads libnvrtc-builtins.so.12.8 with dlopen() at runtime. PyInstaller's dependency scan never sees that load, so the library is left out of _internal/nvidia/cuda_nvrtc/lib/.

Fix

In the CUDA branch of build_server(), find the installed nvidia.cuda_nvrtc package and pass its builtins libraries to PyInstaller with --add-binary. They go into the same directory as libnvrtc (lib/*.so* on Linux, bin/*.dll on Windows). If none are found, the build raises an error instead of producing a backend that breaks at runtime.

Testing

  • python build_binary.py --cuda on Arch Linux (torch 2.11.0+cu128, nvidia-cuda-nvrtc-cu12 12.8.93). libnvrtc-builtins.so.12.8 and libnvrtc-builtins.alt.so.12.8 now appear in dist/voicebox-server-cuda/_internal/nvidia/cuda_nvrtc/lib/.
  • nvrtcCompileProgram through the bundled libnvrtc.so.12 succeeds.
  • Voice generation on an RTX 3050 Laptop GPU works after adding the missing library to an installed backend. Before, it failed with the error above.
  • The Windows .dll path was not tested.

NVRTC dlopen()s libnvrtc-builtins at runtime, so PyInstaller's
dependency scan never picks it up. The CUDA backend then fails on the
first torch JIT kernel (e.g. complex abs during generation) with
"failed to open libnvrtc-builtins.so.12.8".

Add the builtins libraries from nvidia.cuda_nvrtc explicitly with
--add-binary next to libnvrtc, and fail the build if none are found.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant