Skip to content

Misc. bug: Intermittent (~30%) CUDA "shared object initialization failed" at cudaFuncSetAttribute in fattn-mma-f16 on GB10/sm_121 (Windows arm64) #28112

Closed as not planned

Description

@larroy

Name and Version

version: 0.3.0-dev (build 10655, commit cb300598d)
built with Clang 20.1.8 for Windows arm64

Official prebuilt llama-b10655-bin-win-cuda-13.4-arm64.zip. Also reproduced on b10488 (9d77fa172).

system_info: n_threads = 18 (n_threads_batch = 18) / 18 | CUDA : ARCHS = 750,800,860,890,900,1200,1210 |
USE_GRAPHS = 1 | BLACKWELL_NATIVE_FP4 = 1 | CPU : NEON = 1 | ARM_FMA = 1 | MATMUL_INT8 = 1 | DOTPROD = 1 |
OPENMP = 1 | REPACK = 1 |

Note ARCHS includes 1210, so an sm_121 cubin is present — this is not a PTX-JIT fallback.

Operating systems

Windows (11 Enterprise 10.0.28000, arm64)

Which llama.cpp modules do you know to be affected?

libllama (core), llama-server

Command line

llama-server --model Qwen3.6-27B-Q4_K_M.gguf --alias qwen3.6-27b-mtp-q4-k-m \
  --host 127.0.0.1 --port 58030 \
  --ctx-size 65536 --n-predict 8192 --parallel 1 \
  --cache-type-k f16 --cache-type-v f16 \
  --batch-size 4096 --ubatch-size 4096 \
  --flash-attn on \
  --gpu-layers all --split-mode none --main-gpu 0 \
  --fit off --load-mode dio \
  --spec-type draft-mtp --spec-draft-n-max 3 --spec-draft-backend-sampling \
  --jinja --reasoning on --reasoning-format deepseek --context-shift \
  --no-webui --log-verbosity 4

Problem description & steps to reproduce

On NVIDIA GB10 / RTX Spark N1X (Blackwell, sm_121) on Windows arm64, llama-server intermittently aborts during model warm-up with CUDA error: shared object initialization failed, raised from cudaFuncSetAttribute(..., cudaFuncAttributeMaxDynamicSharedMemorySize, ...) in ggml_cuda_flash_attn_ext_mma_f16_case (fattn-mma-f16.cuh:1945). The process dies with Windows fail-fast 0xC0000409.

The failure is nondeterministic. With the model, flags, and context size held completely constant, it fires on roughly 3 of every 10 launches.

Reproduction

Launch the same command repeatedly and tally outcomes. 10 identical runs at --ctx-size 65536, in the order observed (run across three batches, with the process killed and a short pause between each):

run  1 -> CUDA_SHARED_OBJ_FAIL
run  2 -> CUDA_SHARED_OBJ_FAIL
run  3 -> OK
run  4 -> OK
run  5 -> CUDA_SHARED_OBJ_FAIL
run  6 -> OK
run  7 -> OK
run  8 -> OK
run  9 -> OK
run 10 -> OK

TOTAL: 3 crashes / 10 runs

The three failures landing early is an artifact of batch boundaries rather than a warm-up effect as far as I can tell, but I have not run enough trials to rule out an ordering effect.

Because of this rate, a single successful launch does not indicate absence of the bug — I initially and wrongly concluded a newer build had fixed it based on a handful of passing runs.

Not monotonic in context size

Same model and flags, varying only --ctx-size:

ctx result
32768 OK
65536 crash
131072 OK
196608 OK
262144 crash

If a fixed shared-memory limit were simply being exceeded, I would expect a monotonic threshold. This looks like a nondeterministic fault instead.

--flash-attn variants

  • on — intermittent crash (above).
  • auto — also crashes at the same call site (observed on the 35B; not separately tested on the 27B).
  • off — never reaches the kernel. Measured on the 35B at --ctx-size 262144, the compute buffer needs ~73 GB (allocating 69936.09 MiB on device 0: cudaMalloc failed: out of memory), so it is not a usable workaround at long context on a 44 GB device. Not separately measured for the 27B.

