Skip to content

feat(moe): select gfx950 TP A8W4 SiTU - #1139

Merged
lightseek-bot merged 12 commits into
lightseekorg:mainfrom
panditsa:sanket/wip-k3-a8w4-select
Aug 27, 2026
Merged

feat(moe): select gfx950 TP A8W4 SiTU#1139
lightseek-bot merged 12 commits into
lightseekorg:mainfrom
panditsa:sanket/wip-k3-a8w4-select

Conversation

@panditsa

@panditsa panditsa commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • register A8W4 SiTU only for the exact Kimi K3 TP8/EP1 shard shape
  • forward optional shared-down tensors through the MoE apply API
  • require exact ispp traits when a kernel declares one

Performance

4K/1K TP8/EP1 CUDA graphs, median of three at head e689319e:

M Output tok/s TTFT TPOT
2 90.60 659.66 ms 21.451 ms
4 173.36 1139.20 ms 21.977 ms

The exact parent does not support this Kimi SiTU TP8/EP1 configuration: it falls into the generic weight-only MXFP4 path and raises Weight-only MXFP4 MoE supports only SwiGLU. This PR therefore enables the configuration; there is no valid parent E2E percentage comparison. The direct kernel comparison is documented in #1138.

Tests

  • TP SiTU reference numerics, explicit output reuse, shared-down fusion, and CUDA graphs: 7 passed
  • exact-ispp selector coverage: 1 passed
  • all 18 measured 4K/1K requests completed with valid 4096-token prompts and 1024-token outputs

Stack

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Project shared weights across M=1/2/4 while scheduling per-token AttnRes reductions, with an MFMA projection at M=4.

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Use fused Gluon for M=1/2 and the composed MFMA path from M=3 through M=16.

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Add the SiTU-v2 epilogue to the package prefill stage and preserve logical K metadata across padded weight aliases.

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Add dynamic FP8 quantization and route-direct A8W4 SiTU decode, including optional shared-down projection and package-prefill fallback.

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
Register the exact Kimi TP8/EP1 shard shape, forward optional shared-down outputs, and cover selection, CUDA graph capture, and reference numerics.

Signed-off-by: Sanket Pandit <sanket.pandit@amd.com>
@panditsa
panditsa force-pushed the sanket/wip-k3-a8w4-select branch from e689319 to bcebe08 Compare August 19, 2026 20:21
@panditsa
panditsa force-pushed the sanket/wip-k3-a8w4-core branch from 49adbc9 to 07fded4 Compare August 19, 2026 20:25
@panditsa
panditsa marked this pull request as ready for review August 26, 2026 03:27
@panditsa
panditsa requested review from a team as code owners August 26, 2026 03:27
@panditsa
panditsa changed the base branch from sanket/wip-k3-a8w4-core to main August 26, 2026 03:28
@panditsa panditsa changed the title (WIP) feat(moe): select gfx950 TP A8W4 SiTU feat(moe): select gfx950 TP A8W4 SiTU Aug 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcebe08a43

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +334 to +336
shared_input: torch.Tensor | None = None,
shared_weight: torch.Tensor | None = None,
shared_out: torch.Tensor | None = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the new shared-projection API

Document these parameters in the exported tokenspeed_kernel.moe_apply docstring, including their all-or-none requirement, expected shapes, backend limitations, and the tuple return produced when shared projection is enabled. Without that contract, callers cannot safely use the newly public arguments or determine when the return type changes from a tensor to (routed, shared).

AGENTS.md reference: AGENTS.md:L45-L47

Useful? React with 👍 / 👎.

Comment thread tokenspeed-kernel/python/tokenspeed_kernel/ops/moe/__init__.py
Comment thread tokenspeed-kernel/python/tokenspeed_kernel/selection.py Outdated
@nirvedhmeshram

Copy link
Copy Markdown

Hi you might already be aware but, just FYI, using the tp8ep1 (A8W4) I got accuracy issues

# prompt expected --ep-size 8 (A16W4) --ep-size 1 (A8W4)
1 What is 17 * 24? 408 408 no answer — 512 tok, finish_reason=length, repetition loop
2 Compute 2^16. 65536 65536 echoes the prompt back
3 Capital of Australia? Canberra Canberra no answer — 512 tok, finish_reason=length
4 First 8 prime numbers 2, 3, 5, 7, 11, 13, 17, 19 2, 3, 5, 7, 11, 13, 17, 19 2, 3, 5, 7, 9, 11, 13, 17
5 120 km in 1.5 h, speed? 80 80 no answer — 512 tok, finish_reason=length
6 One sentence: why is the sky blue? (one sentence) correct no answer — 512 tok, finish_reason=length
7 Capital of France? Paris Paris echoes the prompt back
8 Is 91 prime? no, 7 x 13 No... 91 = 7 x 13 no answer — 512 tok, finish_reason=length

EP8: 8/8 correct. EP1: 3/8 terminate at all, and all three are wrong — 0/8 correct.

Here is my experimental branch based on this work, that captures the state as it was yesterday, if it has changed since then, then please ignore this
https://github.com/nirvedhmeshram/tokenspeed/tree/a8w4-tp8ep1

@panditsa

panditsa commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Hi you might already be aware but, just FYI, using the tp8ep1 (A8W4) I got accuracy issues

prompt expected --ep-size 8 (A16W4) --ep-size 1 (A8W4)

1 What is 17 * 24? 408 408 no answer — 512 tok, finish_reason=length, repetition loop
2 Compute 2^16. 65536 65536 echoes the prompt back
3 Capital of Australia? Canberra Canberra no answer — 512 tok, finish_reason=length
4 First 8 prime numbers 2, 3, 5, 7, 11, 13, 17, 19 2, 3, 5, 7, 11, 13, 17, 19 2, 3, 5, 7, 9, 11, 13, 17
5 120 km in 1.5 h, speed? 80 80 no answer — 512 tok, finish_reason=length
6 One sentence: why is the sky blue? (one sentence) correct no answer — 512 tok, finish_reason=length
7 Capital of France? Paris Paris echoes the prompt back
8 Is 91 prime? no, 7 x 13 No... 91 = 7 x 13 no answer — 512 tok, finish_reason=length

EP8: 8/8 correct. EP1: 3/8 terminate at all, and all three are wrong — 0/8 correct.

Here is my experimental branch based on this work, that captures the state as it was yesterday, if it has changed since then, then please ignore this https://github.com/nirvedhmeshram/tokenspeed/tree/a8w4-tp8ep1

This issue is now fixed.

@lightseek-bot
lightseek-bot merged commit 4cb7714 into lightseekorg:main Aug 27, 2026
47 of 54 checks passed
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.

4 participants