Skip to content

exl3 decode: read the trellis through ld.global.nc.L1::no_allocate - #1534

Merged
ashhart merged 3 commits into
ashhart:mainfrom
BadAd84:exl3-noalloc
Oct 31, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
BadAd84:exl3-noalloc

Conversation

@BadAd84

@BadAd84 BadAd84 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

The expert weight stream is read once per token and never revisited, but every trellis load went through __ldg, which allocates in the read-only cache. On a 163 GiB stream that fills L1 with lines nothing will ask for again, evicting the activations and the small tables that are reused every round.

Production's decode kernel uses ld.global.nc.L1::no_allocate.v4.u32 for exactly this reason (read from its own exl3.cu). This takes the cache policy and nothing else: the same 32-bit value from the same address, bit-identical by construction and proven by reply digest, with the read-only path kept.

Measured on 3x GB10 at TP=3 with GLM-5.3-Flash EXL3 4bpw, three rounds a cell and one fresh boot per cell, decode aggregate tok/s:

streams before after delta
1 44.42 / 44.56 / 44.49 45.54 / 45.62 / 45.44 +2.3%
2 62.15 / 61.92 / 61.87 62.40 / 62.44 / 62.01 +0.5%
4 69.61 / 69.21 / 68.74 70.53 / 70.43 / 71.37 +2.3%
6 79.09 / 78.15 / 79.48 80.27 / 79.76 / 79.68 +1.3%
8 85.30 / 84.48 / 85.44 85.60 / 86.53 / 86.14 +1.2%

No cell regresses. The reply digests are identical across every prompt in the harness set on both builds, so the change is bit-exact.

Not the whole difference, and measured before claiming: production's lanes also read 16 contiguous bytes each where ours read 8, and it stages 1-4 steps ahead through a warp slice; both need a re-tile rather than a load swap, so they are separate work.

@ashhart

ashhart commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84. The load reads the same address and value, and the trellis, MMA, K walk and epilogue are unchanged. The one-line comment in 26bd6540 clears the lean check.

Could you pin the exact GLM checkpoint revision behind your TP=3 numbers, so we can reproduce them?

The shared helper reaches more than the expert decode: the linear, segmented, optional lin2 and unpack callers use it too. So our device run will check outputs, launch resources and SASS for all of them, and every symbol that doesn't call it must stay identical.

@BadAd84

BadAd84 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

The checkpoint is Mia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold at snapshot 078455ffe6472f9a52fbc1139f58b9db2881b25c - exl3 4-bit, mcg codebook, head_bits 16, scope glm53_routed_experts_only, per its config.json. Pulled on 2026-10-27 and unchanged since; the launcher mounts that snapshot path directly.

The rest of the rig, so the numbers reproduce: 3x GB10 at TP=3, --kv-cache fp8, TF_GLM_DENSE_BITS=4, 1,048,576 context, server-default thinking, temperature 0, a prose prompt at max_tokens 200, three rounds a cell and one fresh boot per cell, decode aggregate tok/s.

streams before after
1 44.42 / 44.56 / 44.49 45.54 / 45.62 / 45.44
2 62.15 / 61.92 / 61.87 62.40 / 62.44 / 62.01
4 69.61 / 69.21 / 68.74 70.53 / 70.43 / 71.37
6 79.09 / 78.15 / 79.48 80.27 / 79.76 / 79.68
8 85.30 / 84.48 / 85.44 85.60 / 86.53 / 86.14

On the reach, you have it right and I am glad you checked: the helper is picked up by every caller of ldg_lane_words, not only the expert decode - the linear, segmented, optional lin2 and unpack paths included. That is intended. In each of those the trellis is streamed once per token and never revisited, so a line kept in L1 evicts something that will be reused on the next round.

The value at each address is unchanged, which is what the reply digests are evidence for: both builds produce identical digests across the harness prompt set, so the change is the cache policy and nothing else.

One thing I have not verified and will not claim: the SASS. We built with CUDA 13.3 on GB10, and the only difference I would expect in your toolchain is the constant load acquiring L1::no_allocate in those specialised copies, with no register or launch-resource change - but your device run is the authority on that, and on the symbols that do not call the helper staying identical.

BadAd84 and others added 3 commits October 31, 2026 00:00
The expert weight stream is read once per token and never revisited, but every trellis load went through
__ldg, which allocates in the read-only cache. On a 163 GiB stream that fills L1 with lines nothing will
ask for again, evicting the activations and the small tables that are reused every round.

Production's decode kernel uses ld.global.nc.L1::no_allocate.v4.u32 for exactly this reason (read from its
own exl3.cu). This takes the cache policy and nothing else: the same 32-bit value from the same address,
bit-identical by construction and proven by reply digest, with the read-only path kept.

Not the whole difference, and measured before claiming: production's lanes also read 16 contiguous bytes
each where ours read 8, and it stages 1-4 steps ahead through a warp slice; both need a re-tile rather
than a load swap, so they are separate work.
The lean check allows one comment line of at most 120 columns, and the helper's comment was two lines, which the
gate reported as one new problem (428 against 427 on the base). One line, same content.
@ashhart
ashhart merged commit 5e15106 into ashhart:main Oct 31, 2026
9 checks passed
@ashhart

ashhart commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Thank you @BadAd84. This is in TensorFold 1.2.0, released today: https://github.com/ashhart/TensorFold/releases/tag/v1.2.0

It landed with your commits under your own name, so you're listed as a TensorFold contributor, and it's credited to you in the release notes and the changelog.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants