[GH-ISSUE #4627] [Engine] DeepSeek-V4.1: vision QKV GEMM fails with cuBLAS status 15 (NOT_SUPPORTED) on RTX 3090 (sm_86, CUDA 13) under high max-context #2096

Open
opened 2026-11-04 01:56:39 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @whitespades on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4627

Summary

With --vision on on DeepSeek-V4.1-Flash (IST-DAS 2.00 bpw), an image request makes the vision encoder fail with a cuBLAS NOT_SUPPORTED (15) in a BF16 QKV attention GEMM, and the request then dies with a follow-up cannot open the pictures' file … .dsi error.

The same engine, model and GPU encode pictures fine in a normal 262144-context session. The failure happens in a session started with --max-context 524288 --experts 6 --reserve-mib 125 on the 24 GB card, where the log is full of GPU out of memory warnings right before the vision crash. Suspected cause: cuBLAS workspace/allocation for the vision GEMM is not available once the KV cache for the huge context has taken the remaining VRAM; a clean failure/reason (and no follow-up .dsi error) would be much better than the current cryptic pair.

Environment

  • Engine: strata-dsv41 0.1.52 build a42cc3d7d, package 0.1.52-linux-x86_64-cuda-cuda13
  • Model pack: DeepSeek-V4.1-Flash-1017-GSQ-RCO IQ2_XXS (IST-DAS 2.00 bpw), shared Engram table
  • GPU: RTX 3090 24 GB (sm_86), engine --tp 1, vision tower on GPU 0 (318 MiB resident, vision_mib in /metrics)
  • Second GPU (RTX 3060) present, not used by the engine
  • Driver 595.99.02, Ubuntu 24.04.4, kernel 6.8.0-136, 124 GiB RAM
  • gpu-unlock kernel module (Zagitta, full-rate BF16) is active on both cards — should not affect cuBLAS support, noted for completeness

Startup args of the failing session

strata-dsv41 --serve --pack …/deepseek-v4.1-flash-ist-das-2.00bpw --max-context 524288 --eos 1 --vision on --dspark auto --dspark-conf 0.65 --tp 1 --prefill-chunk 4096 --cpu-threads 30 --reserve-mib 125 --mmap-experts off --experts 6

What the log shows

Repeated GPU-side memory pressure first:

ds4 gguf set_down: out of memory
ds4 iq: the light sets' scratch (64 MB) failed
ds4 gguf set_gate_up: out of memory
… (repeats) …

Then the vision encoder, on the first image of the request:

ds4: vision: cublasGemmEx(h, CUBLAS_OP_N, CUBLAS_OP_N, hd, nq, N, &one, qkv_ + 2 * D + hh * hd, CUDA_R_16BF, H3, p_, CUDA_R_16BF, N, &zero, o_ + hh * hd, CUDA_R_16BF, D, CUBLAS_COMPUTE_32F, CUBLAS_GEMM_DEFAULT): cuBLAS status 15

Then, as a follow-up, the request dies:

[strata] the engine reported an error: cannot open the pictures' file …/ds-pictures/strata-ds-pics-pr6r4f97.dsi

(the ds-pictures directory ends up empty).

Works, for comparison

Same engine binary, same model, same machine, started with --max-context 262144 --experts 5 --reserve-mib 150:

maya ds4 serve: 1 pictures, 1 read (211 ms)

The picture encodes and the model answers with it normally.

Questions / requests

  1. Is CUBLAS_STATUS_NOT_SUPPORTED here plausibly a workspace/allocation failure for the vision GEMM under KV-cache pressure on 24 GB? If so, could the engine check the memory situation and produce a clear message (e.g. "vision needs ~N MB free VRAM, only X free — lower --max-context / --reserve-mib") instead of a raw cuBLAS status?
  2. The follow-up cannot open the pictures' file … .dsi is confusing — the real failure is the vision step. Could the request fail with the vision reason directly?
  3. Is there a supported way to keep vision usable in a 512K-context session on 24 GB (e.g. CPU image encoder flag from docs, --vision cpu)?

Happy to test any patch build on this box.

Originally created by @whitespades on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4627 ## Summary With `--vision on` on DeepSeek-V4.1-Flash (IST-DAS 2.00 bpw), an image request makes the vision encoder fail with a cuBLAS `NOT_SUPPORTED` (15) in a BF16 QKV attention GEMM, and the request then dies with a follow-up `cannot open the pictures' file … .dsi` error. The same engine, model and GPU encode pictures fine in a normal 262144-context session. The failure happens in a session started with `--max-context 524288 --experts 6 --reserve-mib 125` on the 24 GB card, where the log is full of GPU `out of memory` warnings right before the vision crash. Suspected cause: cuBLAS workspace/allocation for the vision GEMM is not available once the KV cache for the huge context has taken the remaining VRAM; a clean failure/reason (and no follow-up `.dsi` error) would be much better than the current cryptic pair. ## Environment - Engine: `strata-dsv41 0.1.52 build a42cc3d7d`, package `0.1.52-linux-x86_64-cuda-cuda13` - Model pack: DeepSeek-V4.1-Flash-1017-GSQ-RCO IQ2_XXS (IST-DAS 2.00 bpw), shared Engram table - GPU: RTX 3090 24 GB (sm_86), engine `--tp 1`, vision tower on GPU 0 (318 MiB resident, `vision_mib` in /metrics) - Second GPU (RTX 3060) present, not used by the engine - Driver 595.99.02, Ubuntu 24.04.4, kernel 6.8.0-136, 124 GiB RAM - `gpu-unlock` kernel module (Zagitta, full-rate BF16) is active on both cards — should not affect cuBLAS support, noted for completeness ## Startup args of the failing session ``` strata-dsv41 --serve --pack …/deepseek-v4.1-flash-ist-das-2.00bpw --max-context 524288 --eos 1 --vision on --dspark auto --dspark-conf 0.65 --tp 1 --prefill-chunk 4096 --cpu-threads 30 --reserve-mib 125 --mmap-experts off --experts 6 ``` ## What the log shows Repeated GPU-side memory pressure first: ``` ds4 gguf set_down: out of memory ds4 iq: the light sets' scratch (64 MB) failed ds4 gguf set_gate_up: out of memory … (repeats) … ``` Then the vision encoder, on the first image of the request: ``` ds4: vision: cublasGemmEx(h, CUBLAS_OP_N, CUBLAS_OP_N, hd, nq, N, &one, qkv_ + 2 * D + hh * hd, CUDA_R_16BF, H3, p_, CUDA_R_16BF, N, &zero, o_ + hh * hd, CUDA_R_16BF, D, CUBLAS_COMPUTE_32F, CUBLAS_GEMM_DEFAULT): cuBLAS status 15 ``` Then, as a follow-up, the request dies: ``` [strata] the engine reported an error: cannot open the pictures' file …/ds-pictures/strata-ds-pics-pr6r4f97.dsi ``` (the `ds-pictures` directory ends up empty). ## Works, for comparison Same engine binary, same model, same machine, started with `--max-context 262144 --experts 5 --reserve-mib 150`: ``` maya ds4 serve: 1 pictures, 1 read (211 ms) ``` The picture encodes and the model answers with it normally. ## Questions / requests 1. Is `CUBLAS_STATUS_NOT_SUPPORTED` here plausibly a workspace/allocation failure for the vision GEMM under KV-cache pressure on 24 GB? If so, could the engine check the memory situation and produce a clear message (e.g. "vision needs ~N MB free VRAM, only X free — lower --max-context / --reserve-mib") instead of a raw cuBLAS status? 2. The follow-up `cannot open the pictures' file … .dsi` is confusing — the real failure is the vision step. Could the request fail with the vision reason directly? 3. Is there a supported way to keep vision usable in a 512K-context session on 24 GB (e.g. CPU image encoder flag from `docs`, `--vision cpu`)? Happy to test any patch build on this box.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 29, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6502926758 --> @github-actions[bot] commented on GitHub (Oct 29, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6543290784 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): Thanks, this follows the format now.
Author
Owner

@whitespades commented on GitHub (Oct 31, 2026):

Helper-GPU vision evidence (separate from the 4 GB RAM margin change): with CUDA_VISIBLE_DEVICES=0,1, gpu_order: as_given, --gpus 0, DS4_VISION_GPU=1, all 40 layers stayed on the 3090 and the vision tower loaded on the 3060 (444 MiB including CUDA context); an image read took 1,130 ms. I opened #4809 as a feature request to make this a supported upstream option.

<!-- gh-comment-id:6543298061 --> @whitespades commented on GitHub (Oct 31, 2026): Helper-GPU vision evidence (separate from the 4 GB RAM margin change): with `CUDA_VISIBLE_DEVICES=0,1`, `gpu_order: as_given`, `--gpus 0`, `DS4_VISION_GPU=1`, all 40 layers stayed on the 3090 and the vision tower loaded on the 3060 (444 MiB including CUDA context); an image read took 1,130 ms. I opened #4809 as a feature request to make this a supported upstream option.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2096
No description provided.