mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1650] prefill: the batched prompt path aborts (cublasGemmEx f16, cuBLAS status 14) on chunks below about 32 tokens #666
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#666
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @W1nge on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1650
With very small
--short-readvalues the prompt path cannot serve anything: the first request aborts the engine.(the engine exits with code 1, the server restarts it, the same thing happens to the next request).
--short-read 0sends every prompt segment to the batched path, including the last segment of a chat prompt – the role header the server appends, which is about 6 tokens. Chunks that small abort. Measured on one Windows host (CUDA 12.4.131, RTX 2080 Ti sm_75 + Tesla P100 sm_60, driver 537.13, native IQ3_XXS pack, 8192 context) withSTRATA_TRACE=1, which prints the chunk before it runs:prompt chunk 0 of 6)So the boundary sits between 24 and 33 tokens of chunk. It is not the first request that fails: after a chunk that reads, the next small chunk still aborts, and a session that reads anything through the verify windows first (any
--short-readof 32 or more on these prompts) never shows it.Minimal reproduction, no patches, stock 0.1.41 (
fb58e0d) on Windows:then send one ordinary chat request whose prompt ends with the role header, e.g. a message of about 40 tokens.
STRATA_TRACE=1makes the last linesThe failing call is
Gemm::f16insrc/prefill/gemm.cu(cublasGemmEx,CUDA_R_16Foperands,CUBLAS_COMPUTE_32F), which is the fp16 expert GEMM of the chunk (the row count is the number of experts the chunk routes to,src/prefill/prefill.cpparound thedq_gu/dq_dcalls). Small chunks therefore reach it with very few rows.I first hit this while measuring whether the batched prompt path can replace the verify windows for medium prompts: it makes
--short-read 0unusable, and it means the minimum is implicitly about 32 tokens rather than the documented "0 = never use the windows". A guard (clamp the flag, or keep the windows for a segment the batched path cannot serve) or a fix in the small-chunk GEMM path would both be fine; the default--short-read 64is unaffected.@W1nge commented on GitHub (Oct 9, 2026):
Root cause found: it is not the chunk size itself, but a cuBLAS 12 state that a second CUDA device in the process creates.
With another device's context initialized,
cudaGemmEx- the callGemm::f16makes (CUDA_R_16Foperands,CUBLAS_COMPUTE_32F) - answersCUBLAS_STATUS_INTERNAL_ERROR(14) for a few shapes when asked forCUBLAS_GEMM_DEFAULT. Minimal reproduction, no strata: on the machine that runs the GEMM on device 0, this is enough to break it for the rest of the process:In-process controls (RTX 2080 Ti sm_75 + Tesla P100 sm_60, Windows, driver 537.13, CUDA 12.4.131, a probe around the same call): 96/96 calls return 14 when the P100 takes part in the run, 0/96 with the P100 idle, 0/96 single-card - the pattern follows "was the second device's context created", not the shapes of the run.
The set of failing shapes moves with K as well as N, which is why a "small N" guard is not enough: K = 10240 is safe for N a multiple of 8 (N = 4, the expert gate/up pair, fails), while K = 2560 fails for N = 8..32 as well and is safe from 48 up. The small-chunk boundary in this report is a consequence of which shapes the small chunks reach.
An algorithm scan shows the fixed algorithms are immune:
CUBLAS_GEMM_ALGO2..ALGO11all return success under that state (ALGO0/1/12..15 are not-supported,CUBLAS_GEMM_TENSOR_OPandDEFAULTreturn 14), and ALGO2 measures the same as DEFAULT where DEFAULT works.#1659 falls back per shape: a
Gemmremembers the(N, K)of the shapes whose default call failed and runs only those on ALGO2, so the abort is gone and the wide shapes keep their default kernel (running everything on ALGO2 cost 11515 ms on a 5.1K prompt versus 7499 ms with this change; 7899 ms with the tensor cores off).Verified against the stock engine on this host: stock aborts on
--short-read 0withSTRATA_BF16_TC=1(the exactprefill gemm: cublasGemmEx f16: cuBLAS status 14from this report, exit code 1), and the patch answers the same 40-token request ([3], valid, 3.1 s).@Niko1221 commented on GitHub (Oct 10, 2026):
Thanks for the root cause. We checked it: on two RTX A4000 with CUDA 12.9 a probe (cublasGemmEx f16, default vs ALGO2, 99 shapes with K 2560/10240) does not fail even with the second device's context created, so the state needs the mixed Turing+Pascal pair or cuBLAS 12.4 you used. We ported #1659 as it is (authorship kept) and it builds on CUDA 12.9 and 13.4; our identity gate on a 3060 is unchanged.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.