Pull Request已成功合入, 合并人@CANN-robot
(感谢 weiyan_hw 的贡献)Hi @weiyan_hw, welcome to submitting your first PR to cannbot-dsl!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cannbot-dsl | ✅ liujun2025, yang-jiwei (2/2) | ✅ liujun2025, yang-jiwei (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
weiyan_hw, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm
/approve


/lgtm
/approve


当前PR是否有AI参与
是。本 PR 的样例代码编写与仓内适配由 AI 辅助完成(平台:CANNBot / opencode,模型:GLM)。两个算子的内核设计、tiling 策略与性能调优为人工完成,AI 参与了代码落地、编码规范整改、测试与文档整理,全部改动已经过 133 个 NPU 精度用例回归验证。
PR功能描述 / 为什么需要这个合入
新增两个矩阵乘样例,补齐
samples/matmul/家族的调度与量化覆盖:1. matmul_streamk(Stream-K / DPSK 矩阵乘,A16W16) —
samples/matmul/matmul/matmul_streamk.pymatmul_streamk():C[M,N] = A[M,K] @ B[K,N],float16/bfloat16,transpose_a=False、transpose_b=Falseget_mem_size)自适应推导 tile / 缓冲深度 / L2 cache 策略samples/matmul/matmul/README.md已预埋的 Stream-K 文档章节2. quant_batch_matmul_mxa8w4(混合量化矩阵乘,MXFP8 激活 × MXFP4 权重) —
samples/matmul/quant_matmul/quant_batch_matmul_mxa8w4.pymatmul_mix_quant():C[M,N] = (A·sa)[M,K] @ (B·sb)[N,K]^T + bias,A 为 fp8 e4m3 + E8M0 paired-scale,B 为 uint8 打包 fp4 e2m1 + E8M0 paired-scale,输出 float16deq_scale=64与 host 侧bias/64补偿),经 CrossCore 通道交接到 AIC MX matmulaclnnQuantMatmulV5:100 形状 geomean 1.170,76/100 领先,小形状(K ≤ 1024)最高 2.28x附属更新:两个样例的 pytest 精度测试(82 + 51 用例)、
figures/性能对比图、根 README 算子表与目录说明、CHANGELOG 条目。该PR关联的issue
fixes #(暂无关联 issue)
希望检视人员了解
MixQuantKernel.__call__与_MixQuantLauncher.run保留 6 参数 GM 操作数列表——已实测验证 cannbotdsl 内核绑定仅接受 Tensor/标量载体,张量结构体打包会被ST101_UNSUPPORTED_DYNAMIC_ARGUMENT拒绝,该签名无法收敛到 6 参数以下(约束已注释在 launcher 上)改动类型 / Change Type
测试信息 / Testing
本地环境:Ascend 950PR(NPU ARCH 3510)+ cannbotdsl 0.6.0 + CANN 9.2.0,命令:
pytest test/matmul/matmul/test_matmul_streamk.py -v # 82 用例 pytest test/matmul/quant_matmul/test_quant_batch_matmul_mxa8w4.py -v # 51 用例结果:133/133 全部通过(0 失败),覆盖 DP/SK 混合调度、非对齐尺寸、极端形状、尾块/多窗/深环、bias 场景与输入校验;ruff 检查与 OAT 合规检查通过。
检查清单 / Checklist