已合并
[feat]: A5 Support for groupmatmul s8s4 requirements #5672
bynshard创建于 15 天前
[feat]: A5 Support for groupmatmul s8s4 requirements #5672
已合并
bynshard创建于 15 天前
bynshard
15 天前

【合入来源】

兼容性需求,A3 支持 GroupedMatmul 的S8S4(A8W4) 伪量化需求,需要在的A5 上兼容
适配 Ascend 950 S8S4(A8W4)GroupedMatmul WeightNz 场景的 quantGroupSize 参数。
此前 op-plugin 调用 aclnnGroupedMatmulWeightNz 时,quantGroupSize 固定传入 0,只能覆盖非对称 per-channel 场景。当前算子新增对称 per-group 场景支持,该场景的量化分组长度固定为 256,因此需要由 op-plugin 根据量化模式传递正确参数。

https://gitcode.com/Ascend/pytorch/issues/3922

【修改方案】

之前默认 quantGroupSize 传0,确定场景,让他传 256

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

冒烟测试通过,200门槛通过

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 bynshard 的贡献)
Bbynshard
15 天前 创建了 pull request,commit 8edfb2c1
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

此 PR 在 npu_grouped_matmul 函数中新增了对 a8w4 量化模式的识别与处理逻辑。当输入张量满足 xACL_INT8weightACL_INT32scaleACL_UINT64 且 scale 非空时,标记为 a8w4 场景;在该场景且无 offset 的情况下,将传递给 aclnnGroupedMatmulWeightNz 算子的 quant_per_group_size 参数从固定值 0 改为 256,以适配 a8w4 权重 NZ 格式的分组矩阵乘计算。

主要改动

  • 新增 a8w4 模式识别变量 is_a8w4:通过判断 x_wrapper.dtypeweight_wrapper.dtypescale_wrapper.dtypescale_real 是否为空,组合出一个布尔标志,用于标识当前为 int8 激活 / int4 量化的混合精度计算场景。
  • quant_per_group_size 赋值逻辑调整:将原本固定为 0quant_per_group_size 改为条件赋值 — 当处于 a8w4 模式且 offset_real 为空时取值为 256,否则保持 0,以正确适配 a8w4 在 FRACTAL_NZ 权重格式下的分组量化参数。
likedislike
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

likedislike
ascend-robotascend-robot成员
15 天前 添加了label:ascend-cla/no
此处折叠了126条消息 查看更多
ascend-robotascend-robot成员
8 天前 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
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 >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[wujinyuan1, Hhuangjingwei, Lliangsongwei, Yyashi999, Cculechan, DDring, Wwuyouqi1, LL1919_snow, Qqq_52711437, WW, wss_321]评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
ascend-robotascend-robot成员
8 天前 关闭了关联的issue
ascend-robotascend-robot成员
8 天前 合入了pull request
ascend-robot
ascend-robot成员
8 天前 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike