已关闭
[Bug-Report|缺陷反馈]: Conv算子编译报错 L1CopyInConv op should have CopyOpAttribute #3170
gravel1997创建于  8月31日关闭于  9月24日
gravel1997
gravel1997成员
8月31日 创建

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
gravel1997成员
8月31日 评论:
CatherieCatherie成员
8月31日 修改了issue 的描述
CatherieCatherie成员
8月31日 将 Catherie 设为负责人
CatherieCatherie成员
8月31日 关联了pull request:fix(pass): Exclude graph-merge attrs from COE hash to fix conv compile error
袁野袁野成员
9月3日 issue类型由 任务 改变为 缺陷
袁野袁野成员
9月3日 添加了label:Operations
lidongsheng
lidongsheng成员
9月4日 评论:

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

likedislike
gravel1997gravel1997成员
9月24日 issue状态由 待办的 改变为 已解决
gravel1997gravel1997成员
9月24日 关闭了 issue
CANN-robotCANN-robot成员
9月24日 添加了label:resolved
wangmingjunwangmingjun成员
5 天前 添加了label:Passes