Skip to content

feat(cuda): probe cuda13 native libraries before cuda12 - #1440

Open
modelpath-dev wants to merge 2 commits into
SciSharp:masterfrom
modelpath-dev:feat/1360-cuda13-loader
Open

modelpath-dev wants to merge 2 commits into
SciSharp:masterfrom
modelpath-dev:feat/1360-cuda13-loader

Conversation

@modelpath-dev

@modelpath-dev modelpath-dev commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

Part 2 of the CUDA 13 split for #1360. Once part 1 has produced cu13.0.0 binaries for development, the managed loader can prefer cuda13 before cuda12 without shipping new NuGet packages yet.

Depends on #1439.

Scope

  • LLama/Native/Load/NativeLibraryWithCuda.cs: when SkipCheck is on (or major 13 is detected), try major 13 before 12 and 11.
  • LLama.Unittest/NativeLibraryWithCudaTests.cs: cover unknown-major SkipCheck order, detected 13, detected 12, and SkipCheck off with unknown major.

Out of scope: compile workflow, nuspecs, LLamaSharp.Runtime.targets, docs.

Tradeoffs

Stacked on the build branch so the history stays ordered. Against master today this PR also contains the compile.yml commit from #1439. After #1439 merges, rebase this branch and the reviewable diff is only the two loader files.

Blast Radius

Changes which native CUDA directory Prepare() tries first when probing. Without cuda13 binaries present, the new probe returns null and falls through to cuda12 the same as before.

Verification

  • Loader-only files vs the build tip: NativeLibraryWithCuda.cs, NativeLibraryWithCudaTests.cs.
  • Full tip patch-id still matches the pre-split combined change.
  • Unit tests assert literal path order (cuda13 then cuda12 then cuda11 under SkipCheck). Could not run dotnet test locally (SDK missing); CI on this PR is the live run.

Extend the cublas matrix and Gather Binaries layout so a Compile run can produce cu13.0.0 artifacts next to cu12.4.0 without changing the managed loader or NuGet packages yet.
Teach NativeLibraryWithCuda to try major 13 when SkipCheck is on or the detected major is 13, and cover the path order with unit tests. Binaries and NuGet packages stay out of this change.
@martindevans

martindevans commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Started a build action for version 815a2a5915f22ce6a760c676389c5dfe8535c08f (the current version of llama.cpp that we support). Once that's done I'll merge a PR to use those binaries.

See: https://github.com/SciSharp/LLamaSharp/actions/runs/36282985190

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.

2 participants