Closed
GMM arch35 kernel 清理残留 TPipe 依赖及未使用定义 #4386
yangyang016Add on  Aug 18Closed at  13 days ago
yangyang016
yangyang016
Aug 18 Create

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

在 gmm/*/op_kernel/arch35 生产 kernel 范围内扫描了 78 个 .h/.hpp/.cpp/.cc/.cxx/.asc 文件,发现 20 个文件仍包含 TPipe。

其中 7 处属于明确未使用的定义:

  1. gmm/grouped_matmul/op_kernel/arch35/quant_adaptive_sliding_window_templates/gqmm_cgmct_mx_kernel.h:34:形参 AscendC::TPipe *que 未引用。
  2. gmm/grouped_matmul/op_kernel/arch35/quant_adaptive_sliding_window_templates/gqmm_cgmct_pertile_kernel.h:34:形参 AscendC::TPipe *que 未引用。
  3. gmm/grouped_matmul/op_kernel/arch35/quant_adaptive_sliding_window_templates/gqmm_tensor_api_mx_kernel.h:33:que 仅通过 (void)que 消警。
  4. gmm/grouped_matmul/op_kernel/arch35/weight_quant_basic_block/weight_quant_vec_compute.h:251:Init 的 tPipe 形参未使用,函数内部实际通过 GetTPipePtr() 分配 EventID。
  5. gmm/grouped_matmul_finalize_routing/op_kernel/arch35/weight_quant_basic_block/gmm_fr_weight_quant_vcv_basic_block.h:33:using AscendC::TPipe 未使用。
  6. gmm/grouped_matmul_swiglu_quant_v2/op_kernel/arch35/grouped_matmul_swiglu_quant_v2_mxfp4_weight_nz.h:40:tpipe 仅通过 (void)tpipe 消警。
  7. gmm/grouped_matmul_swiglu_quant_v2/op_kernel/arch35/weight_quant_basic_block/gmmsq_weight_quant_vcv_basic_block.h:30:using AscendC::TPipe 未使用。

另外 13 个文件中的 TPipe 当前仍有实际传递或调用,包括 int4/s8s4 预处理、quant adaptive sliding window、weight quant basic block/controller,以及 swiglu per-token quant 等路径,需要进一步确认是否可改为内部获取或无显式 TPipe 的接口。

Benefit / Necessity (价值/作用)

清理 arch35 kernel 中无效的 TPipe 参数和 using 声明,避免通过 (void) 掩盖冗余接口;同时收敛剩余显式 TPipe 依赖,降低调用链耦合和维护成本,并减少未使用定义相关的告警风险。

Design(设计方案)

  1. 删除上述 7 处未使用的形参或 using 声明,并同步修改声明、定义及调用点。
  2. 对剩余 13 个实际使用 TPipe 的文件逐一确认生命周期和接口约束;可使用 GetTPipePtr() 或无需显式 pipe 的接口时,移除参数透传。
  3. 保留确有必要的 Reset()、Matmul Init() 和预处理初始化行为,避免改变同步与资源生命周期。
  4. 完成 arch35 编译,并执行 GMM 相关 ST/UT;确保无新增告警且功能、精度结果不回退。
likedislike
weihao18
weihao18Collaborators
Aug 18 Comments:

/assign @kknan

likedislike
CANN-robotCANN-robotCollaborators
Aug 18 Assign cc-z as responsible person
CANN-robotCANN-robotCollaborators
Aug 18 Assign kknan as responsible person, remove original responsible person: cc-z
kknan
kknanCollaborators
Sep 1 Comments:

GMM算子a8w4场景Tpipe消减已合入,剩余场景开发和验证中。
设计场景较多,开发和验证工作量较大

likedislike
游震
游震Collaborators
Sep 16 Comments:

已合入部分场景,占比约40%

likedislike
周云飞
周云飞Collaborators
19 days ago Comments:

目前是部分场景已合入,尚未完成全部清理:此前反馈 a8w4 场景的 TPipe 消减已合入,最近评论给出的整体进度约为 40%,其余场景仍在开发和验证中。

清理方向可以区分两类:

  • 对确认未使用的形参和 using 声明,可删除并同步调整声明、定义及调用点,减少冗余接口。
  • 对仍参与资源分配或初始化的 TPipe,不宜直接统一替换为 GetTPipePtr();需确认获取的是预期实例,并保持 Reset()、Matmul Init()、预处理初始化及同步资源生命周期不变。

这属于接口与依赖简化,不能仅凭残留 TPipe 判断存在功能缺陷。剩余清理仍需以 arch35 编译及相关 GMM ST/UT 验证结果为依据。

likedislike
CANN-robotCANN-robotCollaborators
13 days ago Close issue
CANN-robotCANN-robotCollaborators
13 days ago changed custom state from 进行中 to 已完成
CANN-robotCANN-robotCollaborators
13 days ago Added label: resolved