已关闭
[Bug] quant_batch_matmul_v3: Phase 1 构建失败 —— fused_mat_mul 依赖并行编译时 asc_opc 目录锁竞争(ascend950 / CANN 9.0.0) #2749
Justbin创建于  5月18日关闭于  5月22日
Justbin
5月18日 创建

环境信息

项目 版本
ops-nn 分支 9.0.0(commit 0c2f3d885
CANN toolkit 9.0.0(build 20260404)
驱动版本 25.7.rc1.b085
SOC ascend950(Ascend950PR_9599)
构建并发数 -j16

复现步骤

source /usr/local/Ascend/cann-9.0.0/set_env.sh
cd ops-nn
git checkout 9.0.0
bash build.sh --make_clean_all
bash build.sh --pkg --soc=ascend950 --ops=quant_batch_matmul_v3 -j16

实际现象

构建失败,退出码非零。日志中 fused_mat_mul 依赖的多个并行 asc_opc 进程同时崩溃:

[ERROR] exe_task: build kernel FAILED, op name: fused_mat_mul_binary_high_performance.json_0
RuntimeError: Another process is using this dir
[ERROR] exe_task: build kernel FAILED, op name: fused_mat_mul_binary_high_performance.json_2
RuntimeError: Another process is using this dir
[ERROR] exe_task: build kernel FAILED, op name: fused_mat_mul_binary_high_performance.json_4
RuntimeError: Another process is using this dir
...(json_1 ~ json_5 同样报错)

gmake[3]: *** [CMakeFiles/exe_compile_ascend950_8.dir/...] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:3250:CMakeFiles/binary.dir/rule] 错误 2

根本原因分析

调用栈来自 CANN toolkit 内部 asc_opc_tool

/usr/local/Ascend/cann-9.0.0/python/site-packages/asc_opc_tool/op_compilation.py:134
  __create_debug_dir
  → op_compilation.py:101  __create_lock_file
    → RuntimeError: Another process is using this dir

quant_batch_matmul_v3 构建时依赖 fused_mat_mul,后者会并行启动多个 asc_opc 进程处理不同的 json shard(high_performance.json_0 ~ json_5),这些进程共享同一输出目录,导致目录锁文件竞争。

期望行为

每个 json shard 编译进程使用独立的工作目录,或 asc_opc 工具在并发调用时正确处理目录锁,使 quant_batch_matmul_v3 在标准 -j16 并行度下可正常构建。

影响范围

quant_batch_matmul_v3 是 ascend950 平台的关键量化矩阵乘算子,构建失败导致该算子在 ascend950 上完全无法测试。

likedislike
JJustbin
5月18日 修改了issue 的描述
oscillatedoscillated成员
5月19日 将 yangyang016 设为负责人
丛吉钰
丛吉钰成员
5月19日 评论:

这个问题应该是上次编译构建遗留文件导致的,请在ops-nn目录下执行以下命令后重新构建:pkill -f ${ASCEND_HOME_PATH}/bin/bisheng;rm -rf scripts/kernel/binary_script/kernel_meta_* @Justbin

likedislike
liuyufan
liuyufan成员
5月21日 评论:

会删除qbmmv3的冗余依赖 https://gitcode.com/cann/ops-nn/pull/5065

likedislike
CANN-robotCANN-robot成员
5月22日 关闭了 issue
CANN-robotCANN-robot成员
5月22日 添加了label:resolved
Justbin
5月25日 评论:

感谢您的回复!

我们按照您提供的方案(cleanrm -rf scripts/kernel/binary_script/kernel_meta_*)在本地重新跑测,本 issue 报告的原始失败(BUILD_FAIL)已恢复:

  • 算子ops-nn / quant_batch_matmul_v3
  • SOCascend950
  • build / install:✅ PASS
  • examples:✅ 11 / 14 通过

复测中另发现 3 个示例在运行期出现与本 issue 无关的新故障,已另开 follow-up issue 跟踪:

失败示例:

  • quant_matmul_v3_at2_at3_int4
  • quant_matmul_v4_at2_at3_int4
  • quant_matmul_weight_nz_at2_at3_int4

原始问题视为已解决,关闭本 issue。感谢社区支持!

likedislike