Repository navigation
Qwen3.8-27B on CUDA: RTX 3090 (sm_86) support, the scratch sized by --parallel - #3
Open
CanadaApollo6 wants to merge 5 commits into
Open
CanadaApollo6 wants to merge 5 commits into
CanadaApollo6 wants to merge 5 commits into
Conversation
…m_90 (no clusters)
… captured unaligned variant The shared-round staging packed each part back to back, so _gdn_pre's WIN pointer landed off 16 bytes at some window sizes and no captured variant matched. Each part now starts on 16 bytes, and an aligned pointer or int can fall back to a variant captured without the alignment hint (never the reverse).
… host token table by env The server sized the scratch for 16 streams of 16 rows at any --parallel, and the attention partials in it grow with the window: on a 24 GB card no 32K stream fit beside it. The scratch now takes `streams` windows (the lane core's admission and the cost curve follow), so --parallel 1 needs one stream's rows. - TF_QWEN27_PROMPT_ROWS: a prompt chunk's rows (default 4096; 1024 frees ~1 GiB at a ~10% slower prompt). - TF_QWEN27_HOST_EMBED=1: the token table in mapped host memory (0.67 GiB; only prompt rows read it).
_tail's STREAM pointer followed W i32 rows directly, so it landed off 16 bytes when W % 4 != 0 (a lone stream's small windows) and matched no captured variant. Rows, streams, items and parents each start on 16 bytes.
CanadaApollo6
force-pushed
the
sm86-support
branch
from
October 13, 2026 18:27
bc3b485 to
99ce15a
Compare
This was referenced Oct 13, 2026
qwen27 CUDA: a pre-sm_90 decode matmul, ~52% faster serving on an RTX 3090 (exact; stacked on #3)
#4
Open
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.
Stacked on ashhart#608: this targets its branch, so the diff is only the commits below (13 files, +131 −55). With them the qwen27 CUDA engine serves on an RTX 3090 (sm_86, 24 GB), still token-for-token 0.6.6's.
What changes
0239d0ebSplit-K matmuls before sm_90. qmm's split-K path meets its K slices in a thread-block cluster, which sm_86 doesn't have. Before sm_90, split-K matmuls takelane_gemv(byte-equal to the cluster path) 16 rows a launch.a638859d,c6f544ebRound staging on 16 bytes. A shared round packs its host tables into one upload. Back to back,_gdn_pre'sWINand_tail'sSTREAMland off 16 bytes at some window sizes, and no captured variant matches (no captured Triton variant of _tail for this launch). Each part now starts on 16 bytes. An aligned pointer may also fall back to a variant captured without the alignment hint (never the reverse).c78ecb49The scratch sized by--parallel. The server sized it for 16 streams of 16 rows at any--parallel, and the attention partials in it grow with the window. On a 3090,--context 32768 --parallel 1failed with fits no stream: one at a 32768-token window takes 2.22 GiB, and 1.14 GiB is left after the model's 18.10 GiB. The scratch now holds--parallelwindows (capped at 16): the model plus scratch is 16.82 GiB and the stream fits. At--parallel 16the layout is unchanged.TF_QWEN27_PROMPT_ROWSsets a prompt chunk's rows (default 4096). At 1024 it frees ~1 GiB, and a 28K-token prompt reads ~10% slower.TF_QWEN27_HOST_EMBED=1keeps the token table (0.67 GiB) in mapped host memory. Only prompt rows read it.Checks (RTX 3090, CUDA 13.4, driver 615.71)
The glue set was captured from 0.6.6 on the same card with the scripts in
zig/tests/cuda/qwen27.capture_multi.pyran with--streams 3, because 0.6.6's memory gate refuses the default 6 on 24 GB. The set has 41 kernels includingMULTI=1.tf-qwen27-cuda run(serial, a 4722-token prompt among them)tf-qwen27-cuda drafttf-qwen27-cuda multi --context 8192draftwithTF_QWEN27_HOST_EMBED=1 TF_QWEN27_PROMPT_ROWS=1024--parallel 1and--parallel 3: 3 greedy chats alone, with"draft": false, and concurrentzig build testtools/zig/lean_check.pyServed at
--context 32768 --parallel 1(tools/bench_openai.py, 256 tokens, medians of 3): code 140 / chat 96 tok/s greedy, 168 / 95 sampled.Not checked: the RTX PRO 6000 or GB10 (I have neither). The layout there is unchanged at
--parallel 16.Next, if useful
I also have a pre-sm_90 decode matmul and an opt-in 4-bit attention cache on top of this. Together they make 235 code / 160 chat tok/s and a 262K window on the 3090. The 4-bit cache changes arithmetic, so I'll open an issue for its gate first, per CONTRIBUTING. @jschmied's generic glue kernels would also remove the capture step for sm_86.
🤖 Generated with Claude Code