vllm.models.minimax_m3.amd.mono.layout
¶
Where the mono layer kernel (K4) puts its tasks and data, per decode token count.
Plain Python, evaluated at build time: which CTA runs each stage's tasks, the scratch and peer-symmetric regions, and the LDS row pitches. Kept free of FlyDSL so it is testable without a GPU.
Functions:
-
pool_words–LDS words of the activation pool
x. Narrow: every token's bf16 xn (the -
shared_after_routing–Every CTA carries the same number of routed up / gate tasks (S = 4): a
-
stage_bases–Task t of a stage runs on CTA (base + t) % BLOCKS; the merge (S > 1), o and
-
sym_layout–Per-rank symmetric buffer: attn / ffn partial regions, src rank[HIDDEN],
-
ug_ctas_per_token–CTAs per token of the routed up / gate tasks, token k on CTAs k C .. (k + 1)
-
ug_tasks_of–Routed up / gate tasks CTA
ctaruns. -
wide_moe–The MoE stage groups its work by expert (every distinct expert's weights
_layout(items, align=256)
¶
Byte offsets of (value, tag) pair regions, 8 bytes per pair.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
_shared_base(tokens, router)
¶
First of the SH_TASKS consecutive CTAs that run the shared expert's up / gate before the routing lands. Ranked by the most routed up / gate tasks a window CTA carries (they queue behind it); then, only if that is the most any CTA carries, by its router CTAs (they start it late and would delay the last routed tasks: S = 4, 4 us); then by its down CTAs (S = 2: 43.1 vs 43.7 us); then by its router CTAs anyway.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
pool_words(tokens)
¶
LDS words of the activation pool x. Narrow: every token's bf16 xn (the
largest stage operand). Wide: the largest of the split's PV partials, the up /
gate stage's MXFP8 xn + scales + up partials + router sigmoids, and the down
stage's MXFP8 mids + scales + a zero row.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
shared_after_routing(tokens)
¶
Every CTA carries the same number of routed up / gate tasks (S = 4): a shared-expert CTA routes first and runs its shared half task while its first routed task's weights are in flight, instead of holding its routing back (S = 4 54.51 -> 54.09 us; S = 2, where the shared window sits on CTAs with one task fewer, +0.1).
Source code in vllm/models/minimax_m3/amd/mono/layout.py
stage_bases(tokens)
¶
Task t of a stage runs on CTA (base + t) % BLOCKS; the merge (S > 1), o and down tasks start past the tokens' split CTAs.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
sym_layout(npes)
¶
Per-rank symmetric buffer: attn / ffn partial regions, src rank[HIDDEN],
and the peers' index-selection candidates (sel_cp).
Source code in vllm/models/minimax_m3/amd/mono/layout.py
ug_ctas_per_token(tokens)
¶
CTAs per token of the routed up / gate tasks, token k on CTAs k C .. (k + 1) C - 1: a CTA stages one token's xn, not all (fused layer, S = 4: 57.9 -> 57.6 us). None: round-robin -- S < 4 (S = 2: +0.4 us) or S not dividing the grid.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
ug_tasks_of(cta, tokens)
¶
Routed up / gate tasks CTA cta runs.
Source code in vllm/models/minimax_m3/amd/mono/layout.py
wide_moe(tokens)
¶
The MoE stage groups its work by expert (every distinct expert's weights read once, a B column per token) instead of by (token, slot): past four tokens the per-token tasks re-read the experts the tokens share, and their operands no longer fit in LDS.