Things I ruled out

  • VRAM exhaustion — ~53 GB reported free against ~21 GB needed at the failing configuration.
  • Host RAM / pinned memory at time of failure. This matters because it was the leading theory in Misc. bug: Intermittent CUDA error in launch_fattn on RTX 5080 Laptop (Blackwell SM 120) #22893. I logged free physical RAM immediately before each identical run:
    run=1  free_before=8800 MB  -> CUDA_SHARED_OBJ_FAIL
    run=2  free_before=8773 MB  -> OK
    run=3  free_before=8739 MB  -> OK
    run=4  free_before=8672 MB  -> OK
    run=5  free_before=8768 MB  -> OK
    run=6  free_before=9130 MB  -> OK
    
    The crashing run had more free memory than four runs that succeeded, so free physical RAM does not predict the fault. (I cannot rule out pinned-memory fragmentation specifically — see below.)
  • PTX JIT — %APPDATA%\NVIDIA\ComputeCache is untouched across runs, and the build ships an sm_121 cubin.
  • Model / architecture — reproduces on both Qwen3.6-27B (qwen35, dense) and Qwen3.6-35B-A3B (qwen35moe, MoE).
  • Build — reproduces on b10488 and b10655.

Possibly relevant: unified memory with a large GPU carveout

This device has a single 64 GiB physical pool statically split between the GPU and the OS:

Installed physical 65,536 MB
GPU carveout (nvidia-smi FB total) 44,480 MiB
Visible to Windows 19,695 MB
Free during these runs ~7–9 GB

So VRAM is plentiful while host RAM is structurally scarce. In #22893 a maintainer suggested pinned-memory pressure as the cause and the reporter pushed back (their machine had ample RAM). This system is a much harsher test of that theory: host memory here is genuinely tight, yet the fault still does not correlate with free RAM run-to-run. If the mechanism is pinned-memory fragmentation rather than raw availability, that would be consistent with both reports — I have not been able to test that directly and would welcome guidance on how to.

There is a second, clearly distinct failure mode on this box at --ctx-size 262144 which is plain host exhaustion and is not what this report is about:

ggml_backend_cpu_buffer_type_alloc_buffer: failed to allocate buffer of size 2315403296
common_speculative_init_result: failed to create MTP context

Related issues

Filing separately rather than commenting on #22893 because that issue is closed and scoped to sm_120 laptop parts; this adds sm_121 / GB10 on Windows arm64, a different call site, and a quantified failure rate. Happy to consolidate if maintainers prefer.

First Bad Commit

Unknown — reproduces on the earliest build I have tested (b10488). Bisecting is impractical at a ~30% failure rate without many runs per candidate.

Relevant log output

0.00.220 I cmn  common_param:   - CUDA0   : NVIDIA RTX Spark N1X (5120-core Blackwell RTX GPU) (53547 MiB, 53367 MiB free)
0.00.379 I llama_prepare_model_devices: using device CUDA0 (NVIDIA RTX Spark N1X (5120-core Blackwell RTX GPU)) (000f:01:00.0) - 53367 MiB free
0.00.734 I load_tensors:        CUDA0 model buffer size = 15621.78 MiB
0.08.158 I llama_context: flash_attn            = enabled
0.08.167 I llama_kv_cache:      CUDA0 KV buffer size =  4096.00 MiB
0.08.435 I llama_kv_cache: attn_rot_k = 0, n_embd_head_k_all = 256
0.08.460 I llama_memory_recurrent:      CUDA0 RS buffer size =   598.50 MiB
0.08.508 I sched_reserve:      CUDA0 compute buffer size =  1488.13 MiB
0.08.508 I cmn  common_init_: warming up the model with an empty run - please wait ... (--no-warmup to disable)
0.08.663 E CUDA error: shared object initialization failed
D:\a\llama.cpp\llama.cpp\ggml\src\ggml-cuda\ggml-cuda.cu:107: CUDA error
0.08.664 E   current device: 0, in function ggml_cuda_flash_attn_ext_mma_f16_case at D:\a\llama.cpp\llama.cpp\ggml\src\ggml-cuda\template-instances\../fattn-mma-f16.cuh:1945
0.08.664 E   cudaFuncSetAttribute(reinterpret_cast<fattn_kernel_ptr_t>(fattn_kernel), cudaFuncAttributeMaxDynamicSharedMemorySize, nbytes_shared_total)

Server-side, the router reports the instance death as:

srv operator(): instance name=qwen3.6-27b-mtp-q4-k-m exited with status -1073740791
srv operator(): got exception: {"error":{"code":500,"message":"model name=... failed to load","type":"server_error"}}

Environment: NVIDIA driver 616.55 (CUDA UMD 13.4), Windows 11 Enterprise 10.0.28000, arm64.

Activity

  1. github-actions commented on Oct 16, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions