Closed
[Bug-Report|缺陷反馈]: Conv算子编译报错 L1CopyInConv op should have CopyOpAttribute #3170
gravel1997Add on  Aug 31Closed at  Sep 24
gravel1997
gravel1997Collaborators
Aug 31 Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

Conv 算子(conv1d_dynamic_kernel,A5/Ascend950PR 平台)编译失败:

ErrCode: FC6202! Enum: ConvExpandFuncError::EXPANDFUNC_TENSOR_ATTR_GET_FAILED
L1CopyInConv op should have CopyOpAttribute

根因链(已通过加日志实跑定位,非代码猜测):

  1. L1CopyInReuseMerge 等合图 pass 在合并前为每个子图的所有 op 标注合图组属性(l1_reuse_hashOrder/cube_merge_hashOrder/vec_merge_hashOrder 及 subgraphCount,值为 func<magic>_<order>)。
  2. L1 复用按 GM 输入特征(而非同构组)合并子图,合并后同一子图内出现两个语义完全相同的 TRANS_FORMAT_L1 生产者,仅合图标注属性不同(实证:func5_1/count288 与 func5_0/count192)。
  3. COE(CommonOperationEliminateUtils)计算生产者组 hash 时通过 op->DumpAttr() 把全部属性计入 hash,导致等价生产者组 hash 不一致、无法去重(本例 390 次 L1 合并中有 4 次跨组,产生 2 个混合子图、2 个残留重复 TF)。
  4. 残留重复 TRANS_FORMAT_L1 使 GenerateMoveOp::CollapseTransFormatL1Consumer 因 consumer 数 != 1 放弃合并,L1_COPY_IN_CONV 未被设置 CopyOpAttribute,L1CopyInConvInferFunc(op_infer_shape_impl.cpp:1120)断言失败。

Environment / 环境信息 (Mandatory / 必填)

  • 服务器/NPU 型号: Ascend950PR (A5)
  • PyPTO 版本/Commit: 918a08d9a(master)
  • CANN 版本: 9.2.0
  • Python 版本: 3.10.20
  • 操作系统: Ubuntu 24.04.4 LTS
  • torch 版本: 2.8.0
  • torch_npu 版本: 2.8.0.post4

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 使用 pypto 实现 conv1d 动态 kernel(fmap shape [48,1,1,286],weight [16,1,1,31],FILTER_W=31)
  2. 触发编译(含 L1CopyInReuseMerge pass 的 EXECUTE_GRAPH 阶段)
  3. 编译报错上述断言失败

Describe the expected behavior / 预期结果 (Mandatory / 必填)

COE 正确去重仅合图标注不同的等价 TRANS_FORMAT_L1 生产者组,CollapseTransFormatL1Consumer 正常合并并设置 CopyOpAttribute,Conv 算子编译通过且精度达标。

ASSERT FAILED: ErrCode: FC6202! Enum: ConvExpandFuncError::EXPANDFUNC_TENSOR_ATTR_GET_FAILED
L1CopyInConv op should have CopyOpAttribute, func L1CopyInConvInferFunc, file op_infer_shape_impl.cpp, line 1120

关键日志证据(ASCEND_GLOBAL_LOG_LEVEL=1):

  • 修复前:CollapseTransFormatL1Consumer bail: op[10528] output Tensor[396] has 2 consumers: TRANS_FORMAT_L1[10529]{sg180} TRANS_FORMAT_L1[14651]{sg180},其中 TF[10529] l1_reuse_hashOrder=func5_1/count288,TF[14651] func5_0/count192

Special notes for this issue/备注 (Optional / 选填)

修复 PR:https://gitcode.com/cann/pypto/merge_requests/5793 (COE hash 排除 6 个合图标注属性)
验证:UT 125 个(含新增回归 UT)+ E2E Conv_L0_basic 用例 PASS(mare 0.00037)

likedislike
gravel1997
gravel1997Collaborators
Aug 31 Comments:
CatherieCatherieCollaborators
Aug 31 Modify description of issue
CatherieCatherieCollaborators
Aug 31 Assign Catherie as responsible person
CatherieCatherieCollaborators
Aug 31 Associated pull request
袁野袁野Collaborators
Sep 3 changed custom category from 任务 to 缺陷
袁野袁野Collaborators
Sep 3 Added label: Operations
lidongsheng
lidongshengCollaborators
Sep 4 Comments:

问题处理后请及时关闭 @Catherie

likedislike
gravel1997gravel1997Collaborators
Sep 24 changed custom state from 待办的 to 已解决
gravel1997gravel1997Collaborators
Sep 24 Close issue
CANN-robotCANN-robotCollaborators
Sep 24 Added label: resolved
wangmingjunwangmingjunCollaborators
5 days ago Added label: Passes