Skip to content

CUDA EXL3 grouped experts: launch and size storage at the caller's tile and pair count - #2843

Merged
ashhart merged 4 commits into
mainfrom
lead/exl3-grouped-tile
Nov 12, 2026
Merged

ashhart merged 4 commits into
mainfrom
lead/exl3-grouped-tile

Conversation

@ashhart

@ashhart ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner

On CUDA, the shared EXL3 grouped-expert path launched its decode grid at 64 rows a member and sized its pair storage for 64 pairs an item, although decode and verify callers route at a 16-row tile. Three quarters of the decode grid's workgroups exited at once, and storage was sized for four times the pairs a step can make.

What changes:

  • Grouped.run and bytes take the real pair count and the caller's tile (16 or 64; any other tile is refused with TileNotBuilt): maxm is the tile, grid.z is mats * sk * (tile / 16), and x0, x1 and z are spaced by pairs instead of items * 64.
  • experts.Grouped.decode and prompt pass both through; other formats ignore them.
  • Every caller passes its own tile: decode and verify 16, wide prompts 64, MiniMax-M3's prefill 64 (it goes through decode(), so a smaller tile there would drop members). Qwen sizes its grouped storage once at max_rows * slots: on Qwen3.6-35B-A3B that is 36,864 pair rows where it was 163,904, about 3 GB less.
  • No kernel source changes, so the kernel contract's launch-limit records stand.

Exactness: the split count depends on the shape only; each (pair, split, matrix) partial comes from the same warps over the same K range, and the finish adds splits in order; the pair stride is addressing only.

Checks: host tests that bytes for 144 pairs is exactly 144 times one pair at both tiles, that tiles 0, 8, 15, 17, 32, 48 and 128 are refused, and a recording driver that checks the grid, the stage, the kernel's pairs and maxm, the offsets, and that tile 64 covers all 64 members. A device test, exl3-grouped-tile, compares up and down outputs byte for byte between tile 16 and the old 64 at 1, 4 and 16 decode rows, with a tile-64 plan through decode() and a planted mutant that must fail. test-exl3, test-minimax-cuda-host, the Qwen EXL3 host steps, compile-cuda-tests -Dtarget=aarch64-linux-gnu, zig fmt --check and the lean count pass.

Still to run before landing: tf-cuda-test exl3-grouped-tile on a GB10, and a served check on an EXL3 MoE checkpoint (Qwen3.6-35B-A3B EXL3: decode at 1 and 4 streams with and without MTP, prompt at 2K and 8K, start-up memory; MiniMax-M3.1 EXL3 at TP=2, one stream) with replies equal.

For #2823.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Device result on a GB10 (sm_121): exl3-grouped-tile passes. Tile 16 and the old 64 give bit-equal up and down outputs at 1, 4 and 16 decode rows, a tile-64 plan through decode() is bit-equal too, and the planted mutant (tile 16 on a tile-64 plan) drops members 16 to 63 as it should. An independent read found it ready. We don't have an EXL3 MoE checkpoint on our GB10s for a served speed run, so this lands on its exactness and the memory it returns; queued to land.

  • Synthena (Ash's Agent)

…air count (#2823)

Grouped.run and bytes take the real pair count and the caller's tile (16 or 64; any other tile is refused with TileNotBuilt). maxm is the tile, grid.z is mats * sk * (tile / 16), and x0, x1 and z are spaced by pairs instead of items * 64. Every caller passes its own tile: decode and verify 16, wide prompts 64, MiniMax-M3's prefill 64. Qwen sizes its grouped storage once at max_rows * slots. No kernel source changes.
@ashhart
ashhart force-pushed the lead/exl3-grouped-tile branch from 0f969e9 to 4c61cbe Compare November 12, 2026 13:33
@ashhart
ashhart merged commit 6c5cef8 into main Nov 12, 2026
5 of 13 checks passed
@ashhart
ashhart deleted the lead/exl3-grouped-tile branch November 12, 2026 13:33
ashhart added a commit that referenced this pull request Nov 12, 2026
ashhart added a commit that referenced this pull request Nov 12, 2026
test-gradient-serving (the serving kernels' and launch wrappers' source
hashes) and test-qwen-serving-host (the dense serving launch sequence) ran
only in the macOS nightly. A PR that changed a pinned file therefore landed
green and turned the next nightly red: 10, 11 and 12 Nov, and again now,
because #2843 (3768bc0) changed zig/src/cuda/experts.zig.

- no-gpu.yml runs both steps on every PR, after the goldens, so a change to a
  pinned file needs its re-pin in the same PR.
- gradient-serving.tsv re-pins experts.zig with #2843 named beside it: the
  grouped EXL3 experts are launched and sized at the caller's tile and pair
  count; no kernel source changed.

test-gradient-serving: 1/1 pass.
ashhart added a commit that referenced this pull request Nov 12, 2026
test-gradient-serving (the serving kernels' and launch wrappers' source
hashes) and test-qwen-serving-host (the dense serving launch sequence) ran
only in the macOS nightly. A PR that changed a pinned file therefore landed
green and turned the next nightly red: 10, 11 and 12 Nov, and again now,
because #2843 (3768bc0) changed zig/src/cuda/experts.zig.

- no-gpu.yml runs both steps on every PR, after the goldens, so a change to a
  pinned file needs its re-pin in the same PR.
- gradient-serving.tsv re-pins experts.zig with #2843 named beside it: the
  grouped EXL3 experts are launched and sized at the caller's tile and pair
  count; no kernel source changed.

test-gradient-serving: 1/1 pass.
ashhart added a commit to BobClawblaw/TensorFold that referenced this pull request Nov 13, 2026
ashhart#1630 adds the bf16 experts format to Grouped (experts.zig) and registers the
experts_bf16 image (kernels.zig); no existing kernel source changed. Both rows
are recomputed on main after ashhart#3011, which re-pinned experts.zig for ashhart#2843.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 13, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to BobClawblaw/TensorFold that referenced this pull request Nov 13, 2026
ashhart#1630 adds the bf16 experts format to Grouped (experts.zig) and registers the
experts_bf16 image (kernels.zig); no existing kernel source changed. Both rows
are recomputed on main after ashhart#3011, which re-pinned experts.zig for ashhart#2843.
ashhart added a commit that referenced this pull request Nov 13, 2026
#1630 adds the bf16 experts format to Grouped (experts.zig) and registers the
experts_bf16 image (kernels.zig); no existing kernel source changed. Both rows
are recomputed on main after #3011, which re-pinned experts.zig for #2843.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 19, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 19, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 19, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 23, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
ashhart added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 26, 2026
…#2843 asks

Main's ashhart#2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
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.

1 participant