Closed
[Bug-Report|缺陷反馈]: 多卡用例会出现重复编译torch接口的情况,导致建链超时 #6362
huangbolinAdd on  26 days agoClosed at  17 days ago
huangbolin
huangbolinCollaborators
26 days ago Create

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

多卡用例会出现重复编译torch接口的情况,导致建链超时

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

950 8P

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

跑mc2 moe_ep的算子多卡用例

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

用例执行成功

无

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

likedislike
huangbolinhuangbolinCollaborators
26 days ago Added label: bug-report
huangbolinhuangbolinCollaborators
26 days ago Associated pull request
huangbolinhuangbolinCollaborators
26 days ago Deleted associated pull request: fix_torch_compile
huangbolinhuangbolinCollaborators
26 days ago Associated pull request
游震Collaborators
26 days ago Comments:

/assign @hblnb

likedislike
CANN-robotCANN-robotCollaborators
26 days ago Assign hblnb as responsible person
周云飞
周云飞Collaborators
26 days ago Comments:

您好,感谢反馈!您报告在 950 8P 环境运行 mc2 moe_ep 多卡用例时,出现 Torch 接口重复编译及建链超时,导致用例无法执行成功。目前还需要确认重复编译发生在哪个环节,以及它是否造成各进程进入建链的时间不一致,进而触发超时。

为定位问题,请补充以下信息:

  • 实际运行的用例名称、启动命令,以及代码分支或提交号,用于确定多卡启动方式和编译入口。
  • CANN、PyTorch 和 torch_npu 的版本,用于确认软件组合。
  • 重复编译与首次建链超时附近的日志,尽量保留时间戳、进程编号(rank)、编译对象名称和错误码;如其他 rank 同期仍在编译,也请提供对应片段。日志请先脱敏,以便核对编译与建链的先后关系。

如果确认多个进程在重复构建同一份 Torch 扩展,一个可行的处理方向是将公共扩展编译前置,并在编译完成后再启动多卡用例;也可以评估构建产物复用及进程间同步。具体是否适用,还取决于当前编译入口和产物是否支持跨进程复用,暂不建议仅通过增大超时时间来判断问题已解决。

likedislike
CANN-robotCANN-robotCollaborators
17 days ago Close issue
CANN-robotCANN-robotCollaborators
17 days ago Added label: resolved
周云飞
周云飞Collaborators
4 days ago Comments:

已优化 OpBuilder 的 JIT 编译流程:持有算子编译锁时,优先通过源文件指纹复用已构建扩展,减少多进程重复触发 ninja 检查;指纹不匹配或缓存加载失败时,回退到完整构建流程,以缓解多卡任务启动耗时。

指纹不包含头文件变更;如需强制走完整构建流程,可设置 CANN_OP_BUILDER_NO_FPRINT_CACHE=1。

关联 PR:PR #14169、PR #14186

likedislike