Pull Request已成功合入, 合并人@CANN-robot
(感谢 guijianwei 的贡献)以下是根据您提交的修改文件推荐的Reviewer和Committer序列,需各模块评审通过后方可合入
| Module List | Reviewers | Committers |
|---|---|---|
| repo-cann/ops-nn | zhang-wu, lileizheng, chaotang233, zhangyuxiang0119, wangyongguang | tangweiwei2, chenqi317, liubo75, crystalhu |


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


问题/功能描述
本次PR包含两项代码优化:一是移除gelu_quant算子内核函数中冗余的系统工作空间设置调用,以简化代码逻辑;二是为swi_glu_quant算子的分片逻辑启用批处理调度模式,旨在提升计算任务在大规模数据或并行场景下的调度效率。
修改方案描述
- 在
gelu_quant.cpp中,删除了内核函数入口处对SetSysWorkspace的冗余调用,使代码更简洁。 - 在
swi_glu_quant_tiling.cpp中,定义了批处理模式常量BATCH_MODE,并在分片函数Tiling4SwiGluQuant中通过context->SetScheduleMode(BATCH_MODE)显式设置了调度模式,以优化任务调度策略。


代码可读性与维护性: 常量 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 表示批处理模式,与框架定义一致'。更好的做法是,如果框架头文件中有相关定义,应直接引用。
此评论由代码审查工具自动生成


compile


流水线任务触发成功,任务链接 [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执行失败


compile


流水线任务触发成功,任务链接 [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执行结束


/lgtm


/check-pr


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.


/check-pr


The following labels are not ready.
lgtm: Please wait for reviewers to review the code.
approved: Please wait for committers to review the code.


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.


描述
关联的Issue
测试
文档更新
类型标签