Repository navigation
Conversation
Add an opt-in H64 pipeline specialization selected for B200 with 148 SMs and QNorm disabled. Keep the original specialization for other devices, H128, V4 Decode and mixed FP4 caches. The 32-element validity mask bypasses redundant predicates only when every bit is set; partial and empty masks retain the existing handling.
Load the 32-bit validity word after index production and before the QK completion wait. Preserve the original index-buffer lifetime and barrier ordering in fallback specializations.
Reuse the immediately preceding PV KV-empty full-completion signal before overwriting the single S buffer or rescaling O. Track the slot and phase across CLC jobs, starting at slot 2 / phase 1. This is restricted to the one-CTA, three-KV-slot H64 prefill pipeline; Decode and other specializations retain the separate S/O signal.
Read the last two x32 output tiles into registers before processing either tile. Wait for all TMEM reads and preserve the 128-reader handoff before allowing the next query to overwrite O. Keep per-tile RoPE, reductions, quantization and final-job behavior unchanged. The fallback path still releases O after its last tile load.
Use idle warp 11 for MMA issuance in the measured large-query prefill cases. Preserve warp 8 for smaller or unmeasured shapes, and keep the warpgroup, math, barriers and participant counts unchanged. The original pipeline suggested contention between warp 8 and Softmax warp 12. Hardware timing supports a small gain; it does not establish exclusive scheduler causality.
Use one elected warp-11 thread to fetch the next raw FP8 block while WG1 converts and stores the current block. Replace three BF16 slots with two slots plus an independent 36,864-byte raw buffer. All 128 consumers finish raw loads before releasing the raw slot. Account for the additional issuer in index-buffer and CLC barriers. Preserve the measured Decode assignment of MMA/CLC to warps 9/8. Mixed FP4, H128 and QNorm paths keep the original in-place pipeline.
Open
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(1)这个 kernel 将 Q RMSNorm(可选,本次关闭)→ Q RoPE → 稀疏注意力(QK、Softmax、PV)→ 输出逆 RoPE → FP8 量化 融合在一次 kernel 执行中。
(2)**Prefill 和 Decode 共用一份模板实现,通过编译期分支生成各自的内核。**本次优化 H=64、关闭 QNorm 的路径:Prefill 使用 BF16 KV,Decode 使用全 FP8 KV;优化入口限定 B200(148 SM)。
(3)使用 DeepSeek 官方
tests/test_fused_norm_rope_attn_rope_cast.py的性能用例和计时方法,对比 main(ba89a34)与本分支(2e388e7)。配置为 H=64、D=512、TopK=640,QNorm 关闭。Prefill 的 query 数为总 token 数;Decode 为请求数 × 每请求 token 数。区间来自两组随机输入,每组各做 5 轮交错测量。加速幅度按每轮配对耗时计算:(优化前耗时 ÷ 优化后耗时 − 1)× 100%。全部输出与 main 逐字节一致,并通过官方参考检查。
(4)六个优化点分为三类:隐藏延迟、减少重复工作、减轻调度竞争。
最后一项的目的是分散 MMA 和 Softmax 的调度压力,仅用于实测有收益的配置:TopK=640,query 数/上下文为 1024/32768、4096/8192、4096/32768。