Repository navigation
Description
Description
On RTX 5080 Laptop GPU (Blackwell, compute capability 12.0), llama-server intermittently crashes at startup with a CUDA error in the Flash Attention kernel initialization. The error occurs probabilistically — sometimes the server starts successfully, sometimes it fails. Repeatedly retrying will eventually succeed.
The same error occurs with both upstream llama.cpp (main branch) and the TurboQuant fork, confirming this is not specific to any custom kernel modifications.
Games and 3DMark benchmarks run perfectly fine on this GPU, ruling out hardware defects.
Error Message
CUDA error: shared object initialization failed
current device: 0, in function launch_fattn at .../fattn-common.cuh:1428
cudaOccupancyMaxActiveBlocksPerMultiprocessor(&max_blocks_per_sm, fattn_kernel, block_dim.x * block_dim.y * block_dim.z, nbytes_shared)
llama.cpp/ggml/src/ggml-cuda/ggml-cuda.cu:100: CUDA error
Environment
- GPU: NVIDIA GeForce RTX 5080 Laptop GPU (16GB VRAM, Blackwell, SM 120)
- OS: Windows 11
- Driver: 596.36
- CUDA Toolkit: 13.2
- llama.cpp: Both upstream main branch (prebuilt b9012) and TurboQuant fork (self-compiled with CMake + CUDA 13.2, CMAKE_CUDA_ARCHITECTURES=120)
- Build config:
-DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120
Steps to Reproduce
- Build llama.cpp with CUDA support targeting SM 120 (or use upstream prebuilt binaries)
- Run
llama-serverwith any model and flash attention enabled (-fa on) - Observe that startup sometimes succeeds and sometimes crashes with the error above
- Retry multiple times — the failure is probabilistic, not deterministic
Expected Behavior
llama-server should start reliably without intermittent CUDA kernel initialization failures.
Actual Behavior
Startup fails with roughly 30-50% probability (subjective estimate). When it fails, the error is always in launch_fattn at the cudaOccupancyMaxActiveBlocksPerMultiprocessor call. When it succeeds, the server runs normally with flash attention working correctly.
Additional Notes
- The error is intermittent — the same binary, same model, same parameters can succeed on one launch and fail on the next
- Disabling flash attention (
-fa off) avoids the crash but loses FA performance benefits - The GPU passes all stress tests (gaming, 3DMark), suggesting this is a CUDA runtime/driver interaction issue rather than a hardware defect
- The
cudaOccupancyMaxActiveBlocksPerMultiprocessorAPI call returningcudaErrorSharedObjectInitFailedis unusual — this error code typically relates to shared library loading, not kernel occupancy calculation - On desktop RTX 5070 Ti (same CUDA toolkit, same driver family), the same builds work reliably
- The laptop GPU has dynamic power management and may enter different power states, which could affect CUDA context initialization timing
Related
- Similar (but different) FA issues: Eval bug: In function launch_fattn: CUDA ERROR: Invalid configuration #19487, Eval bug: GLM 4.7 Flash not working with flash attention on #19307
- CUDA Blackwell compilation issues: Compile bug: #22499, [Windows] RTX 5070 Ti (Blackwell sm_120) - CUDA compilation and runtime workarounds #22696
Activity
Scorp1o117 commentedon May 10, 2026
Consolidated findings (replaces previous comments)
Environment
CMAKE_CUDA_ARCHITECTURES=120)Error
Two different CUDA kernels fail with the same error code:
Reproduction pattern
--no-mmapKey observations:
--no-mmapspecific — enabling mmap fixes it 100%, but mmap is impractical here (model file ~22GB + CPU-offloaded expert layers exhaust system RAM)launch_fattnand plainMUL_MATfail with the same error--no-mmap— this appears specific to Blackwell laptop GPUsLikely root cause
The
--no-mmapmodel loading path (directread()/memcpy()instead of lazy page-faulting) interacts poorly with CUDA context initialization on Blackwell laptop GPUs. The different memory allocation timing may cause the CUDA runtime to dispatch kernels before the GPU context is fully ready, triggeringcudaErrorSharedObjectInitFailedon the first kernel launch.Workaround
--mmap(default) fixes stability, but causes excessive RAM usage with large MoE models on systems with limited RAM. A proper fix to the--no-mmaploading path is needed.Scorp1o117 commentedon May 10, 2026
Confirmed: Not Qwen3.6-35B specific — all MoE models affected
Tested with Gemma 4 26B-A4B (different MoE architecture, different vendor) on the same RTX 5080 Laptop:
--no-mmapThis confirms the bug is architecture-agnostic — it affects any MoE model loaded with
--no-mmapon Blackwell laptop GPUs, not specific to Qwen3.6 or itsMUL_MAT_IDimplementation.The root cause is likely in the shared
--no-mmapmodel loading path (read()/memcpy()into host RAM) rather than in any model-specific kernel code.am17an commentedon May 10, 2026
You are probably running out of RAM on your computer,
--no-mmapwill force pinned memory which can cause OOM.Scorp1o117 commentedon May 10, 2026
Update: Same model, even less memory pressure on laptop — still fails
I tested the exact same GGUF file (
Qwen3.6-35B-A3B-uncensored-heretic-APEX-I-Quality.gguf, ~22GB) on both machines:Desktop (RTX 5070 Ti, 16GB VRAM, 32GB RAM) ✅
-ncmoe23 --no-mmap -ngl 99 -fa on -c 131072Laptop (RTX 5080, 16GB VRAM, 32GB RAM) ❌
-ncmoe23 --no-mmap -ngl 99 -fa on -c 64000(smaller context!)CUDA error: shared object initialization failedatfattn-common.cu:1428Key observations
--no-mmapflag — desktop works, laptop fails--no-mmaploading path on laptop Blackwell GPUsScreenshots attached below.
Desktop (working): ![desktop]
Laptop (failing): ![laptop]
Scorp1o117 commentedon May 10, 2026
Please see my latest comment above with screenshots. The laptop actually uses less memory than the desktop:
-c 131072+ mmproj loaded → works-c 64000+ no mmproj → failsBoth have 32GB RAM. The laptop has lower memory pressure but still crashes. VRAM and RAM were not full at the time of failure.
This makes me think it is not a simple OOM issue — something else is going on with how
--no-mmapinteracts with CUDA initialization on this specific laptop platform.Offset0x commentedon May 13, 2026
I have same issue on my windows desktop with RTX 5060 TI.
ggml_cuda_compute_forward: MUL_MAT failed
CUDA error: shared object initialization failed
It is very random