Pull Request已成功合入, 合并人@CANN-robot
(感谢 陈海杰 的贡献)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 | ✅ Chen_HaoWen, liujie12345678 (2/2) | ✅ Chen_HaoWen, liujie12345678 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chenhaijie1423, thanks for your pull request. All authors of the commits have signed the CLA. 👍


问题/功能描述
本次PR旨在优化两个核心算子内核(flat_quant_cube.h 和 flat_quant_cube_one.h)的计算逻辑。原实现中,tiling()函数在计算invalidK变量时使用了浮点数除法,这不仅可能带来不必要的性能开销,还存在潜在的精度损失风险,可能影响特定形状参数下尾块判断的准确性。
修改方案描述
修改方案将tiling()函数中计算invalidK的表达式从static_cast<int64_t>(static_cast<float>(shape.K * shape.M - shape.Mceil) / static_cast<float>(shape.M))简化为(shape.K * shape.M - shape.Mceil) / shape.M。核心优化是移除了冗余的浮点数转换,直接使用整数除法进行计算。此举简化了代码逻辑,提升了计算效率,并从根本上避免了因浮点数转换可能导致的精度问题。


流水线任务触发成功
任务链接 [4f3d1eaa97c94576b1646afad0c0cde6][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | >>>>> |
| Pre_Compile | ✅ 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 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_monitor | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| Smoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| ATK_Test_A2 | ✅ SUCCESS |
[2026-04-20 14:54:01] CI执行结束


流水线任务触发成功
任务链接 [dcdfd04c221d442baab5136616ac092a][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS |
[2026-04-20 14:51:49] CI执行结束


/approve


/lgtm
/approve


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: Chen_HaoWen, liujie12345678.
Reviewers who wrote a comment of /lgtm are: liujie12345678, Chen_HaoWen.


描述
FlatQuant修复大shape内存检测问题
关联的Issue
https://gitcode.com/cann/ops-nn/issues/2172
测试
用单算子OOM包验证1400条泛化用例,功能和精度全部OK
文档更新
不涉及
类型标签