You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0319803
Browse filesBrowse the repository at this point in the historyBrowse files
* gemm: DeepSeek-V4.1-Flash DEP8 GEMMs (decode-row MXFP8 shapes, wo_a, mHC post-mix epilogues, lm_head)
New packages for the DEP8 (8 x MI355X, attention TP1) shapes:
- mxfp8_decode_prequant: decode-row MXFP8 GEMM on pre-quantized rows, with a clamped SwiGLU + MXFP8 epilogue.
- mxfp8_n1792_k5120 (wq_a | wkv), mxfp8_n32768_k1280 (wq_b), mxfp8_n4096_k1280 (indexer wq_b), mxfp8_n4608_k5120
(shared gate_up), mxfp8_n5120_k2304 (shared down), mxfp8_n5120_k8192 (wo_b): per-shape row tables over
mxfp8_decode_prequant and mxfp8_common, falling back to AITER where it is faster.
- mxfp8_n5120_k15360: the DSpark draft's input projection.
- mxfp8_grouped_g8_n1024_k4096: grouped wo_a with bf16 or MXFP8 output.
- mxfp8_postmix_hc4_n5120_k8192, mxfp8_postmix_add_hc4_n5120_k2304: wo_b / shared down with the mHC post-mix epilogue.
- bf16_k5120_n1056_f32_n32: compressor kv|score (fp32) + indexer weights_proj (bf16) in one launch.
- bf16_n129280_k5120: the full-vocabulary lm_head.
- mxfp8_n25600_k6144: the Engram wkv rows, a shape folder registered in mxfp8_common's _SHAPE_HOSTS.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* norm, activation: RMSNorm + MXFP8, dual RMSNorm, mHC seams, clamped SiLU-mul + MXFP8
- norm/rmsnorm_mxfp8_h5120, norm/rmsnorm_dual_mxfp8_q1280_kv512: RMSNorm with the MXFP8 quant fused.
- norm/mhc_post_pre_rmsnorm_h5120: the mHC seam (post-mix, gates, collapse, RMSNorm, optional MXFP8) in one launch.
- norm/mhc_gate_finish_rmsnorm_h5120: the seam finisher on the post-mix GEMM's tile records.
- norm/mhc_post_collapse_rmsnorm_h5120: the step-end post-mix + collapse + final RMSNorm.
- activation/clamp_silu_mul_mxfp8_i2304: clamped SiLU-mul + MXFP8 quant for the shared expert's down GEMM.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* attention: sparse MLA decode, RoPE + fp8 KV insert, compressor insert (64 heads x d512)
- sparse_mla_decode_fp8kv_h64_d512_rot64: sparse decode attention over the e4m3 KV cache with an inverse-RoPE +
MXFP8 epilogue for wo_a.
- rope_fp8_kv_insert_h64_d512_rot64: query RoPE + e4m3 quant and KV RoPE + e4m3 cache insert.
- compressor_insert_d512_idx128_rot64: compressor pool + RMSNorm + RoPE and the latent / indexer key cache inserts.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* indexer: MXFP4 top-512 indexer and the indexer query RoPE + MXFP4 quant
- indexer_mxfp4_h32_d128_top512: top-512 over MXFP4 index keys for decode rows without writing the logits (dense,
candidate-source and candidate-consumer layers, optional ragged slot lists), rows up to 1048576 entries.
- q_rope_mxfp4_quant_h32_d128_rot64: indexer query RoPE + MXFP4 quant + weight scaling in one launch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* moe: fused EP8 MoE, MXFP8 x MXFP4 routed experts, sqrt-softplus routers
- fused_ep_mxfp4_h5120_i2304_e48_top6_ranks8: one launch per rank for a whole EP8 MoE layer (quant, dispatch,
GEMM1 + clamped SwiGLU, GEMM2, combine) over IPC pools on one node; tests/multi_gpu8.py runs its 8-rank test.
- mxfp4_h5120_i2304_e48_top6, mxfp4_h5120_i2304_e16_top3: one EP rank's routed experts (main and DSpark draft layers).
- router_sqrtsoftplus_top6_h5120_e384, router_sqrtsoftplus_top3_h5120_e128: gate GEMM + biased sqrt-softplus top-k.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* sampling: one-launch Markov draft chain and standard rejection sampling (vocab 129280, 5 draft tokens)
- markov_chain_gumbel_bf16_v129280_r256_s5: all 5 Markov draft steps of every request in one launch.
- rejection_standard_v129280_s5: standard rejection sampling on the raw bf16 lm_head rows, two launches.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* engram: n-gram row pull over eight ranks and the gated Engram update
- ngram_rows_mxfp8_d256_c24_ranks8: n-gram hash + MXFP8 row pull from the owner ranks' tables (IPC), written as the
wkv GEMM's activation.
- gated_post_bf16_h5120_hc4: the gated Engram update of the four residual streams.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* Index the new packages; 8-GPU CI rows for the Engram and fused EP tests
amd_kernels/README.md: one line per new package (new section Engram). tools/ci/targets.tsv: the two 8-rank tests
(engram/ngram_rows_mxfp8_d256_c24_ranks8/test_ngram_rows_ranks8.py, moe/fused_ep_..._ranks8/test_fused_ranks8.py)
get 8 GPUs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* One shape-agnostic entry per op for the new ops (#11)
Callers (vLLM) no longer import shape packages for the DeepSeek-V4.1-Flash DEP8 ops. Each op gets one entry
that reads the shape from its tensors and routes to the shape package; the packages are unchanged.
- amd_kernels/routes.py: an op's registry (shape key -> shape package, imported on first use).
- amd_kernels/<category>/__init__.py: per op, `<op>(...)` (the shape package's arguments), `<op>_blocker(...)`
(None, or the reason a call is not covered, from host metadata only: the caller falls back) and `<op>_shapes()`.
attention: sparse_mla_decode, rope_fp8_kv_insert, compressor_insert; indexer: mxfp4_indexer_topk /
_candidate_topk, q_rope_mxfp4_quant; moe: router_topk, mxfp4_experts, expert_parallel (fused EP, a collective);
norm: rmsnorm_mxfp8, rmsnorm_dual_mxfp8, mhc_post_pre_rmsnorm, mhc_post_collapse_rmsnorm, mhc_gate_finish;
activation: clamp_silu_mul_mxfp8; sampling: markov_chain, rejection_sample; engram: ngram_rows, gated_post;
gemm: mxfp8_gate_up_swiglu_mxfp8, mxfp8_postmix_gemm / _gates_gemm, mxfp8_grouped_gemm(_mxfp8), bf16_gemm,
bf16_gemm_f32_bf16.
- MXFP8 dense linears: no new entry. The DEP8 shape folders (1792 x 5120, 4096 x 1280, 4608 x 5120, 5120 x 2304,
5120 x 8192, 5120 x 15360, 32768 x 1280) are registered in gemm._SHAPE_HOSTS with their common-kernel ROWS; a
folder with entries of its own adds `linear` / `gemm` (mxfp8_linear on bf16, mxfp8_gemm on row-major codes run
the folder's entry where its table has a row), `covers` and `warmup`. New mxfp8_linear_blocker(m, n, k,
out_dtype, prequant) answers per row count; tuned_shapes() lists the new shapes. Upstream shapes: unchanged.
- tests/test_op_entries.py (CPU): every route names a package, uncovered keys and limits decline with a reason,
every entry calls its package with the caller's arguments. tests/gemm/mxfp8_common/test_folder_entries.py (GPU):
the common entries return the folder entries' results bit for bit.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* moe/fused_ep_mxfp4_h5120_i2304_e48_top6_ranks8: interleave an expert's route records over its row blocks
Block b of an expert with n blocks takes records b, b + n, ... instead of a contiguous
range. Records arrive grouped by source rank, so a contiguous split sent a hot expert's
GEMM2 returns over one or two links at a time. Outputs are bitwise identical; zipf routing
T 384-768 is 14 % faster, lognormal sigma 1.8 at T 710 12 %, uniform unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* Decode rows 769-1024: router, kv_score, wq_b and wo_b tuned rows
Four row tables for the padded decode steps above 768 rows (c1024 runs 816-864):
- moe/router_sqrtsoftplus_top6_h5120_e384: one tile row up to 1024 rows for the plain and the
shuffled gate (20.5-20.7 us shuffled against 28.6-30.3 us served; the untuned large tile took 34-43 us).
- gemm/bf16_k5120_n1056_f32_n32: MAX_M 1024, one tile row per column split above 768 rows
(1.12-1.40x over the two torch launches).
- gemm/mxfp8_n32768_k1280: mxfp8_linear_prequant, row-major codes and scales of the norm
producer through the 4-wave kernel after one scale-layout launch (2.3-6.4 us under AITER on the
same codes at 769-1024 rows, same bytes); preshuffle_weight_scale for the served linear's weight.
- gemm/mxfp8_n5120_k8192: decode rows up to 1024 (96x80 / 112x80 / 128x80, 2 K-waves);
serves_after_wo_a(m): wo_a's bf16 output + this entry beats wo_a's MXFP8 epilogue + AITER by
2.4-8.8 us a pair at 769-1024 rows.
Tests, benchmarks (prequant scenario, wo_a + wo_b pair) and READMEs included.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* fused EP8 8-GPU test: 49 experts per rank
vLLM's shipped DeepSeek-V4.1 expert plan holds one replica slot per rank (S = 49), the geometry the
fused EP8 kernel runs under it. Cover it at decode rows up to 1024 per rank (skewed, uniform 848, one hot
rank with 1024 rows and empty ranks) and under CUDA graph replay.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* READMEs and tests for decode rows 769-1024 and 49 experts per rank
- gemm/mxfp8_n32768_k1280, gemm/mxfp8_n5120_k8192: one performance table each (the pre-quantized and wo_a + wo_b
pair rows join the main table), one-line entry points.
- moe/fused_ep_...ranks8: 48, 49, 56 and 63 experts per rank are tested.
- gemm/bf16_k5120_n1056_f32_n32: the 769-1024-row range is the measured one.
- tests/test_op_entries.py: blocker checks for the 769-1024-row codes path and the wo_b rows up to 1024.
- test_mhc_seam::test_warmup_covers_every_size: turn the first-call warm-up on, as serving runs it; with it off
only m = 16 compiled and the test passed only on a warm FlyDSL disk cache.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
* fused EP8: wrap-safe epoch waits, rows_hint clamped to the token bound, no trace switch from the environment
- The arrival and finish waits compared `got < ep + 1` as signed int32. The epoch counts every call and is never
reset, so at call 2^31 - 1 `ep + 1` wraps to INT_MIN, every rank skips both waits once and reads counts and the
inbox before the peers wrote them. The waits compare the difference now (`(got - (ep + 1)) < 0`), as main's
all_to_all_bf16_n100032_ranks2 does.
- `sized_tokens` took `rows_hint` above 1024 as the tile size and `config_for` raised StopIteration on that rank
before the launch, while the other ranks waited in the kernel. The hint is clamped to MAX_TOKENS.
- AKR_EP_TRACE chose a kernel build from the environment; `kernel.TRACE` is a module constant now, which
benchmark_timeline.py sets in each rank before the first compile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Taoyu Zhu <zhutaoyu97@gmail.com>
* sparse_mla_decode: decline more keys per row than the kernel holds
The kernel holds at most MAX_KEYS (1024) keys per row and drops the rest without an error; the entry's key (64 heads,
512 dims) does not show the per-row key count, so a model with the same heads and more keys per row passed the
blocker and got a wrong result. `supports_sparse_mla_decode` and `sparse_mla_decode_blocker` take an optional
`keys_per_row` (window plus top-k, known to the caller) and decline above MAX_KEYS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Taoyu Zhu <zhutaoyu97@gmail.com>
---------
Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
Signed-off-by: Taoyu Zhu <zhutaoyu97@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Taoyu Zhu <zhutaoyu97@gmail.com>
0 commit comments