| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Init | 11 个月前 | |
fix: 排序Reduce tiling的归一化轴,消除乱序输入的结果不一致 Co-authored-by: wulinyu<wulinyu4@huawei.com> # message auto-generated for no-merge-commit merge: !62 merge fix/reduce-tiling-unsorted-axes into master fix: 排序Reduce tiling的归一化轴,消除乱序输入的结果不一致 Created-by: wulinyu Commit-by: wulinyu Merged-by: cann-robot Description: ## 描述 修复 CalcReduceTiling 对同一约减轴集合不同输入顺序产生不同 tiling 结果的问题。 **复现**(独立Host程序,CANN 9.3.0,未修改源码): shape = [2, 3, 4, 5, 6, 7, 8] axes {0, 3, 4, 6} -> policy={51,20,0} outSize=84 axes {4, 3, 6, 0} -> policy={40,20,0} outSize=672 与 issue 报告完全一致。 **根因**:EliminateOne 对 axes 就地 +1 后按 shape 顺序遍历 erase;MergeAxis 假设轴索引升序——连续 R 轴合并依赖 iter0/iter1 的位置关系,乱序输入时 erase 可能命中错误元素并留下失效迭代器(libstdc++ iterator checks 下解引用失效迭代器即暴露)。 **修复**(include/reduce/host/tiling/reduce_tiling.h,+3 行):在 Run() 中 MakeWrapDim 归一化与 IsAxesValid 校验之后、EliminateOne 之前,对约减轴执行 std::sort——消除后续算法对输入顺序的隐含假设,任意输入顺序得到一致结果: diff if (IsAxesValid(opInput_.reduceShape, opInput_.reduceDim) == -1) { return -1; } +// EliminateOne/MergeAxis assume ascending axis indices; sort the normalized axes so +// that the same axis set produces identical tiling regardless of input order. +std::sort(opInput_.reduceDim.begin(), opInput_.reduceDim.end()); std::vector<uint64_t> newShape(ATVC::MAX_DIM, 1); 排序在归一化(负轴转正)与校验(范围/数量合法性)之后执行,不影响原有错误检查语义。 ## 关联的Issue Fixes #23 ## 测试 新增 Host 回归 TestAtvcTiling.TestAtvcTilingReduceSumUnsortedAxesCase:同一轴集合 {0,3,4,6} 以升序/乱序两种形式调用,逐项比较: - policy 三元组(patternID / loopARCount / loopInnerARCount); - workspaceSize 与标量 tiling 字段(outSize / meanVar / groupR); - 全部 MAX_DIM 个 shape / stride / dstStride 槽位(比较前对 param 值初始化清零,排除未写入槽位的脏值干扰)。 验证记录(CANN 9.3.0 Host 环境): 1. **修复前**:回归用例失败——policy={51,20,0} vs {40,20,0}、outSize=84 vs 672(独立复现程序与 gtest 用例双重确认); 2. **修复后**:回归用例通过,同一轴集合两种顺序结果完全一致(policy={51,20,0}、outSize=84); 3. **存量回归**:tiling 全部 8 个用例(EleWise×2 / ReduceSum×3 / Broadcast×2 / 本用例)全部通过。 说明:与 issue 一致,本验证为 Host 侧 tiling 路径;缺陷发生在 kernel launch 之前,无需 Device 侧数值运行。 ## 文档更新 N/A ## 类型标签 - [x] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 🤖 Generated with [Claude Code](https://claude.com/claude-code) See merge request: cann/atvc!62 | 1 天前 | |
Fix Reduce no-op copy tail length Co-authored-by: KaranocaVe<karanocave@qq.com> # message auto-generated for no-merge-commit merge: !53 merge fix/2026-09-30-atvc-valid-tiling-semantics-bug-hunt-01 into master Fix Reduce no-op copy tail length Created-by: KaranocaVe Commit-by: KaranocaVe Merged-by: cann-robot Description: # Fix Reduce no-op copy tail length ## Summary The no-reduction copy path rounds the tensor length up to 32 bytes and writes the padded elements to the output. A one-element float tensor therefore overwrites seven values beyond the output extent. Keep the logical count exact and use byte-length DataCopyPad for the final tile. ## Tests On the 910B TikicpuLib simulator, the baseline one-element case overwrote all seven guard values while the 8-element aligned control passed. With the fix, both regressions pass, as does the full ATVC UT suite (13/13). No physical NPU run was performed. 关联 Issue: https://gitcode.com/cann/atvc/issues/24 See merge request: cann/atvc!53 | 11 天前 |