| Files | Last commit | Last update |
|---|---|---|
fix: 修复 cumulative_logsumexp 算子在大 shape 下的 error 问题 Co-authored-by: tianqiguang<tianqiguang@huawei.com> # message auto-generated for no-merge-commit merge: !6010 merge master into master fix: 修复 cumulative_logsumexp 算子在大 shape 下的 error 问题 Created-by: tianqiguang Commit-by: tianqiguang Merged-by: cann-robot Description: ## 描述 修复 cumulative_logsumexp 算子在大 shape 场景下出现 error 的问题,并将 kernel 扫描算法由 O(N×axis) 双重扫描重构为 O(N) 单遍扫描。 ### 改动原因 原 CumulativeLogsumexpKernel 按 totalNum 线性索引遍历每个元素,并在每个元素上内层重扫 axis 前缀计算累积 log-sum-exp: - 索引运算混合使用 int64/uint64,在大 shape 下存在隐患; - 每个元素重复扫描前缀,时间复杂度为 O(N×axis),axis 较大时计算量急剧膨胀。 ### 改动方法 将 kernel 重构为「按 axis 向量」单遍扫描: - 以 axisVectorNum = outerNum * innerNum 作为循环上界,每个线程负责若干条完整的 axis 向量; - 沿 axis 单遍遍历并维护运行累加器 acc,每个元素只被访问一次,复杂度降为 O(N); - reverse(正/反向累积)与 exclusive(包含/排除当前位置)语义保持不变; - 移除对 totalNum 的使用((void)totalNum)。 ## 关联的Issue - #3327 ## 测试 本次改动未新增/修改测试文件。 ## 文档更新 无文档变更。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6010 | 1 month ago |