已合并
1.fix warning log 2.fix SetScheduleMode #862
guijianwei创建于 1月21日
1.fix warning log 2.fix SetScheduleMode #862
已合并
guijianwei创建于 1月21日
guijianwei
guijianwei
1月21日

描述

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 guijianwei 的贡献)
CANN-robot
CANN-robot成员
1月21日 评论:

Thank your for your pull-request.

The full list of commands accepted by me can be found at here.

You can get sig-info at here

likedislike
CANN-robot
CANN-robot成员
1月21日 评论:

以下是根据您提交的修改文件推荐的Reviewer和Committer序列,需各模块评审通过后方可合入

Module List Reviewers Committers
repo-cann/ops-nn zhang-wu, lileizheng, chaotang233, zhangyuxiang0119, wangyongguang tangweiwei2, chenqi317, liubo75, crystalhu
likedislike
CANN-robotCANN-robot成员
1月21日 将crystalhu,chenqi317,liubo75,tangweiwei2设为审查人
CANN-robotCANN-robot成员
1月21日 将chaotang233,FelixTang7,yu-xinjie62,zhajianqing123,liu-wei,lileizheng,zhangyuxiang0119,wangyongguang设为评审人
CANN-robotCANN-robot成员
1月21日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
1月21日 评论:

CLA Signature Pass

guijianwei, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
1月21日 评论:

🔵 source code change are detected, tasks labels is removed in this pull request!

likedislike
CANN-robot
CANN-robot成员
1月21日 评论:

问题/功能描述

本次PR包含两项代码优化:一是移除gelu_quant算子内核函数中冗余的系统工作空间设置调用,以简化代码逻辑;二是为swi_glu_quant算子的分片逻辑启用批处理调度模式,旨在提升计算任务在大规模数据或并行场景下的调度效率。

修改方案描述

  1. gelu_quant.cpp中,删除了内核函数入口处对SetSysWorkspace的冗余调用,使代码更简洁。
  2. swi_glu_quant_tiling.cpp中,定义了批处理模式常量BATCH_MODE,并在分片函数Tiling4SwiGluQuant中通过context->SetScheduleMode(BATCH_MODE)显式设置了调度模式,以优化任务调度策略。
likedislike
CANN-robot
CANN-robot成员1月21日进行代码检视2
quant/swi_glu_quant/op_host/swi_glu_quant_tiling.cpp
@@ -22,6 +22,7 @@ constexpr uint32_t BLOCK_SIZE = 32;
2222constexpr uint32_t L2_CACHE_LINE_SIZE = 512; // pack unit in cache 512B
2323 
2424constexpr uint32_t SINGLE_UB_SIZE = 25;
25+constexpr uint32_t BATCH_MODE = 1;
CANN-robot
CANN-robot1月21日评论:

代码可读性与维护性: 常量 BATCH_MODE 的值 1 是一个魔术数字(Magic Number)。虽然它在第98行被用作 context->SetScheduleMode(BATCH_MODE) 的参数,但数字 1 本身没有明确的上下文含义。它可能代表一种特定的调度模式,但仅凭数字 1 无法让阅读者理解其具体含义。

问题类型: 代码可读性与维护性
文件路径: quant/swi_glu_quant/op_host/swi_glu_quant_tiling.cpp
行号: 25
问题代码:

constexpr uint32_t BATCH_MODE = 1;

修改建议:

建议检查 gert::TilingContext 的 SetScheduleMode 方法接受的参数类型和含义。如果存在预定义的枚举值或常量(例如 ge::SCHEDULE_MODE_BATCH),应优先使用这些有意义的命名常量。如果 1 确实是该上下文中表示'批处理模式'的唯一有效值,也应为该常量添加注释,说明其与底层框架的对应关系。例如:'// 调度模式:1 表示批处理模式,与框架定义一致'。更好的做法是,如果框架头文件中有相关定义,应直接引用。

此评论由代码审查工具自动生成

likedislike
guijianwei
guijianwei
1月21日 评论:

batchmode模式是模式名,不是魔鬼数字,误报。

schedule_mode:batchmode模式,核间同步算子需要设置该模式。

guijianwei
guijianwei
1月21日 评论:

compile

likedislike
CANN-robotCANN-robot成员
1月21日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
1月21日 评论:

流水线任务触发成功,任务链接 [af1e4dc00f3a48cfb991e93743c3b8fb]

任务名称状态日志下载链接
codecheck ❌ FAILED >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
API_Check ✅ SUCCESS >>>>>
UT_Test_ophost ⚪ ABORTED
UT_Test_opapi ⚪ ABORTED
UT_Test_kernel ⚪ ABORTED
Smoke_A900 ⚪ ABORTED >>>>>

[2026-01-21 16:26:21]    CI执行失败

likedislike
CANN-robotCANN-robot成员
1月21日 添加了label:api-check-pass
CANN-robotCANN-robot成员
1月21日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
1月21日 添加了label:ci-pipeline-failed
CANN-robot
CANN-robot成员
1月21日 评论:
guijianwei
guijianwei
1月21日 评论:

compile

likedislike
CANN-robotCANN-robot成员
1月21日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
1月21日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
1月21日 删除了label:api-check-pass
CANN-robot
CANN-robot成员
1月21日 评论:

流水线任务触发成功,任务链接 [ae276359c8844580af69d1cd984f8552]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
API_Check ✅ SUCCESS >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
Smoke_A900 ✅ SUCCESS >>>>> >>>>>

[2026-01-21 17:38:23]    CI执行结束

likedislike
CANN-robotCANN-robot成员
1月21日 添加了label:api-check-pass
CANN-robotCANN-robot成员
1月21日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
1月21日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
1月21日 删除了label:api-check-pass
CANN-robotCANN-robot成员
1月21日 添加了label:api-check-pass
Zzhajianqing123成员
1月21日 通过了评审
zhajianqing123成员
1月21日 评论:

/lgtm

likedislike
zhajianqing123成员
1月21日 评论:

/check-pr

likedislike
CANN-robot
CANN-robot成员
1月21日 评论:

The following labels are not ready.

lgtm: Please wait for reviewers to review the code.

approved: Please wait for committers to review the code.

ci-pipeline-passed: Please wait for the CI test to be completed.

likedislike
CANN-robotCANN-robot成员
1月21日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
1月21日 添加了label:ci-pipeline-passed
guijianwei
guijianwei
1月21日 评论:

/check-pr

likedislike
CANN-robot
CANN-robot成员
1月21日 评论:

The following labels are not ready.

lgtm: Please wait for reviewers to review the code.

approved: Please wait for committers to review the code.

likedislike
chenqi317成员
1月21日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
1月21日 添加了label:lgtmapproved
CANN-robot
CANN-robot成员
1月21日 评论:

Review Guide

This Pull-Request Passes Review.
Committers who wrote a comment of /approve are: chenqi317.
Reviewers who wrote a comment of /lgtm are: zhajianqing123, chenqi317.

likedislike
CANN-robotCANN-robot成员
1月21日 合入了pull request