Pull Request已成功合入, 合并人@CANN-robot
(感谢 chendunyang 的贡献)变更摘要
该 PR 旨在修复 GEIR 示例(test_geir_indexer_quant_cache.cpp)成功路径中的 Session 内存泄漏(对应 issue #4792),并为 IndexerQuantCache kernel 补充基于真实字面值的数值 golden UT,替代原先仅判断输出非零的弱校验。示例侧在 RunGraph 成功后、调用 ge::GEFinalize() 之前新增 delete session,使成功路径与失败路径的资源释放行为一致;UT 侧新增 test_indexer_quant_cache_golden.cpp,针对 Normal 量化分支分别覆盖 roundScale=true/false 两种场景,golden 采用与被测 kernel 计算逻辑无关的固定字面值。
主要改动
- 修复 GEIR 示例 Session 泄漏:在
test_geir_indexer_quant_cache.cpp的ge::GEFinalize()前新增delete session;,确保RunGraph成功后释放Session,与失败路径的资源回收行为保持一致,解决 #4792。 - 新增 Normal 量化分支 golden 测试文件:新增
test_indexer_quant_cache_golden.cpp,通过RunAndCheckNormalGolden以交替输入 1.0/-0.5 分别运行roundScale=1与roundScale=0(TEST(IndexerQuantCacheNormalGolden, RoundScale)/NoRoundScale),断言输出与固定字面值 golden 完全一致。 - 校验量化输出的字节与位模式:逐字节校验完整 cache 输出(E4M3FN 字节 golden,如
0x78/0xF0、0x7E/0xF6),并以位模式校验 float32 scale(如0x3B800000U、0x3B124925U),杜绝仅判断非零导致的数值错误漏检。 - 校验
slotMapping=-1行的行为:验证当slotMapping[row] < 0(如SLOT_MAPPING = {0, -1, 2, 3})时对应 cache 行与 scale 保持原值(初始 0)不变,并仅对非跳过的行应用量化结果。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| attention | ✅ luwei_1104, wangxun21 (2/2) | ✅ wangxun21, luwei_1104 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
qq_37913898, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/approve


背景
修改内容
验证结果
Closes #4792