Skip to content

link manifest: record CUDA runtime libs and toolkit search dirs - #114

Open
peters wants to merge 1 commit into
handy-computer:mainfrom
peters:fix/link-manifest-cuda
Open

link manifest: record CUDA runtime libs and toolkit search dirs#114
peters wants to merge 1 commit into
handy-computer:mainfrom
peters:fix/link-manifest-cuda

Conversation

@peters

@peters peters commented Jul 28, 2026

Copy link
Copy Markdown

transcribe-link.json omits the CUDA runtime libraries for TRANSCRIBE_CUDA builds (system_libs carries only stdc++/m/pthread/dl), so every non-CMake consumer fails to link with undefined cuda* symbols and has to hand-roll the toolkit paths (e.g. the workaround in horizon's build.rs guessing a root from CUDA_PATH/CUDA_HOME).

What changed

  • cmake/transcribe-install.cmake: a cuda backend branch mirrors ggml-cuda's own link list — cudart, cublas, and (unless GGML_CUDA_NO_VMM) the cuda driver lib — and records the CUDAToolkit library dir plus its driver-stubs subdir in a new search_dirs manifest field (configure time knows the real paths; consumers stop guessing).
  • bindings/rust/sys/build.rs: emits cargo:rustc-link-search for each search_dirs entry.
  • scripts/ci/link_smoke.py: passes -L for each entry (read with .get, so older manifests still parse).
  • docs/bindings.md: schema note.

Verified locally (Linux, CUDA 12): static TRANSCRIBE_CUDA=ON configure → manifest carries search_dirs: ["/usr/local/cuda/lib64", "/usr/local/cuda/lib64/stubs"] and system_libs: [..., "cudart", "cublas", "cuda"]; full build + install + scripts/ci/link_smoke.py → the toy C consumer links from the manifest alone and enumerates CUDA0 at runtime. CPU-only configure regression-checked: search_dirs empty, system_libs unchanged.

CUDA builds of the static archive set reference the CUDA runtime, cuBLAS,
and (unless VMM is disabled) the driver API, but transcribe-link.json
never recorded them — every non-CMake consumer failed to link with
undefined cuda* symbols and had to hand-roll the toolkit paths (e.g.
horizon's build.rs workaround).

The manifest now mirrors ggml-cuda's own link list into system_libs and
records the toolkit's library dir (+ driver-stubs dir) in a new
search_dirs field; the -sys build script and the link-smoke harness
consume it. Verified locally: static CUDA install, toy C consumer built
from the manifest alone, CUDA0 enumerated at runtime.
@peters
peters requested a review from cjpais as a code owner July 28, 2026 07:20
@cjpais

cjpais commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Thank you for this, I'll take a look when I get a chance

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.

2 participants