Repository navigation
fix(cuda): load CUDA 13 cudart, and pin the two loader lists together - #1178
Merged
Merged
Conversation
`onnx-genai-ort::cuda_rt` listed only CUDA 12 cudart names while the CUDA EP's own loader (`onnx-runtime-ep-cuda::dynamic_library`) already listed CUDA 13. On a CUDA 13 host every candidate here failed, and the reported error named the *last* one tried -- `libcudart.so` -- a Linux name failing on Windows. That reads as `this machine has no CUDA` rather than `this list is stale`, and is why native CUDA appeared unavailable on a machine with a working RTX 4060, driver 591.55 and CUDA 13.1. Verified on that host: before, with only CUDA 13 on PATH, load failed at cudart; after, it gets past cudart and commits real device memory (VMM arena committed 2097152 B). Adding a CUDA 12 runtime to PATH produced the same progression before the fix, which isolates the cause to the missing name rather than to the environment. The guard test pins every major the EP accepts, and was falsified: dropping `cudart64_13.dll` reddens it with `missing cudart64_13.dll; the CUDA EP loads this major but `cuda_rt` would not`.
justinchuby
added a commit
that referenced
this pull request
Aug 18, 2026
… it (#1188) Agents on this repo have repeatedly concluded *no CUDA runtime on this machine* and used that to accept GPU performance and correctness claims as unverified. It is false, and it degraded review quality on every CUDA PR. The box has an RTX 4060 (driver 591.55, CUDA 13.1) and a complete CUDA 13 runtime under anaconda site-packages. It is simply not on PATH, and because this repo loads CUDA libraries dynamically by DLL name, adding two directories is enough. The recipe is in the decision note. Two defects kept the belief alive and hid each other: the stale `cudart` name list (#1178, fixed) and the unprepared `::Attention` workspace (#1179, open). Together they made native CUDA genuinely unrunnable here, and that unrunnability was reported upward as absence of hardware. The lesson worth keeping past both bugs: distinguish *absent* from *misconfigured* before building on a negative result. A negative that excuses you from verification deserves more scrutiny than a positive, not less. Co-authored-by: justinchuby <223556219+Copilot@users.noreply.github.com>
🔴 Benchmark Regression DetectedComparison of criterion micro-benchmarks: PR head vs merge-base, measured on the same runner in the same job (base first → PR second).
Visual flags: Host infoWhat this cannot catch
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1178 +/- ##
==========================================
+ Coverage 80.47% 80.57% +0.10%
==========================================
Files 368 357 -11
Lines 161309 154551 -6758
Branches 161309 154551 -6758
==========================================
- Hits 129807 124530 -5277
+ Misses 26763 25470 -1293
+ Partials 4739 4551 -188
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
justinchuby
added a commit
that referenced
this pull request
Aug 18, 2026
…1271) ## Summary `onnx-genai-ort::cuda_rt::CUDART_CANDIDATES` and `onnx-runtime-ep-cuda::dynamic_library::candidates` were two independent lists of CUDA `cudart` shared-library names. They drifted (the EP listed CUDA 13, `cuda_rt` did not), and CUDA 13 hosts failed to load `cudart` with an error naming a Linux `.so` on Windows (#1178). #1178 fixed the symptom and added a test pinning the two lists together — a weaker mechanism than one table. This PR makes the second copy **unrepresentable** (same shape as the prefix-reuse dedup in #1170): - **One canonical table** now lives in `onnx-genai-cuda-version-guard` — the crate both loaders already depend on: - `CUDART_CANDIDATES_LINUX` / `CUDART_CANDIDATES_MACOS` / `CUDART_CANDIDATES_WINDOWS` - `HostOs` selector + `cudart_candidates_for(HostOs)` (`const fn`) + `cudart_candidates()` (current build target) - Platform-conditional split preserved; the table is the **exact union** of both prior lists, including CUDA 13 (`cudart64_13.dll`, `libcudart.so.13`) and legacy `cudart64_120.dll`, so no host regresses. - **Both loaders consume it**, no second copy: - `onnx-genai-ort::cuda_rt` — deleted the private `CUDART_CANDIDATES` const; `load()` iterates `cudart_candidates()`. - `onnx-runtime-ep-cuda::dynamic_library` — the `Runtime` match arm delegates to `cudart_candidates_for(...)`. - **Deleted the #1178 agreement test** `every_cuda_major_the_ep_loads_is_also_resolvable_here` (the duplication it guarded is gone) and repointed the EP's `generates_linux/windows_cuda_names` tests at the canonical constants. - Added `onnx-genai-cuda-version-guard` as a normal (not just build) dependency of both crates so the runtime table is importable. ## Validation (run locally, default features) - `cargo build -p onnx-genai-cuda-version-guard -p onnx-genai-ort -p onnx-runtime-ep-cuda` — **pass** - `cargo test -p onnx-genai-cuda-version-guard -p onnx-runtime-ep-cuda` — version-guard 4/4 pass; EP `cudart` name tests pass. Two unrelated failures observed and confirmed pre-existing/flaky on clean `origin/main`: `onnx-genai-ort` integration test `real_foundry_package_fails_loudly_when_preprocessing_is_not_executable` (fails identically on baseline; depends on a local `~/.foundry` model) and EP GPU kernel `fp16_gemv_matches_dequant_reference_block128` (flaky — passes on retry and on baseline). - `cargo clippy -p onnx-genai-cuda-version-guard -p onnx-genai-ort -- -D warnings` — **clean**. EP clippy has one pre-existing `unnecessary_unwrap` error in `kernels/matmul_nbits.rs:8751` (untouched by this PR; present on baseline). Closes #1180⚠️ Do not merge — the coordinator admin-merges. ## Reference-oracle cross-check (validation only — no change needed) Sanity-checked our canonical `cudart` names against NVIDIA's `cuda-pathfinder` descriptor catalog (`descriptor_catalog.py`, `cudart` entry), used purely as a reference oracle (no Python/pip dependency added — we stay pure-Rust): - NVIDIA `cudart` Linux sonames: `libcudart.so.12`, `libcudart.so.13` - NVIDIA `cudart` Windows DLLs: `cudart64_12.dll`, `cudart64_13.dll` Our canonical table is a **superset** of both: - Linux: `libcudart.so.13`, `libcudart.so.12`, `libcudart.so` (adds the unversioned dev-symlink fallback) - Windows: `cudart64_13.dll`, `cudart64_12.dll`, `cudart64_120.dll`, `cudart.dll` (adds legacy `cudart64_120.dll` + bare `cudart` fallback) - macOS: `libcudart.dylib` (NVIDIA no longer ships macOS CUDA; harmless legacy retention) No CUDA-13 (or other) name is missing, so no additions were made — coverage already matches the oracle. This confirms the union we preserved is complete. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
onnx-genai-ort::cuda_rtlisted only CUDA 12cudartnames, while the CUDA EP's own loader (onnx-runtime-ep-cuda::dynamic_library::candidates) already listed CUDA 13. Two lists for one job, drifted apart.Why it looked like something else. On a CUDA 13 host every candidate in this list fails, and the error reports the last one tried:
could not load CUDA runtime (cudart): libcudart.so: LoadLibraryExW failed-- a Linux name failing on Windows. That reads as this machine has no CUDA, not this list is stale. It is why native CUDA appeared unavailable on a box with a working RTX 4060, driver 591.55, CUDA 13.1, and a complete CUDA 13 runtime present.Verified on that host.
cudart.cudartand commits real device memory ---cuda_ep: VMM arena closing: committed 2097152 B of 68719476736 B reserved.Guard, falsified.
every_cuda_major_the_ep_loads_is_also_resolvable_herepins every major the EP accepts. Droppingcudart64_13.dllreddens it:missing cudart64_13.dll; the CUDA EP loads this major but cuda_rt would not.Follow-up, not in this PR. The real fix is one table, not two agreeing tables. Both crates already depend on
onnx-genai-cuda-version-guard, which is the natural home for it. Filed separately; this PR unblocks CUDA 13 hosts now.Note that a second, unrelated defect sits immediately behind this one and is now reachable: native CUDA decode fails at
node 14 (op '::Attention') reached execution without prepared SessionPersistent workspace. Filed separately.