Open
[Bug-Report|缺陷反馈]: CANN 9.2.1 上编译 ops-transformer 的 megamoe 算子失败(gm_to_l1_trait 定义不一致) #7220
XIAOJIFANAdd on  1 day ago
XIAOJIFAN
XIAOJIFAN
1 day ago Create

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

在 CANN 9.2.1 上编译 ops-transformer 的 MegaMoE 算子(mc2/mega_moe,arch35/A5)时,blaze 头要求 gm_to_l1_trait 带 pre_allocation 成员,但工具链 asc/include 里该类型仍是空结构体,编译直接失败。

MegaMoE 的 arch35 kernel 走 blaze MX GEMM:

mc2/mega_moe/op_kernel/arch35/mega_moe_arch35.h
  → ../arch35_92/blaze/gemm/block/block_mmad_mx_fp8fp4.h
  → blaze/gemm/tile/tile_trait.h

而 tile_trait.h:43 按新语义初始化:

struct CopyGM2L1TraitPreAllocation {
    using TraitType = asc::te::gm_to_l1_trait;
    static constexpr const TraitType value = asc::te::gm_to_l1_trait{true};
};

CANN 9.2.1 里有三份不同步的 copy_trait.h:

路径 gm_to_l1_trait
aarch64-linux/asc/include/.../copy_trait.h struct gm_to_l1_trait {};(旧,优先被搜到)
opp/.../ops_transformer/.../copy_trait.h 带 bool pre_allocation(新)
opp/.../ops_nn/.../copy_trait.h 空结构体(旧)
ops-tensor #380 / !590 引入该用法后,blaze 头需要新定义,而 9.2.1 工具链的 asc/include 仍是旧副本。

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

  • 硬件:Ascend950DT(A5,arch35),单机 8 die(本问题为纯编译问题,不依赖设备运行)
  • 驱动 / 固件:25.1.rc2 / 7.35.23
  • CANN:9.2.1(/usr/local/Ascend/cann-9.2.1)
  • OS:openEuler 24.03 LTS-SP4,aarch64
  • 编译器:bisheng clang 15.0.5 + opc
  • Python / torch:3.12.16 / 2.10.0+cpu,torch-npu 2.10.0.post7

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

git clone https://gitcode.com/cann/ops-transformer.git
cd ops-transformer
source /usr/local/Ascend/cann-9.2.1/set_env.sh
bash build.sh --pkg --soc=ascend950 --ops=mega_moe -j16

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

.../ops_transformer/ascendc/common/blaze/gemm/tile/tile_trait.h:43:70:
error: excess elements in struct initializer
    static constexpr const TraitType value = asc::te::gm_to_l1_trait{true};
7 errors generated.

参见上一节。

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

likedislike
周云飞
周云飞Collaborators
1 day ago Comments:

问题说明

从报错和您提供的定义看,这是头文件接口不匹配:gm_to_l1_trait{true} 需要可接收该值的成员,而空结构体无法这样初始化,因此触发 excess elements in struct initializer。MegaMoE 的 MX GEMM 实现确实引用了 blaze 的 tile_trait.h;但 CANN 9.2.1 中各份定义及实际包含顺序尚未独立验证。

处理建议

可行方向是让 blaze 与工具链使用配套的 trait 定义及实现。若需兼容旧接口,应先确认预分配语义,不能仅删除 {true} 或替换单个头文件来消除报错;还需验证 arch35 编译及相关数据搬运行为。

请补充实际编译的 ops-transformer 提交号,以便确定对应代码与 CANN 9.2.1 的兼容范围。

likedislike