[KernelSwift 算子创新大赛][T1, T2, T3, T4]tuolajilatuo - #106
Open
xu-zhengzhong wants to merge 6 commits into
Open
Conversation
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.
KernelSwift 算子创新大赛参赛信息
PR 概述
本 PR 面向 LLM 推理场景,基于 NineToothed DSL 新增并优化以下四个算子:
block_scaled_fp8_mmmxfp4_w4a16_grouped_mmrms_norm_gatedfused_mla_rope_cache_write本 PR 的改动均属于 A 部分,不包含 B 部分的编译器或后端修改,也未修改 NineToothed、Triton、CoreX 或 HIP 后端源码。
主要改动
Block-scaled FP8 MM
BlockWise1x128和BlockWise128x128scale 布局的 FP8 GEMM。MXFP4 W4A16 Grouped MM
[G, K, N]反量化权重。Gated RMSNorm
norm_before_gate=True/False。Fused MLA RoPE Cache Write
slot=-1跳过语义和非连续输入。[kv_c | RoPE(k_pe)]cache entry,避免按 head 展开。工程与评测
新增四个算子的定向测试和 benchmark。
新增统一构建、测试及评测脚本:
新增构建评测说明和技术报告。
在
ntops.kernels与ntops.torch中导出新增公开 API。正确性验证
技术报告记录的验证结果如下:
78 passed, 2 skipped。uint8路径已实际执行并通过。测试命令:
性能结果摘要
在天数智芯 MR-V100 上:
5.27x–6.37x加速。6.95x–7.74x加速。6.47x–42.27x加速。2.67x加速。在海光 BW/gfx936 上,MXFP4 uniform 场景已取得收益;其他部分路径仍受 codegen、wave 配置及 launch/lowering 开销影响,相关 负收益及适用边界已在技术报告中如实记录。
已知限制
BlockWise1x32,暂不支持 activation scale、bias、swizzle 和 grouped-K。