Closed
[Bug-Report|缺陷反馈]: aclnnDynamicQuantV2 专家数为 0 时返回错误码 561103,与真实参数错误不符且第一段接口未拦截 #6271
liuhanwen8Add on Sep 28Closed at Oct 8
Sep 28 Added label: bug-report
yuning_chen
Sep 29 Comments:
Sep 29 Comments:
yuning_chen
Sep 29 Comments:
Sep 29 Comments:
/assign @menhaoTang


CANN-robot
Sep 29 Comments:
Sep 29 Comments:
Sep 30 Assign liujie12345678 as responsible person
Oct 8 Close issue
Oct 8 Added label: resolved
Describe the current behavior / 问题描述 (Mandatory / 必填)
aclnnDynamicQuantV2传入smoothScalesOptional形状 (0, 8)、groupIndexOptional形状 (0,)(专家数 E=0,x非空为 (4, 8))时:ACLNN_ERR_INNER_NULLPTR,内部空指针错误),而设备侧真实原因是形状非法(EZ0012Invalid_Argument_Tensor_Shape_Dim)。文档"第一段接口入参校验"表写明 shape 不满足限制应返回 161002(ACLNN_ERR_PARAM_INVALID),与实际返回码不符。aclnnDynamicQuantV2GetWorkspaceSize未校验该 shape,错误延迟到 tiling/kernel 阶段才抛出(日志中Kernel GetWorkspace failed),对外表现为 PTAERR00100 PTA call acl api failed。The shape dim of smooth_scales must be 1,但此处传入的正是 2 维,且文档在有groupIndexOptional时要求smoothScalesOptional为 2 维 (专家数, x 最后一维)。Environment Information / 环境信息 (Mandatory / 必填)
torch_npu.npu_dynamic_quant(内部下发 aclnnDynamicQuantV2),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") # 非空,避免空 Tensor 提前返回 smooth = torch.empty(0, 8, dtype=torch.float16, device="npu") # E = 0 group = torch.empty(0, dtype=torch.int32, device="npu") # 与 smooth 第 0 维一致 torch_npu.npu_dynamic_quant(x, smooth_scales=smooth, group_index=group)对照:
smooth(1, 8) +group(4,) 可正常返回 y (4, 8) INT8、scale (4,)。Describe the expected behavior / 预期结果 (Mandatory / 必填)
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)