已合并
[feat]: A5 Support for groupmatmul s8s4 requirements #5672
bynshard创建于 15 天前
[feat]: A5 Support for groupmatmul s8s4 requirements #5672
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 bynshard 的贡献)atomgit-bot
15 天前 评论:
15 天前 评论:
变更摘要
此 PR 在 npu_grouped_matmul 函数中新增了对 a8w4 量化模式的识别与处理逻辑。当输入张量满足 x 为 ACL_INT8、weight 为 ACL_INT32、scale 为 ACL_UINT64 且 scale 非空时,标记为 a8w4 场景;在该场景且无 offset 的情况下,将传递给 aclnnGroupedMatmulWeightNz 算子的 quant_per_group_size 参数从固定值 0 改为 256,以适配 a8w4 权重 NZ 格式的分组矩阵乘计算。
主要改动
- 新增 a8w4 模式识别变量
is_a8w4:通过判断x_wrapper.dtype、weight_wrapper.dtype、scale_wrapper.dtype和scale_real是否为空,组合出一个布尔标志,用于标识当前为 int8 激活 / int4 量化的混合精度计算场景。 quant_per_group_size赋值逻辑调整:将原本固定为0的quant_per_group_size改为条件赋值 — 当处于 a8w4 模式且offset_real为空时取值为256,否则保持0,以正确适配 a8w4 在 FRACTAL_NZ 权重格式下的分组量化参数。


ascend-robot
15 天前 评论:
15 天前 评论:
atomgit-bot
15 天前 评论:
15 天前 评论:
15 天前 添加了label:ascend-cla/no
此处折叠了126条消息 查看更多
8 天前 添加了label:ci-pipeline-passed
ascend-robot
8 天前 评论:
8 天前 评论:
流水线 PR-pipeline_op-plugin#3186 [ commitID:3c861f6a ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_master_ARM | ✅ | >>> |
| Build_v2_7_1_ARM | ✅ | >>> | |
| Build_v2_9_0_ARM | ✅ | >>> | |
| Build_v2_10_0_ARM | ✅ | >>> | |
| Build_v2_11_0_ARM | ✅ | >>> | |
| Build_v2_12_0_ARM | ✅ | >>> | |
| Build_master_x86 | ✅ | >>> | |
| Build_v2_7_1_x86 | ✅ | >>> | |
| Build_v2_9_0_x86 | ✅ | >>> | |
| Build_v2_10_0_x86 | ✅ | >>> | |
| Build_v2_11_0_x86 | ✅ | >>> | |
| Build_v2_12_0_x86 | ✅ | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| pre-commit | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_master_ARM_01 | ✅ | >>> |
| UT_v2_7_1_ARM | ✅ | >>> | |
| UT_v2_9_0_ARM | ✅ | >>> | |
| UT_v2_10_0_ARM | ✅ | >>> | |
| UT_v2_11_0_ARM | ✅ | >>> | |
| UT_v2_12_0_ARM | ✅ | >>> | |
| UT_212_ARM_cpp | ✅ | >>> | |
| 流水线 | PR-pipeline_op-plugin | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


8 天前 关闭了关联的issue
8 天前 合入了pull request
ascend-robot
8 天前 评论:
8 天前 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


【合入来源】
兼容性需求,A3 支持 GroupedMatmul 的S8S4(A8W4) 伪量化需求,需要在的A5 上兼容
适配 Ascend 950 S8S4(A8W4)GroupedMatmul WeightNz 场景的 quantGroupSize 参数。
此前 op-plugin 调用 aclnnGroupedMatmulWeightNz 时,quantGroupSize 固定传入 0,只能覆盖非对称 per-channel 场景。当前算子新增对称 per-group 场景支持,该场景的量化分组长度固定为 256,因此需要由 op-plugin 根据量化模式传递正确参数。
【修改方案】
之前默认 quantGroupSize 传0,确定场景,让他传 256
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
冒烟测试通过,200门槛通过
【CheckList】