[GH-ISSUE #8] Turing (sm_75): the prompt attention asks for 67584 bytes of shared memory (2048 over the 64 KB cap) and the ignored opt-in kills the engine on every long prompt #5

Closed
opened 2026-10-29 21:19:01 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @dummerjindabin on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/8

Environment

2x Titan RTX (sm_75, 24 GB each), 48 GB DDR4, driver 610.57.04, CUDA 12.9/13.0, Ubuntu, Maya-S.
Reproduced on cfd2f45 (v1.0.4). src/kernels/cuda/glm_batch.cu is byte-identical in 2b0f1a3 (v1.0.6), so
the current main branch still has this.

Symptom

Short prompts and short chats are fine. Any prompt longer than roughly a thousand tokens kills the
engine: it exits, the server restarts it, and the context resets. Per start the engine log shows:

glm_batch mla_attn: invalid argument
glm prefill: layer 3 planned 0 of 14848 routed rows
glm_batch tab_update: an illegal memory access
prefill mmq: iota: illegal memory access
glm_fast mla: the split kernel cannot get 67584 bytes of shared memory - the one-pass attention instead

Root cause

mla_attn_kernel (src/kernels/cuda/glm_batch.cu, the F32 prompt-attention kernel, MB_CH = 32,
MB_HG = 16) asks for

smem = (MB_CH * 512 + MB_HG * MB_CH) * sizeof(float)
     = (32 * 512 + 16 * 32) * 4 = 67584 bytes

2048 bytes over Turing's 65536 ceiling, so

cudaFuncSetAttribute(mla_attn_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem)

fails with cudaErrorInvalidValue — and its return value is discarded:

    if (!attr[dev]) {
        cudaFuncSetAttribute(mla_attn_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem);
        attr[dev] = true;      // set even when the call failed
    }

Every launch of the kernel then fails with "invalid argument", the context is never written, and the
prefill planner aborts a few layers later. The tensor-core path is unavailable on its own account
(mla_attn_tc_kernel needs 91136 bytes, so tc_ok[dev] = -1 on sm_75 and the F32 kernel is picked)
— the comment above it says exactly that, but it misses that the F32 kernel is over the limit too.
That is why the fallback exists and still crashes.

The decode path has the same request: mla_split_kernel (src/kernels/cuda/glm_fast.cu) asks for
(MLA_CHUNK * kv_lora + MLA_HPB * MLA_CHUNK) * sizeof(float) = (32*512 + 16*32) * 4 = the same
67584 bytes, fails, and silently falls back to the one-pass attention that re-reads the latents once
per head instead of once per chunk.

Fix

The latents are FP16 in global memory already (uint16_t, read back through lat_f()). Staging them
in shared memory in their own 16-bit form costs half of the float staging and reads back the same
values, so the arithmetic is unchanged (same order, F32 accumulation):

32 * 512 * 2 + 16 * 32 * 4 = 34816 bytes   (was 67584)

which Turing takes with room to spare. I also check the opt-in's return value in both files instead
of ignoring it, so this class of failure reports itself.

Result (2x Titan RTX, 48 GB RAM)

  • 18500-token prompt: ~50 s of prefill (350–370 tok/s); before the fix it aborted instantly.
  • A passphrase buried at token ~22000 of a 26000-token document is retrieved correctly at 7k, 13k and
    22k tokens.
  • invalid argument and planned 0 of N routed rows no longer appear.
  • Long-context decode is unchanged (it never reached the F32 prompt path before either).

Reworking mla_attn_tc_kernel so the context O lives in the wmma accumulator registers instead of
shared memory (four 16-wide column tiles a warp; the per-chunk online-softmax rescale multiplies the
fragments in place) brings it to 16384 + 32768 + 8192 + 1024 = 58368 bytes, and tc_ok then
succeeds on sm_75. With STRATA_GLM_PREFILL_ATTN_CHECK=1 the two kernels agree to rel L2 1.27e-04 /
worst head 9.5e-04 (the comment's target is ~1e-3), and prefill at 18.5k tokens measures ~366 tok/s
against ~350 on the F32 kernel — small, because at that length the attention is a minor part of the
prompt path, but it is free.

Happy to send either change as a PR (both are small; I can include the diffs).

Originally created by @dummerjindabin on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/8 ### Environment 2x Titan RTX (sm_75, 24 GB each), 48 GB DDR4, driver 610.57.04, CUDA 12.9/13.0, Ubuntu, Maya-S. Reproduced on cfd2f45 (v1.0.4). `src/kernels/cuda/glm_batch.cu` is byte-identical in 2b0f1a3 (v1.0.6), so the current main branch still has this. ### Symptom Short prompts and short chats are fine. Any prompt longer than roughly a thousand tokens kills the engine: it exits, the server restarts it, and the context resets. Per start the engine log shows: ``` glm_batch mla_attn: invalid argument glm prefill: layer 3 planned 0 of 14848 routed rows glm_batch tab_update: an illegal memory access prefill mmq: iota: illegal memory access glm_fast mla: the split kernel cannot get 67584 bytes of shared memory - the one-pass attention instead ``` ### Root cause `mla_attn_kernel` (src/kernels/cuda/glm_batch.cu, the F32 prompt-attention kernel, MB_CH = 32, MB_HG = 16) asks for ```c smem = (MB_CH * 512 + MB_HG * MB_CH) * sizeof(float) = (32 * 512 + 16 * 32) * 4 = 67584 bytes ``` 2048 bytes over Turing's 65536 ceiling, so ```c cudaFuncSetAttribute(mla_attn_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem) ``` fails with cudaErrorInvalidValue — and its return value is discarded: ```c if (!attr[dev]) { cudaFuncSetAttribute(mla_attn_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem); attr[dev] = true; // set even when the call failed } ``` Every launch of the kernel then fails with "invalid argument", the context is never written, and the prefill planner aborts a few layers later. The tensor-core path is unavailable on its own account (`mla_attn_tc_kernel` needs 91136 bytes, so `tc_ok[dev] = -1` on sm_75 and the F32 kernel is picked) — the comment above it says exactly that, but it misses that the F32 kernel is over the limit too. That is why the fallback exists and still crashes. The decode path has the same request: `mla_split_kernel` (src/kernels/cuda/glm_fast.cu) asks for `(MLA_CHUNK * kv_lora + MLA_HPB * MLA_CHUNK) * sizeof(float)` = `(32*512 + 16*32) * 4` = the same 67584 bytes, fails, and silently falls back to the one-pass attention that re-reads the latents once per head instead of once per chunk. ### Fix The latents are FP16 in global memory already (`uint16_t`, read back through `lat_f()`). Staging them in shared memory in their own 16-bit form costs half of the float staging and reads back the same values, so the arithmetic is unchanged (same order, F32 accumulation): ``` 32 * 512 * 2 + 16 * 32 * 4 = 34816 bytes (was 67584) ``` which Turing takes with room to spare. I also check the opt-in's return value in both files instead of ignoring it, so this class of failure reports itself. ### Result (2x Titan RTX, 48 GB RAM) * 18500-token prompt: ~50 s of prefill (350–370 tok/s); before the fix it aborted instantly. * A passphrase buried at token ~22000 of a 26000-token document is retrieved correctly at 7k, 13k and 22k tokens. * `invalid argument` and `planned 0 of N routed rows` no longer appear. * Long-context decode is unchanged (it never reached the F32 prompt path before either). ### Related: the tensor-core kernel fits Turing too Reworking `mla_attn_tc_kernel` so the context O lives in the wmma accumulator registers instead of shared memory (four 16-wide column tiles a warp; the per-chunk online-softmax rescale multiplies the fragments in place) brings it to `16384 + 32768 + 8192 + 1024 = 58368 bytes`, and `tc_ok` then succeeds on sm_75. With `STRATA_GLM_PREFILL_ATTN_CHECK=1` the two kernels agree to rel L2 1.27e-04 / worst head 9.5e-04 (the comment's target is ~1e-3), and prefill at 18.5k tokens measures ~366 tok/s against ~350 on the F32 kernel — small, because at that length the attention is a minor part of the prompt path, but it is free. Happy to send either change as a PR (both are small; I can include the diffs).
Author
Owner

@dummerjindabin commented on GitHub (Oct 8, 2026):

Speed report - 2x Titan RTX 24 GB (sm_75), Maya-S, v1.0.6

maya-bench.txt from a Turing machine, with the sm_75 shared-memory fix from this issue applied
locally (without it the engine dies on the first long prompt):

Project Maya v1.0.6 benchmark, 2026-10-08 15:13
GPUs: NVIDIA TITAN RTX 24 GB, NVIDIA TITAN RTX 24 GB; RAM 47 GB; CPU 12th Gen Intel(R) Core(TM) i5-12490F
setup: maya-maya-s-v2-iq2_xxs.json, context 32768, GPUs [0, 1]
decode (writing the answer): mean 13.5 tokens/s over 3 answers of 256 tokens (greedy, thinking off)
    12.7 tokens/s  Write a Python function that parses a CSV file into a list of dictionaries, with type hints and a docstring.
    14.2 tokens/s  Explain how photosynthesis works, step by step, for a high-school student.
    13.7 tokens/s  Write a complete HTML page with a canvas that draws a bouncing ball animation in JavaScript.
prefill (reading the prompt): 152 tokens/s, 2048 tokens
prefill (reading the prompt): 238 tokens/s, 8192 tokens

engine lines:
glm prefill: CUDA0 chunks of 3264 tokens, borrowing 1375 MB of the expert pool while a prompt runs (activations 1176, weight scratch 96, expert staging 86); disk landing ring 64 experts (461 MB pinned)
glm fast: CUDA0 VRAM before the expert pool: 4.82 of 23.47 GB in use - dense weights 3.53, state/KV (32768 ctx) 0.47, activations 0.06, other (context, MTP, scratch, prompt path) 0.75
glm fast: CUDA0 layers [0,24) expert pool 17.96 GB, 129-129 slots/layer (2709 total)
glm fast: CUDA0 RAM tier 17.53 GB pinned, 2647 slots
glm fast: CUDA0 the tiers follow this machine's usage profile (~/apps/Maya-data/models/glm-5.3-flash-maya-s-v2-iq2_xxs/pack/expert_usage.txt, 21 layers)
glm fast: CUDA0 tiers warm: 5285 experts (37.6 GB) in 13 s (2.84 GB/s)
glm fast: CUDA0 CPU lane: 3 threads, an expert 0.590 ms on the CPU vs 0.712 ms over PCIe -> of 0..8 RAM-tier experts the CPU takes 0 1 1 2 2 3 3 4 4
glm prefill: CUDA1 chunks of 3264 tokens, borrowing 1375 MB of the expert pool while a prompt runs (activations 1176, weight scratch 96, expert staging 86); disk landing ring 64 experts (461 MB pinned)
glm fast: CUDA1 VRAM before the expert pool: 4.43 of 23.47 GB in use - dense weights 3.32, state/KV (32768 ctx) 0.47, activations 0.07, other (context, MTP, scratch, prompt path) 0.57
glm fast: CUDA1 layers [24,45) expert pool 18.31 GB, 124-124 slots/layer (2728 total)
glm fast: CUDA1 RAM tier 18.37 GB pinned, 2739 slots
glm fast: CUDA1 the tiers follow this machine's usage profile (~/apps/Maya-data/models/glm-5.3-flash-maya-s-v2-iq2_xxs/pack/expert_usage.txt, 22 layers)
glm fast: CUDA1 tiers warm: 5389 experts (38.8 GB) in 18 s (2.18 GB/s)
glm fast: CUDA1 CPU lane: 3 threads, an expert 0.561 ms on the CPU vs 2.124 ms over PCIe -> of 0..8 RAM-tier experts the CPU takes 0 1 2 3 3 4 5 6 7
glm split: layers [0, 24) on CUDA0, [24, 45) on CUDA1 (one 64 KB host hop/token)
glm stat: decode 83.58 ms/tok (11.96 tok/s) | vram hit 74.01% | ram fetches 18.27/tok | disk 5.52 reads/tok in 10.00 waits/tok, 38.70 ms/tok | promotions 26.83/tok | cpu lane 69.66/tok in 60.63 ms/tok | prompt 147.1 ms/tok | vram 5332/5437 ram 5293/5386
glm stat: decode 78.78 ms/tok (12.69 tok/s) | vram hit 73.15% | ram fetches 20.41/tok | disk 5.91 reads/tok in 8.44 waits/tok, 36.17 ms/tok | promotions 26.28/tok | cpu lane 71.11/tok in 60.16 ms/tok | prompt 124.1 ms/tok | vram 5327/5437 ram 5289/5386
glm stat: decode 70.21 ms/tok (14.24 tok/s) | vram hit 76.98% | ram fetches 18.47/tok | disk 4.54 reads/tok in 6.65 waits/tok, 25.61 ms/tok | promotions 23.12/tok | cpu lane 64.99/tok in 53.73 ms/tok | prompt 109.8 ms/tok | vram 5316/5437 ram 5306/5386
glm stat: decode 73.03 ms/tok (13.69 tok/s) | vram hit 74.32% | ram fetches 19.16/tok | disk 5.12 reads/tok in 7.10 waits/tok, 30.61 ms/tok | promotions 24.71/tok | cpu lane 68.33/tok in 57.79 ms/tok | prompt 109.8 ms/tok | vram 5322/5437 ram 5304/5386
glm stat: decode 0.01 ms/tok (96329.83 tok/s) | vram hit 0.00% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.00/tok in 0.00 ms/tok | prompt 6.6 ms/tok | vram 5119/5437 ram 5292/5386
glm stat: decode 0.01 ms/tok (98814.23 tok/s) | vram hit 0.00% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.00/tok in 0.00 ms/tok | prompt 4.2 ms/tok | vram 5098/5437 ram 5285/5386

Field notes that may be worth folding into the README's reference table:

  • Layer split 24/21 across the two cards. The second card's slot is electrically x4 Gen3 (the card
    reports x16 capability), so pulling one 7 MB expert over PCIe costs 2.1 ms there against 0.7 ms on
    the first card; the engine accordingly routes most of that half's RAM-tier experts to its CPU lane
    (0.56 ms per expert on the CPU vs 2.12 ms over PCIe).
  • At 18k context, decode is bound by expert movement: moe_wait + moe_fetch are 62-72% of the
    per-token GPU stream time and the CPU lane holds 43-60 ms per token; the prompt attention (mla)
    is 2-4% there.
  • The 2k prefill figure lands below the 8k one here (152 vs 238) because the 2k run is the first
    prompt after the warm-up answer, with the page cache still cold - the engine's own lines agree
    (6.6 ms/token then 4.2 ms/token). If the two are meant to be compared across machines, the 2k run
    may want a preceding dummy prompt.
  • Against the README's single-V100 numbers (decode 19, prefill up to 370, 64 GB RAM): 13.5 and 238
    at 8k on this box is roughly the HBM2 bandwidth ratio (900 vs 672 GB/s) plus 48 vs 64 GB of RAM.
<!-- gh-comment-id:6054714604 --> @dummerjindabin commented on GitHub (Oct 8, 2026): ### Speed report - 2x Titan RTX 24 GB (sm_75), Maya-S, v1.0.6 `maya-bench.txt` from a Turing machine, with the sm_75 shared-memory fix from this issue applied locally (without it the engine dies on the first long prompt): ``` Project Maya v1.0.6 benchmark, 2026-10-08 15:13 GPUs: NVIDIA TITAN RTX 24 GB, NVIDIA TITAN RTX 24 GB; RAM 47 GB; CPU 12th Gen Intel(R) Core(TM) i5-12490F setup: maya-maya-s-v2-iq2_xxs.json, context 32768, GPUs [0, 1] decode (writing the answer): mean 13.5 tokens/s over 3 answers of 256 tokens (greedy, thinking off) 12.7 tokens/s Write a Python function that parses a CSV file into a list of dictionaries, with type hints and a docstring. 14.2 tokens/s Explain how photosynthesis works, step by step, for a high-school student. 13.7 tokens/s Write a complete HTML page with a canvas that draws a bouncing ball animation in JavaScript. prefill (reading the prompt): 152 tokens/s, 2048 tokens prefill (reading the prompt): 238 tokens/s, 8192 tokens engine lines: glm prefill: CUDA0 chunks of 3264 tokens, borrowing 1375 MB of the expert pool while a prompt runs (activations 1176, weight scratch 96, expert staging 86); disk landing ring 64 experts (461 MB pinned) glm fast: CUDA0 VRAM before the expert pool: 4.82 of 23.47 GB in use - dense weights 3.53, state/KV (32768 ctx) 0.47, activations 0.06, other (context, MTP, scratch, prompt path) 0.75 glm fast: CUDA0 layers [0,24) expert pool 17.96 GB, 129-129 slots/layer (2709 total) glm fast: CUDA0 RAM tier 17.53 GB pinned, 2647 slots glm fast: CUDA0 the tiers follow this machine's usage profile (~/apps/Maya-data/models/glm-5.3-flash-maya-s-v2-iq2_xxs/pack/expert_usage.txt, 21 layers) glm fast: CUDA0 tiers warm: 5285 experts (37.6 GB) in 13 s (2.84 GB/s) glm fast: CUDA0 CPU lane: 3 threads, an expert 0.590 ms on the CPU vs 0.712 ms over PCIe -> of 0..8 RAM-tier experts the CPU takes 0 1 1 2 2 3 3 4 4 glm prefill: CUDA1 chunks of 3264 tokens, borrowing 1375 MB of the expert pool while a prompt runs (activations 1176, weight scratch 96, expert staging 86); disk landing ring 64 experts (461 MB pinned) glm fast: CUDA1 VRAM before the expert pool: 4.43 of 23.47 GB in use - dense weights 3.32, state/KV (32768 ctx) 0.47, activations 0.07, other (context, MTP, scratch, prompt path) 0.57 glm fast: CUDA1 layers [24,45) expert pool 18.31 GB, 124-124 slots/layer (2728 total) glm fast: CUDA1 RAM tier 18.37 GB pinned, 2739 slots glm fast: CUDA1 the tiers follow this machine's usage profile (~/apps/Maya-data/models/glm-5.3-flash-maya-s-v2-iq2_xxs/pack/expert_usage.txt, 22 layers) glm fast: CUDA1 tiers warm: 5389 experts (38.8 GB) in 18 s (2.18 GB/s) glm fast: CUDA1 CPU lane: 3 threads, an expert 0.561 ms on the CPU vs 2.124 ms over PCIe -> of 0..8 RAM-tier experts the CPU takes 0 1 2 3 3 4 5 6 7 glm split: layers [0, 24) on CUDA0, [24, 45) on CUDA1 (one 64 KB host hop/token) glm stat: decode 83.58 ms/tok (11.96 tok/s) | vram hit 74.01% | ram fetches 18.27/tok | disk 5.52 reads/tok in 10.00 waits/tok, 38.70 ms/tok | promotions 26.83/tok | cpu lane 69.66/tok in 60.63 ms/tok | prompt 147.1 ms/tok | vram 5332/5437 ram 5293/5386 glm stat: decode 78.78 ms/tok (12.69 tok/s) | vram hit 73.15% | ram fetches 20.41/tok | disk 5.91 reads/tok in 8.44 waits/tok, 36.17 ms/tok | promotions 26.28/tok | cpu lane 71.11/tok in 60.16 ms/tok | prompt 124.1 ms/tok | vram 5327/5437 ram 5289/5386 glm stat: decode 70.21 ms/tok (14.24 tok/s) | vram hit 76.98% | ram fetches 18.47/tok | disk 4.54 reads/tok in 6.65 waits/tok, 25.61 ms/tok | promotions 23.12/tok | cpu lane 64.99/tok in 53.73 ms/tok | prompt 109.8 ms/tok | vram 5316/5437 ram 5306/5386 glm stat: decode 73.03 ms/tok (13.69 tok/s) | vram hit 74.32% | ram fetches 19.16/tok | disk 5.12 reads/tok in 7.10 waits/tok, 30.61 ms/tok | promotions 24.71/tok | cpu lane 68.33/tok in 57.79 ms/tok | prompt 109.8 ms/tok | vram 5322/5437 ram 5304/5386 glm stat: decode 0.01 ms/tok (96329.83 tok/s) | vram hit 0.00% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.00/tok in 0.00 ms/tok | prompt 6.6 ms/tok | vram 5119/5437 ram 5292/5386 glm stat: decode 0.01 ms/tok (98814.23 tok/s) | vram hit 0.00% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.00/tok in 0.00 ms/tok | prompt 4.2 ms/tok | vram 5098/5437 ram 5285/5386 ``` Field notes that may be worth folding into the README's reference table: - Layer split 24/21 across the two cards. The second card's slot is electrically **x4** Gen3 (the card reports x16 capability), so pulling one 7 MB expert over PCIe costs 2.1 ms there against 0.7 ms on the first card; the engine accordingly routes most of that half's RAM-tier experts to its CPU lane (0.56 ms per expert on the CPU vs 2.12 ms over PCIe). - At 18k context, decode is bound by expert movement: `moe_wait` + `moe_fetch` are 62-72% of the per-token GPU stream time and the CPU lane holds 43-60 ms per token; the prompt attention (`mla`) is 2-4% there. - The 2k prefill figure lands *below* the 8k one here (152 vs 238) because the 2k run is the first prompt after the warm-up answer, with the page cache still cold - the engine's own lines agree (6.6 ms/token then 4.2 ms/token). If the two are meant to be compared across machines, the 2k run may want a preceding dummy prompt. - Against the README's single-V100 numbers (decode 19, prefill up to 370, 64 GB RAM): 13.5 and 238 at 8k on this box is roughly the HBM2 bandwidth ratio (900 vs 672 GB/s) plus 48 vs 64 GB of RAM.
Author
Owner

@mw00 commented on GitHub (Oct 8, 2026):

Thank you for this report, and for testing it on real Turing cards. The diagnosis is right: mla_attn_kernel asks for 67,584 bytes of shared memory, Turing allows 65,536, and the ignored opt-in turns every launch into "invalid argument". RTX 20-series cards have crashed on long prompts since the first release. The v1.0.4 notes said those cards "keep the previous kernel automatically", which assumed that kernel fit. It doesn't.

Yes, please send both as a PR, ideally as two commits:

  1. the FP16 staging in mla_attn_kernel and mla_split_kernel, plus the opt-in return-value checks (this fixes the crash);
  2. the mla_attn_tc_kernel rework with O in the accumulator fragments (58,368 bytes).

That way the crash fix can ship first if the tensor-core change needs more checking. Before merging, we'll run both on Tesla V100 (sm_70), comparing prefill speed and STRATA_GLM_PREFILL_ATTN_CHECK=1, and then release.

One heads-up: the AMD port (#7) halves this kernel's tile (MB_CH = 16) on HIP for the same 64 KiB limit. With your FP16 staging, the 32-row tile fits on RDNA too, so whichever PR lands second needs a small rebase.

<!-- gh-comment-id:6055003566 --> @mw00 commented on GitHub (Oct 8, 2026): Thank you for this report, and for testing it on real Turing cards. The diagnosis is right: `mla_attn_kernel` asks for 67,584 bytes of shared memory, Turing allows 65,536, and the ignored opt-in turns every launch into "invalid argument". RTX 20-series cards have crashed on long prompts since the first release. The v1.0.4 notes said those cards "keep the previous kernel automatically", which assumed that kernel fit. It doesn't. **Yes, please send both as a PR**, ideally as two commits: 1. the FP16 staging in `mla_attn_kernel` and `mla_split_kernel`, plus the opt-in return-value checks (this fixes the crash); 2. the `mla_attn_tc_kernel` rework with O in the accumulator fragments (58,368 bytes). That way the crash fix can ship first if the tensor-core change needs more checking. Before merging, we'll run both on Tesla V100 (sm_70), comparing prefill speed and `STRATA_GLM_PREFILL_ATTN_CHECK=1`, and then release. One heads-up: the AMD port (#7) halves this kernel's tile (`MB_CH = 16`) on HIP for the same 64 KiB limit. With your FP16 staging, the 32-row tile fits on RDNA too, so whichever PR lands second needs a small rebase.
Author
Owner

@mw00 commented on GitHub (Oct 8, 2026):

Update: since this blocks every RTX 20-series user on long prompts, the crash fix shipped in v1.0.7, written along the lines you described and credited to you. mla_attn_kernel and mla_split_kernel now stage the FP16 latents in shared memory (34,816 bytes, under the 48 KB default, so the F32 kernel needs no opt-in at all), and the ignored opt-in is gone.

Checked on a Tesla V100 with Maya-S, a 3,000-token prompt and 200 greedy tokens: the default path gives the same tokens before and after. The F32 prompt kernel matches the tensor-core one on every chunk to a relative L2 of ~7e-5 (worst head ~4e-4). We have no Turing card here, so it would be great to hear that v1.0.7 runs your 18.5k-token prompts on the Titan RTX pair.

The tensor-core rework (O in the accumulator fragments, 58,368 bytes) is still very welcome as a PR. It's the part that brings the faster prefill to Turing, and you've already measured it there.

<!-- gh-comment-id:6055276022 --> @mw00 commented on GitHub (Oct 8, 2026): Update: since this blocks every RTX 20-series user on long prompts, the crash fix shipped in **v1.0.7**, written along the lines you described and credited to you. `mla_attn_kernel` and `mla_split_kernel` now stage the FP16 latents in shared memory (34,816 bytes, under the 48 KB default, so the F32 kernel needs no opt-in at all), and the ignored opt-in is gone. Checked on a Tesla V100 with Maya-S, a 3,000-token prompt and 200 greedy tokens: the default path gives the same tokens before and after. The F32 prompt kernel matches the tensor-core one on every chunk to a relative L2 of ~7e-5 (worst head ~4e-4). We have no Turing card here, so it would be great to hear that v1.0.7 runs your 18.5k-token prompts on the Titan RTX pair. **The tensor-core rework (O in the accumulator fragments, 58,368 bytes) is still very welcome as a PR.** It's the part that brings the faster prefill to Turing, and you've already measured it there.
Author
Owner

@mw00 commented on GitHub (Oct 8, 2026):

Thank you for the Titan RTX bench and the field notes, and sorry for missing this comment earlier. Two changes come from it:

  • --bench will read a warm-up prompt before the 2K measurement, so a cold disk cache doesn't land in the first figure.
  • The prefill-only stat lines (the 96,000 tok/s "decode") will be left out of maya-bench.txt.
<!-- gh-comment-id:6055493477 --> @mw00 commented on GitHub (Oct 8, 2026): Thank you for the Titan RTX bench and the field notes, and sorry for missing this comment earlier. Two changes come from it: - `--bench` will read a warm-up prompt before the 2K measurement, so a cold disk cache doesn't land in the first figure. - The prefill-only stat lines (the 96,000 tok/s "decode") will be left out of `maya-bench.txt`.
Author
Owner

@dummerjindabin commented on GitHub (Oct 8, 2026):

Tested v1.0.7/v1.0.8 on the Titan RTX pair (2x24 GB, sm_75, Maya-S IQ2_XXS, 96K context), an 18,476-token prompt - the case that used to kill the engine:

  • No crashes: zero shared memory / invalid argument / illegal memory access / planned 0 of ... routed rows lines in the run, and three codes buried at ~2k / 9k / 17k tokens came back 3/3 - so the prompt attention really computes now (before the fix it never ran at all). The engine's own log line tells the two runs apart: prompt attention on the F32 cores vs ... on the tensor cores.
  • Prefill, same prompt: 62 s with STRATA_GLM_PREFILL_ATTN=f32, 58 s with the tensor-core kernel (the engine's own figure: 3.4 vs 3.1 ms/tok). Around +10%, which is inside this box's run-to-run spread - on Turing the long-prompt prefill is bound by fetching experts, not by attention, so your V100 A/B is the one that will show the real difference.
  • STRATA_GLM_PREFILL_ATTN_CHECK=1 on the new base, over all 110 chunk checks: rel L2 5.3e-5 .. 1.6e-4 (median 1.1e-4), worst head 2.5e-4 .. 1.3e-3 (median 6.4e-4) - the V100 figures you quoted (~7e-5 / ~4e-4) sit in the same band.
  • Decode at 18.5k: 11.3 - 12.6 tok/s (read those as one number, this box spreads ±15% between runs).
  • One side effect worth knowing: with the FP16 staging in, both of our local patches for this became obsolete - the anchors they were patched onto are gone, exactly as it should be.

The tensor-core rework is up as #10 - one commit, since the crash-fix half is yours in v1.0.7 - with the raw log lines and the A/B recipe in the PR. Thanks for the fast turn-around on #8, and for folding the --bench notes into v1.0.8.

<!-- gh-comment-id:6056633764 --> @dummerjindabin commented on GitHub (Oct 8, 2026): Tested v1.0.7/v1.0.8 on the Titan RTX pair (2x24 GB, sm_75, Maya-S IQ2_XXS, 96K context), an **18,476-token** prompt - the case that used to kill the engine: - **No crashes**: zero `shared memory` / `invalid argument` / `illegal memory access` / `planned 0 of ... routed rows` lines in the run, and three codes buried at ~2k / 9k / 17k tokens came back **3/3** - so the prompt attention really computes now (before the fix it never ran at all). The engine's own log line tells the two runs apart: `prompt attention on the F32 cores` vs `... on the tensor cores`. - **Prefill, same prompt**: 62 s with `STRATA_GLM_PREFILL_ATTN=f32`, 58 s with the tensor-core kernel (the engine's own figure: 3.4 vs 3.1 ms/tok). Around +10%, which is inside this box's run-to-run spread - on Turing the long-prompt prefill is bound by fetching experts, not by attention, so your V100 A/B is the one that will show the real difference. - `STRATA_GLM_PREFILL_ATTN_CHECK=1` on the new base, over all 110 chunk checks: `rel L2 5.3e-5 .. 1.6e-4` (median 1.1e-4), `worst head 2.5e-4 .. 1.3e-3` (median 6.4e-4) - the V100 figures you quoted (~7e-5 / ~4e-4) sit in the same band. - Decode at 18.5k: 11.3 - 12.6 tok/s (read those as one number, this box spreads ±15% between runs). - One side effect worth knowing: with the FP16 staging in, both of our local patches for this became obsolete - the anchors they were patched onto are gone, exactly as it should be. The tensor-core rework is up as **#10** - one commit, since the crash-fix half is yours in v1.0.7 - with the raw log lines and the A/B recipe in the PR. Thanks for the fast turn-around on #8, and for folding the `--bench` notes into v1.0.8.
Author
Owner

@mw00 commented on GitHub (Oct 8, 2026):

Confirmed on your Titan RTX pair for v1.0.7, and the tensor-core prefill for Turing ships in v1.0.10 (#10). Closing - thank you for both, and for the field notes.

<!-- gh-comment-id:6057839444 --> @mw00 commented on GitHub (Oct 8, 2026): Confirmed on your Titan RTX pair for v1.0.7, and the tensor-core prefill for Turing ships in v1.0.10 (#10). Closing - thank you for both, and for the field notes.
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#5
No description provided.