| Files | Last commit | Last update |
|---|---|---|
concat_v2 infershape修复相同形状输入Shape,axis维漏加造成输出shape错误 Co-authored-by: hw-zhangpanpan<zhangpanpan5@huawei.com> # message auto-generated for no-merge-commit merge: !7301 merge master into master concat_v2 infershape修复相同形状输入Shape,axis维漏加造成输出shape错误 Created-by: hw-zhangpanpan Commit-by: hw-zhangpanpan Merged-by: cann-robot Description: ## 描述 conversion/concat_v2/op_host/concat_v2_infershape.cpp 中 InferShape4ConcatV2 在推导 concat 维大小时,基底(首个已知秩输入)的识别使用了实例指针相等比较: 1、收集阶段以 baseShape(指针)记录首个已知秩输入; 2、求和阶段用 if (shapeI == baseShape) continue; 跳过基底自身。 但运行时多个 shape 相同的输入实例可能返回同一个 ge::Shape 对象(输入 desc 同源共享)。此时,后续同形输入会被指针比较误判为"基底"而跳过求和,导致输出 concat(axis)维的尺寸漏加,推导结果偏小。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/4685 ## 测试 UT,GE网络用例 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7301 | 8 days ago | |
concat/split/splitv算子去除无用的16MB workspace Co-authored-by: hw-zhangpanpan<zhangpanpan5@huawei.com> # message auto-generated for no-merge-commit merge: !5622 merge master into master concat/split/splitv算子去除无用的16MB workspace Created-by: hw-zhangpanpan Commit-by: hw-zhangpanpan Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue https://gitcode.com/cann/ops-math/issues/3174 ## 测试 冒烟测试,泛化测试 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5622 | 2 months ago | |
optimize the performance of aicpu concatv2 operator Co-authored-by: ZhaiPeiChao<zhaipeichao@huawei.com> # message auto-generated for no-merge-commit merge: !2395 merge master into master optimize the performance of aicpu concatv2 operator Created-by: ZhaiPeiChao Commit-by: ZhaiPeiChao Merged-by: cann-robot Description: ## 描述 对 conversion/concat_v2 aicpu 算子进行性能优化重构。 **修改位置** - conversion/concat_v2/op_kernel_aicpu/concat_v2_aicpu.h - conversion/concat_v2/op_kernel_aicpu/concat_v2_aicpu.cpp - conversion/concat_v2/tests/ut/op_kernel_aicpu/test_concat_v2.cpp **修改原因与方法** 原实现在热路径上存在多项性能与工程规范问题,导致小张量多输入场景延迟偏高、多核扩展性受限: 1. **去除 Eigen 与 shared_ptr 抽象层**:原代码每个输入都 std::make_shared<Eigen::TensorMap<...>> 构造访问器,一次 Compute 产生 N 次堆分配,热路径存在两层指针解引用(shared_ptr → TensorMap → data),并因 shared_ptr 控制块在 shard 间拷贝导致引用计数原子 RMW 造成跨核 cache-line ping-pong。改为 POD 描述符 ConcatV2InputDesc{const T* base; int64_t dim1},在 Prepare 阶段一次性构建,热路径零分配、单层解引用。 2. **按自然边界(整行 / 输入区间)并行**:原 ParallelFor 使用元素级 grain(sizeof(T)),每个 shard 要处理"首尾半行"边界,分支多、memcpy 长度不稳定、任务数量级过大。改为按行切分(ByRow 路径)或按输入区间切分(ByInput 路径),per_unit_size 传整行字节数,shard 永远对齐到自然边界,每段都能走 libc memcpy ifunc 快路径。 3. **退化形态专用分支**:flat_dim0 == 1(含 axis=0、一维)场景走 ByInput 路径,通过前缀 offset + 输出区间切分让各 shard 写入不相交区间,彻底消除 false sharing;N == 1、空输入等也做前置处理。 4. **热内核函数 static 模板化 + 显式捕获 lambda**:CopyOneRow 改为头文件中的 static 模板函数,去 this 指针便于跨 TU 内联;并行 lambda 由默认捕获 [this, &...] 改为显式捕获,同时用 std::atomic<uint32_t> + memory_order_relaxed 收敛 shard 错误,避免原实现中 memcpy_s 失败被静默。 5. **合规与可维护性**:reinterpret_cast 替换为 aicpu::PtrToPtr;Compute 拆分为 CheckParams / ParseInputs / ValidateShapes / DoCompute<T> 等小函数(单函数 ≤ 50 行、圈复杂度 ≤ 5);不改成员的方法加 const;关键路径补 KERNEL_LOG_INFO,错误分支补 KERNEL_LOG_ERROR 含上下文信息;CPU 核使用策略(是否预留)与原实现一致。 6. **UT 扩展**:在原 16 例基础上新增 9 例(共 25 例),覆盖新增的 ByRow/ByInput 分派路径、axis=0 与一维退化形态、N=1、空输入、多 dtype、错误路径,保证优化前后行为严格等价。 ## 关联的Issue [#1342](https://gitcode.com/cann/ops-math/issues/1342) ## 测试 - **UT 全量回归**:直接 cmake 构建 math_aicpu_op_kernel_ut(绕开 build.sh --opkernel_aicpu_test 的 UT_TARGETS=() 已知 bug),25 例 UT 全部通过,覆盖常规路径、退化形态、错误路径、全部支持的 dtype。 - **等价性验证**:独立 microbench 对 7 个典型输入场景(小张量 × N 大、中等带宽、大张量、axis=0、N=1 等)执行 std::memcmp 逐字节比对,新旧实现输出完全一致。 - **性能验证**:在 1 / 4 / 10 三档线程下采集实测数据,典型场景加速 1.8×–7.6×。 ## 文档更新 无。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!2395 | 6 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 8 days ago | ||
| 2 months ago | ||
| 6 months ago |