已合并
DynamicQuant 字面常量修改 #8346
dongfei创建于 8月6日
DynamicQuant 字面常量修改 #8346
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 dongfei 的贡献)8月6日 关联了issue:dynamic_quant_tiling_arch35.cpp存在字面常量
atomgit-bot
8月6日 评论:
8月6日 评论:
变更摘要
此 PR 主要对 dynamic_quant_tiling_arch35.cpp 中的 DynamicQuantRegbaseTiling 类进行代码质量改进:将分散在各处的字面常量(魔数)替换为有意义的命名常量,涉及对齐大小、UB 队列系数、位掩码和调度模式等,提升代码可读性和可维护性,不改变任何运行时行为。
主要改动
- 新增对齐与队列相关常量:在文件顶部定义
ROW_ALIGN_SIZE(16)、SMOOTH_QUEUE_FACTOR(2)、MAIN_QUEUE_FACTOR(4)、EVEN_ALIGN_MASK(1)和BATCH_SCHEDULE_MODE(1),将原本硬编码的数字提取为语义明确的常量。 - 对齐计算使用命名常量:
CalculateTilingData中将AlignUp<16>(rowLen)改为AlignUp<ROW_ALIGN_SIZE>(rowLen),使行对齐逻辑更清晰。 - UB 队列缓冲区计算公式重构:两处
calcLargeBuf/calcBuf计算中,将2UL * (... * 2UL + 4UL)替换为DOUBLE * (... * SMOOTH_QUEUE_FACTOR + MAIN_QUEUE_FACTOR),明确各系数含义。 - INT4 偶数对齐与核心数常量化:
CalculateTilingForPertenLargeMulticore中核心数下限2改用DOUBLE,INT4 偶数对齐掩码~1U改为~EVEN_ALIGN_MASK,偏移量+ 2改为+ DOUBLE。 - 调度模式设置常量化:
RunFusionKernelTiling中SetScheduleMode(1)改为SetScheduleMode(BATCH_SCHEDULE_MODE),使 batch mode 的语义一目了然。


不准确?
atomgit-bot
8月6日 评论:
8月6日 评论:
8月6日 添加了label:cann-cla/yes
CANN-robot
8月6日 评论:
8月6日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| quant | ✅ 王星, 唐玮玮 (2/2) | ✅ 王星 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
ASCEND222, thanks for your pull request. All authors of the commits have signed the CLA. 👍


8月6日 将zengjuan,sxb154714,chenfeng61,chaotang233,crystalhu,yangyang016,fanqirui,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为评审人
8月6日 将zengjuan,sxb154714,chenfeng61,chaotang233,crystalhu,yangyang016,fanqirui,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为评审人
8月6日 将sxb154714,chenfeng61,su-yueming,zhajianqing123,LinPX,wang-xing001,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为审查人
8月6日 将sxb154714,chenfeng61,su-yueming,zhajianqing123,LinPX,wang-xing001,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为审查人
dongfei
8月6日 评论:
8月6日 评论:
compile


8月6日 预合并成功(commit_id: 5904c95f25ba0f7cf1e1470a8c26311dfe7ef7f4)
8月6日 添加了label:ci-pipeline-running
CANN-robot
8月6日 评论:
8月6日 评论:
流水线任务触发成功
任务链接 [499c3d279efc46338af95e9083c109f9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_harmony-infer-chs-nn-1 | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-nn | ✅ SUCCESS | ||
| UT_Test_report_lcov | ⚠️ WARNING | >>>>> |
[2026-08-06 15:48:06] CI执行结束


CANN-robot
8月6日 评论:
8月6日 评论:
流水线任务触发成功
任务链接 [5dcbefdc9f394706b47c8b2679703434][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-08-06 15:33:50] CI执行结束


8月6日 添加了label:api-check-pass
8月6日 删除了label:ci-pipeline-running
8月6日 添加了label:ci-pipeline-passed
8月6日 修改了pull request 的描述
tangweiwei2
8月7日 评论:
8月7日 评论:
/lgtm
/approve


wang-xing001
8月7日 评论:
8月7日 评论:
/lgtm
/approve


8月7日 添加了label:lgtmapproved
8月7日 关闭了关联的issue
8月7日 合入了pull request
描述
DynamicQuant 字面常量修改
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4615
测试
文档更新
类型标签
AI/Agent生成声明