已关闭
[Bug-Report|缺陷反馈]: aclnnGroupQuant 在 scale 第 0 维为 0 时返回错误码 561103,与文档约束(161002)不符且第一段接口未拦截 #6272
liuhanwen8创建于 19 天前关闭于 17 天前
19 天前 添加了label:bug-report
yuning_chen
18 天前 评论:
18 天前 评论:
18 天前 将 liujie12345678 设为负责人
18 天前 将 cuijie25 设为负责人
cuijie
18 天前 评论:
18 天前 评论:
感谢反馈,该问题已修复,请见 PR #11387。
修复内容
aclnnGroupQuantGetWorkspaceSize的 CheckDim 新增 scale 第 0 维大于 0 的校验:scale 形状为 [0, 8] 等场景在第一段接口直接返回 161002(ACLNN_ERR_PARAM_INVALID),不再落入 tiling 阶段返回 561103。- 顺带将 offsetOptional 的校验由 ShapeSize<=1 收紧为 ==1,shape 为 [0] 的空 offset 同样在第一段返回 161002(与文档“为1个数”及 tiling 侧约束一致)。
- 文档参数表 scale/groupIndex/offsetOptional 三处“支持空Tensor”改为“不支持空Tensor”(scale 另以单独条目注明第 0 维大小不支持为 0),消除与约束说明的矛盾。
验证(A2,Ascend 910B3 / CANN 9.1.0)
- opapi UT 54 例全部通过:新增 scale 第 0 维为 0(期望 161002)、空 offset(期望 161002)两个负向用例,并做撤回修复后用例失败的反向对照确认有效性;
- example 实卡验证:正常路径两段式跑通且输出数值正确;scale [0,8] 与 offset [0] 实测均在第一段返回 161002;
- x 为空(如 [0, 8])且 scale/groupIndex 合法的调用仍按文档返回成功,不受本次校验影响。


17 天前 关闭了 issue
17 天前 添加了label:resolved
Describe the current behavior / 问题描述 (Mandatory / 必填)
aclnnGroupQuant传入scale形状 (0, 8)、groupIndex形状 (0,)(x非空为 (4, 8))时:scale的第 0 维大小不支持为 0",但aclnnGroupQuantGetWorkspaceSize未做该校验,错误落到 tiling 阶段(group_quant_tiling.cpp:117 no support for the first dim of scale shape([0, 8]) is less than 1)。ACLNN_ERR_INNER_NULLPTR,内部空指针错误),而文档"第一段接口入参校验"表写明 shape 不满足限制应返回 161002(ACLNN_ERR_PARAM_INVALID)。设备侧把该入参非法问题归类为 EZ1008Execution_Error(tiling 执行失败),也与真实原因不符。补充:原始用例中
offsetOptional为 (0,)(亦不属于文档允许的 [1, ] 或 []),改用合法 offset (1,) 后现象完全相同,说明与 offset 无关。Environment Information / 环境信息 (Mandatory / 必填)
torch_npu.npu_group_quant(内部下发 aclnnGroupQuant),ASCEND_LAUNCH_BLOCKING=1Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
import os os.environ.setdefault("ASCEND_LAUNCH_BLOCKING", "1") import torch, torch_npu torch.npu.set_device(0) x = torch.randn(4, 8, dtype=torch.float16, device="npu") scale = torch.empty(0, 8, dtype=torch.float16, device="npu") # 第 0 维 = 0 group = torch.empty(0, dtype=torch.int32, device="npu") offset = torch.zeros(1, dtype=torch.float16, device="npu") # 合法 torch_npu.npu_group_quant(x, scale, group, offset=offset, dst_dtype=torch.int8)对照:
scale(2, 8) +group(2,) 可正常返回 y (4, 8) INT8。Describe the expected behavior / 预期结果 (Mandatory / 必填)
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
Special notes for this issue/备注 (Optional / 选填)
文档参数表中
scale标注"支持空 Tensor",与约束说明"scale第 0 维大小不支持为 0"表述不一致,建议一并澄清。