| Files | Last commit | Last update |
|---|---|---|
产品名变更 Co-authored-by: gitcode-chenjiao<chenjiao31@huawei.com> # message auto-generated for no-merge-commit merge: !5912 merge master into master 产品名变更 Created-by: gitcode-chenjiao Commit-by: gitcode-chenjiao Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> AI处理器对应的产品型号名称更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#3258](https://gitcode.com/cann/ops-math/issues/3258) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ok ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> *.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5912 | 1 month ago | |
算子资料修改后同步修改example Co-authored-by: FelixTang7<tangyanfeng@huawei.com> # message auto-generated for no-merge-commit merge: !5542 merge md into master 算子资料修改后同步修改example Created-by: FelixTang7 Commit-by: FelixTang7 Merged-by: cann-robot Description: ## 描述 部分算子资料有误,修改算子文档后同步对example进行修改 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/3040 ## 测试 文档修改,无需测试 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5542 | 2 months ago | |
迁移开源TF插件--math Co-authored-by: yaochen<yaochen15@huawei.com> # message auto-generated for no-merge-commit merge: !4308 merge transfer-math into master 迁移开源TF插件--math Created-by: nextyale Commit-by: yaochen Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:迁移TF插件 See merge request: cann/ops-math!4308 | 3 months ago | |
fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 Co-authored-by: hahaha22<wangrunze20@h-partners.com> # message auto-generated for no-merge-commit merge: !5512 merge e-class-log-fix into master fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 Created-by: hahaha22 Commit-by: hahaha22 Merged-by: cann-robot Description: ## 描述 修复 E 类(报错格式瑕疵)问题:报错日志 dtype 支持列表出现双层中括号 [[..]]。拆分自 PR #5464(该 PR 原含 B/E 两类修改,现拆为独立 PR 便于评审;B 类见 PR #5502)。 ### 根因 格式串 dtype support list [%s] 与 op::ToString(std::initializer_list<DataType>) 自身输出的 [...] 叠加(该函数序列化列表时自带方括号,见 opbase data_type_utils.cpp 的 ToString 实现),导致日志出现 [[DT_INT32,...]]。 实测复现(910B3 + CANN 9.2.0,aclnnRemainderTensorScalar 传入 self=INT8/other=INT8/out=INT32): [ERROR] ... [aclnn_remainder.cpp:227][CheckPromoteTypeTensorScalar] errno[161002] OpName:[aclnnRemainderTensorScalar_0] expected dtype DT_INT8 should be in dtype support list [[DT_INT32,DT_INT64,DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_BFLOAT16,]]. ### 修改明细(7 处,[%s] 改为 %s,与 aclnn_mul.cpp:248 既有正确写法一致) - math/floor_mod/op_api/aclnn_remainder.cpp:3 处(Promote type :193 / expected dtype :223 / out dtype :255,对应 RemainderTensorTensor、RemainderTensorScalar/Inplace、RemainderScalarTensor) - math/greater/op_api/aclnn_gt_tensor.cpp:1 处(promoteType 报错,对应 GtTensor/InplaceGtTensor) - math/equal/op_api/aclnn_eq_tensor.cpp:1 处(promoteType 报错,对应 EqTensor/InplaceEqTensor) - math/equal/op_api/aclnn_eq_scalar.cpp:1 处(promote dtype 报错,对应 EqScalar) - math/equal/op_api/aclnn_isin_tensor_scalar.cpp:1 处(promoteType 报错,对应 IsInTensorScalar) 另:触碰的 5 个 cpp 文件按 clang-format 全量格式化(函数签名换行、OP_LOGE 参数对齐、注释空格等存量行),不改变执行逻辑,以通过 CI 全文件格式化检查。 ## 关联的Issue - #3096 ## 测试 - 变更仅涉及 OP_LOGE 日志格式串与格式化,参数校验逻辑、返回码、执行行为均不变。 - 已在 910B3 实测复现修复前的 [[..]] 报错,修复后输出单层 [...]。 ## 文档更新 - 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ### 关联issue - [cann/ops-math#5519(RemainderScalarTensor Regbase 计算类型校验,同改 aclnn_remainder.cpp)](https://gitcode.com/cann/ops-math/pull/5519) See merge request: cann/ops-math!5512 | 2 months ago | |
math仓算子代码整改 Co-authored-by: cai-chengchao<caichengchao1@h-partners.com> # message auto-generated for no-merge-commit merge: !881 merge math_op_back_1 into master math仓算子代码整改 Created-by: cai-chengchao Commit-by: cai-chengchao Merged-by: cann-robot Description: ## 描述 math仓算子代码整改 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!881 | 9 months ago | |
abs等20个算子新增ascend350平台支持 Co-authored-by: ASCEND222<dongfei16@h-partners.com> # message auto-generated for no-merge-commit merge: !5322 merge master into master abs等20个算子新增ascend350平台支持 Created-by: ASCEND222 Commit-by: ASCEND222 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> abs等20个算子新增ascend350平台支持 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/3028 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5322 | 2 months ago | |
支持neg等单目运算算子下一代kernel实现 Co-authored-by: 张磊<zhanglei121@huawei.com> # message auto-generated for no-merge-commit merge: !494 merge master into master 支持neg等单目运算算子下一代kernel实现 Created-by: zl_hw Commit-by: 张磊 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!494 | 10 months ago | |
Greater AICPU kernel 内存优化 Co-authored-by: Ding_Jing<dingjing19@huawei.com> # message auto-generated for no-merge-commit merge: !5364 merge fix/greater-aicpu-memory into master Greater AICPU kernel 内存优化 Created-by: Ding_Jing Commit-by: Ding_Jing Merged-by: cann-robot Description: ## 描述 Greater AICPU 原实现使用 Eigen Tensor 广播表达式,会产生额外临时缓冲并实例化大量 rank/dtype 模板。本 PR 改为固定长度的栈上 stride-0 广播计划和条带循环,直接写入 bool 输出。 ### 修改内容 - 同 shape、双向标量、普通广播及可折叠高 rank 统一走条带比较,不再物化 Eigen 中间结果。 - 在数据访问前校验输出元素数、空输出、负维度和广播结果乘积溢出;非法 shape 返回参数错误且不写输出。 - 合法非负索引使用 uint64_t,保留生产 -ftrapv。 - 增加负维度、输出大小不匹配、乘积溢出和输出哨兵 UT,并补齐既有用例未检查的后半输出。 - CodeCheck huge_method[C++] 告警通过缩短已有 helper 名处理:ValidateNonEmptyBcastResult 改为 ValidateBcastSize,canndev GreaterCompute() NBNC 由 51 降为 50;控制流和计算表达式不变。 ### 内存变化 完整 187 档中没有任何一档辅助堆峰值上升,调用后残留均为 0 B。当前实现常规 rank 1–8 为 376–464 B,双标量为 352 B,可折叠 rank 9 为 816 B。同一广播家族的输出规模从 1,536 增长到 61,440,000 时,改后辅助堆峰值保持 416 B;对应改前峰值为 25,112–61,976 B。 ## 关联的Issue - https://gitcode.com/cann/ops-math/issues/3024 ## 测试 | 测试项 | 结果 | | --- | --- | | 真实 AICPU UT,-O0/-O2 -ftrapv | 37/37、37/37 通过 | | 仓库原生 Greater AICPU UT | 37/37 通过 | | 常规值与特殊值精度、输出 guard | 187/187、187/187 通过 | | 破坏参考值反向检查 | 187/187 检出 | | 辅助堆 | 187/187 无上升,残留均为 0 B | | 完整性能矩阵 | 187/187 PASS,speedup=改前/改后 为 1.0794–4.1704 | | 31 轮定向 A/B 与基线 A/A | 3/3 PASS;最接近边界档的 speedup 校正下界为 1.0702 | | clang-format、pre-commit、CodeCheck、服务端 CI | 通过 | | 历史上板证据 | v6 候选 6/6 场景输出和 AICPU 路由通过;非当前 head 重测,不参与当前性能、内存和精度结论 | ### 逐档内存与性能(187 档) 表中 speedup=改前耗时/改后耗时,大于 1 表示改后更快。187 档全部明确通过;逐档表只保留内存和性能验收所需字段。 #### 逐 shape 与输出规模(22 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | small | double | 64 | 1,416 | 376 | 73.45% | 4,085 | 3,215 | 1.2706 | | sweep1536 | double | 1,536 | 25,112 | 416 | 98.34% | 12,675 | 5,870 | 2.1593 | | sweep15360 | double | 15,360 | 61,976 | 416 | 99.33% | 74,710.5 | 22,110.5 | 3.3790 | | sweep153600 | double | 153,600 | 33,304 | 416 | 98.75% | 743,087.5 | 230,627 | 3.2220 | | sweep1536000 | double | 1,536,000 | 33,304 | 416 | 98.75% | 7,743,609 | 2,750,813 | 2.8150 | | sweep15360000 | double | 15,360,000 | 33,304 | 416 | 98.75% | 81,914,275 | 41,072,477.5 | 1.9944 | | sweep61440000 | double | 61,440,000 | 33,304 | 416 | 98.75% | 330,234,243 | 165,018,039 | 2.0012 | | rank1 | double | 2,097,152 | 33,256 | 376 | 98.87% | 9,926,450.5 | 2,380,234.5 | 4.1704 | | rank2 | double | 2,097,152 | 33,256 | 400 | 98.80% | 10,016,434.5 | 3,017,051 | 3.3199 | | rank3 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,116,236 | 3,280,273.5 | 3.0840 | | rank4 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,216,484.5 | 3,288,993.5 | 3.1063 | | rank5 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,438,319.5 | 3,442,230 | 3.0324 | | rank6 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,213,337.5 | 3,285,658.5 | 3.1085 | | rank7 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,592,018 | 3,729,893 | 2.8398 | | rank8 | double | 1,048,576 | 33,400 | 464 | 98.61% | 5,056,120.5 | 1,573,621 | 3.2130 | | xscalar | double | 4,816,896 | 33,264 | 416 | 98.75% | 23,976,141.5 | 9,235,659 | 2.5960 | | yscalar | double | 4,816,896 | 33,264 | 416 | 98.75% | 23,923,015.5 | 9,451,916.5 | 2.5310 | | large | double | 38,535,168 | 33,304 | 416 | 98.75% | 207,510,581.5 | 99,584,351 | 2.0838 | | xscalar | float | 4,816,896 | 33,264 | 416 | 98.75% | 20,200,602.5 | 6,397,550 | 3.1576 | | yscalar | float | 4,816,896 | 33,264 | 416 | 98.75% | 20,372,294 | 6,277,868.5 | 3.2451 | | large | float | 38,535,168 | 33,304 | 416 | 98.75% | 177,683,098.5 | 84,410,232 | 2.1050 | | small | float | 64 | 904 | 376 | 58.41% | 4,050 | 3,205 | 1.2637 | #### 11 dtype × 4 shape(44 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | small | float16 | 64 | 648 | 376 | 41.98% | 4,020 | 3,305 | 1.2163 | | same | float16 | 4,816,896 | 33,208 | 416 | 98.75% | 20,791,697 | 13,736,184 | 1.5136 | | outer | float16 | 4,816,896 | 33,304 | 416 | 98.75% | 20,608,364.5 | 13,076,213.5 | 1.5760 | | inner | float16 | 4,816,896 | 33,304 | 416 | 98.75% | 89,486,627.5 | 27,968,184 | 3.1996 | | small | float | 64 | 904 | 376 | 58.41% | 4,100 | 3,210 | 1.2773 | | same | float | 4,816,896 | 33,208 | 416 | 98.75% | 21,987,221 | 9,882,961.5 | 2.2248 | | outer | float | 4,816,896 | 33,304 | 416 | 98.75% | 20,630,852 | 7,524,227 | 2.7419 | | inner | float | 4,816,896 | 33,304 | 416 | 98.75% | 84,735,251 | 25,040,879.5 | 3.3839 | | small | double | 64 | 1,416 | 376 | 73.45% | 4,095 | 3,220 | 1.2717 | | same | double | 4,816,896 | 33,208 | 416 | 98.75% | 25,242,786 | 12,864,865.5 | 1.9621 | | outer | double | 4,816,896 | 33,304 | 416 | 98.75% | 25,476,421.5 | 11,286,744.5 | 2.2572 | | inner | double | 4,816,896 | 33,304 | 416 | 98.75% | 106,179,849 | 26,465,351 | 4.0120 | | small | int8 | 64 | 520 | 376 | 27.69% | 4,085 | 3,200 | 1.2766 | | same | int8 | 4,816,896 | 33,208 | 416 | 98.75% | 17,897,798 | 4,791,738.5 | 3.7351 | | outer | int8 | 4,816,896 | 33,304 | 416 | 98.75% | 5,621,702 | 4,883,730 | 1.1511 | | inner | int8 | 4,816,896 | 33,304 | 416 | 98.75% | 71,912,144.5 | 25,131,276 | 2.8615 | | small | int16 | 64 | 648 | 376 | 41.98% | 4,050 | 3,210 | 1.2617 | | same | int16 | 4,816,896 | 33,208 | 416 | 98.75% | 18,820,809.5 | 7,454,666 | 2.5247 | | outer | int16 | 4,816,896 | 33,304 | 416 | 98.75% | 18,696,920 | 6,506,041 | 2.8738 | | inner | int16 | 4,816,896 | 33,304 | 416 | 98.75% | 79,975,075.5 | 24,235,670 | 3.2999 | | small | int32 | 64 | 904 | 376 | 58.41% | 4,040 | 3,210 | 1.2586 | | same | int32 | 4,816,896 | 33,208 | 416 | 98.75% | 21,831,952 | 10,742,992.5 | 2.0322 | | outer | int32 | 4,816,896 | 33,304 | 416 | 98.75% | 20,578,174.5 | 7,480,287 | 2.7510 | | inner | int32 | 4,816,896 | 33,304 | 416 | 98.75% | 86,402,362.5 | 24,881,924 | 3.4725 | | small | int64 | 64 | 1,416 | 376 | 73.45% | 4,155 | 3,220 | 1.2904 | | same | int64 | 4,816,896 | 33,208 | 416 | 98.75% | 25,232,712.5 | 12,414,831.5 | 2.0325 | | outer | int64 | 4,816,896 | 33,304 | 416 | 98.75% | 25,074,675 | 11,000,614.5 | 2.2794 | | inner | int64 | 4,816,896 | 33,304 | 416 | 98.75% | 106,001,023 | 26,417,768.5 | 4.0125 | | small | uint8 | 64 | 520 | 376 | 27.69% | 4,020 | 3,190 | 1.2602 | | same | uint8 | 4,816,896 | 33,208 | 416 | 98.75% | 17,851,950.5 | 5,471,011.5 | 3.2630 | | outer | uint8 | 4,816,896 | 33,304 | 416 | 98.75% | 5,739,069 | 4,999,798 | 1.1479 | | inner | uint8 | 4,816,896 | 33,304 | 416 | 98.75% | 71,831,799 | 25,065,006.5 | 2.8658 | | small | uint16 | 64 | 648 | 376 | 41.98% | 4,095 | 3,220 | 1.2717 | | same | uint16 | 4,816,896 | 33,208 | 416 | 98.75% | 18,678,319 | 7,555,697.5 | 2.4721 | | outer | uint16 | 4,816,896 | 33,304 | 416 | 98.75% | 18,596,043 | 6,349,029.5 | 2.9290 | | inner | uint16 | 4,816,896 | 33,304 | 416 | 98.75% | 78,960,769.5 | 24,240,418.5 | 3.2574 | | small | uint32 | 64 | 904 | 376 | 58.41% | 4,035 | 3,205 | 1.2590 | | same | uint32 | 4,816,896 | 33,208 | 416 | 98.75% | 21,799,641.5 | 10,911,036 | 1.9979 | | outer | uint32 | 4,816,896 | 33,304 | 416 | 98.75% | 20,597,103.5 | 7,327,155 | 2.8111 | | inner | uint32 | 4,816,896 | 33,304 | 416 | 98.75% | 86,393,881.5 | 24,895,675 | 3.4702 | | small | uint64 | 64 | 1,416 | 376 | 73.45% | 4,140 | 3,205 | 1.2917 | | same | uint64 | 4,816,896 | 33,208 | 416 | 98.75% | 25,262,852 | 12,621,062 | 2.0016 | | outer | uint64 | 4,816,896 | 33,304 | 416 | 98.75% | 25,109,645.5 | 10,894,885.5 | 2.3047 | | inner | uint64 | 4,816,896 | 33,304 | 416 | 98.75% | 105,890,322 | 26,490,314.5 | 3.9973 | #### rank 1–8 × 11 dtype(88 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | rank1 | float16 | 2,097,152 | 33,256 | 376 | 98.87% | 10,161,139 | 4,018,056 | 2.5289 | | rank2 | float16 | 2,097,152 | 33,256 | 400 | 98.80% | 8,731,424.5 | 5,418,765 | 1.6113 | | rank3 | float16 | 2,097,152 | 33,304 | 416 | 98.75% | 8,778,495 | 5,516,465.5 | 1.5913 | | rank4 | float16 | 2,097,152 | 33,304 | 416 | 98.75% | 8,783,470.5 | 5,557,606.5 | 1.5804 | | rank5 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,823,664 | 5,556,041 | 1.5881 | | rank6 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,778,824.5 | 5,547,096.5 | 1.5826 | | rank7 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,858,770.5 | 5,583,231.5 | 1.5867 | | rank8 | float16 | 1,048,576 | 33,400 | 464 | 98.61% | 4,357,628 | 2,782,968 | 1.5658 | | rank1 | float | 2,097,152 | 33,256 | 376 | 98.87% | 8,571,807 | 2,390,739.5 | 3.5854 | | rank2 | float | 2,097,152 | 33,256 | 400 | 98.80% | 8,715,703.5 | 2,688,992.5 | 3.2413 | | rank3 | float | 2,097,152 | 33,304 | 416 | 98.75% | 8,693,812.5 | 2,776,888.5 | 3.1308 | | rank4 | float | 2,097,152 | 33,304 | 416 | 98.75% | 8,679,648.5 | 2,794,678 | 3.1058 | | rank5 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,703,546.5 | 2,812,248.5 | 3.0949 | | rank6 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,686,547 | 2,841,009 | 3.0576 | | rank7 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,880,154.5 | 2,821,259 | 3.1476 | | rank8 | float | 1,048,576 | 33,400 | 464 | 98.61% | 4,373,304 | 1,384,794 | 3.1581 | | rank1 | double | 2,097,152 | 33,256 | 376 | 98.87% | 9,826,210.5 | 2,439,850 | 4.0274 | | rank2 | double | 2,097,152 | 33,256 | 400 | 98.80% | 9,992,914.5 | 3,094,041.5 | 3.2297 | | rank3 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,077,503 | 3,416,804 | 2.9494 | | rank4 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,086,401.5 | 3,377,984.5 | 2.9859 | | rank5 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,264,135.5 | 3,462,005.5 | 2.9648 | | rank6 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,067,067 | 3,334,028.5 | 3.0195 | | rank7 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,344,478 | 3,600,976.5 | 2.8727 | | rank8 | double | 1,048,576 | 33,400 | 464 | 98.61% | 5,085,496.5 | 1,591,371 | 3.1957 | | rank1 | int8 | 2,097,152 | 33,256 | 376 | 98.87% | 7,679,998.5 | 1,966,089.5 | 3.9062 | | rank2 | int8 | 2,097,152 | 33,256 | 400 | 98.80% | 2,434,094.5 | 2,106,456.5 | 1.1555 | | rank3 | int8 | 2,097,152 | 33,304 | 416 | 98.75% | 2,404,954 | 2,106,736 | 1.1416 | | rank4 | int8 | 2,097,152 | 33,304 | See merge request: cann/ops-math!5364 | 1 month ago | |
Greater AICPU kernel 内存优化 Co-authored-by: Ding_Jing<dingjing19@huawei.com> # message auto-generated for no-merge-commit merge: !5364 merge fix/greater-aicpu-memory into master Greater AICPU kernel 内存优化 Created-by: Ding_Jing Commit-by: Ding_Jing Merged-by: cann-robot Description: ## 描述 Greater AICPU 原实现使用 Eigen Tensor 广播表达式,会产生额外临时缓冲并实例化大量 rank/dtype 模板。本 PR 改为固定长度的栈上 stride-0 广播计划和条带循环,直接写入 bool 输出。 ### 修改内容 - 同 shape、双向标量、普通广播及可折叠高 rank 统一走条带比较,不再物化 Eigen 中间结果。 - 在数据访问前校验输出元素数、空输出、负维度和广播结果乘积溢出;非法 shape 返回参数错误且不写输出。 - 合法非负索引使用 uint64_t,保留生产 -ftrapv。 - 增加负维度、输出大小不匹配、乘积溢出和输出哨兵 UT,并补齐既有用例未检查的后半输出。 - CodeCheck huge_method[C++] 告警通过缩短已有 helper 名处理:ValidateNonEmptyBcastResult 改为 ValidateBcastSize,canndev GreaterCompute() NBNC 由 51 降为 50;控制流和计算表达式不变。 ### 内存变化 完整 187 档中没有任何一档辅助堆峰值上升,调用后残留均为 0 B。当前实现常规 rank 1–8 为 376–464 B,双标量为 352 B,可折叠 rank 9 为 816 B。同一广播家族的输出规模从 1,536 增长到 61,440,000 时,改后辅助堆峰值保持 416 B;对应改前峰值为 25,112–61,976 B。 ## 关联的Issue - https://gitcode.com/cann/ops-math/issues/3024 ## 测试 | 测试项 | 结果 | | --- | --- | | 真实 AICPU UT,-O0/-O2 -ftrapv | 37/37、37/37 通过 | | 仓库原生 Greater AICPU UT | 37/37 通过 | | 常规值与特殊值精度、输出 guard | 187/187、187/187 通过 | | 破坏参考值反向检查 | 187/187 检出 | | 辅助堆 | 187/187 无上升,残留均为 0 B | | 完整性能矩阵 | 187/187 PASS,speedup=改前/改后 为 1.0794–4.1704 | | 31 轮定向 A/B 与基线 A/A | 3/3 PASS;最接近边界档的 speedup 校正下界为 1.0702 | | clang-format、pre-commit、CodeCheck、服务端 CI | 通过 | | 历史上板证据 | v6 候选 6/6 场景输出和 AICPU 路由通过;非当前 head 重测,不参与当前性能、内存和精度结论 | ### 逐档内存与性能(187 档) 表中 speedup=改前耗时/改后耗时,大于 1 表示改后更快。187 档全部明确通过;逐档表只保留内存和性能验收所需字段。 #### 逐 shape 与输出规模(22 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | small | double | 64 | 1,416 | 376 | 73.45% | 4,085 | 3,215 | 1.2706 | | sweep1536 | double | 1,536 | 25,112 | 416 | 98.34% | 12,675 | 5,870 | 2.1593 | | sweep15360 | double | 15,360 | 61,976 | 416 | 99.33% | 74,710.5 | 22,110.5 | 3.3790 | | sweep153600 | double | 153,600 | 33,304 | 416 | 98.75% | 743,087.5 | 230,627 | 3.2220 | | sweep1536000 | double | 1,536,000 | 33,304 | 416 | 98.75% | 7,743,609 | 2,750,813 | 2.8150 | | sweep15360000 | double | 15,360,000 | 33,304 | 416 | 98.75% | 81,914,275 | 41,072,477.5 | 1.9944 | | sweep61440000 | double | 61,440,000 | 33,304 | 416 | 98.75% | 330,234,243 | 165,018,039 | 2.0012 | | rank1 | double | 2,097,152 | 33,256 | 376 | 98.87% | 9,926,450.5 | 2,380,234.5 | 4.1704 | | rank2 | double | 2,097,152 | 33,256 | 400 | 98.80% | 10,016,434.5 | 3,017,051 | 3.3199 | | rank3 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,116,236 | 3,280,273.5 | 3.0840 | | rank4 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,216,484.5 | 3,288,993.5 | 3.1063 | | rank5 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,438,319.5 | 3,442,230 | 3.0324 | | rank6 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,213,337.5 | 3,285,658.5 | 3.1085 | | rank7 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,592,018 | 3,729,893 | 2.8398 | | rank8 | double | 1,048,576 | 33,400 | 464 | 98.61% | 5,056,120.5 | 1,573,621 | 3.2130 | | xscalar | double | 4,816,896 | 33,264 | 416 | 98.75% | 23,976,141.5 | 9,235,659 | 2.5960 | | yscalar | double | 4,816,896 | 33,264 | 416 | 98.75% | 23,923,015.5 | 9,451,916.5 | 2.5310 | | large | double | 38,535,168 | 33,304 | 416 | 98.75% | 207,510,581.5 | 99,584,351 | 2.0838 | | xscalar | float | 4,816,896 | 33,264 | 416 | 98.75% | 20,200,602.5 | 6,397,550 | 3.1576 | | yscalar | float | 4,816,896 | 33,264 | 416 | 98.75% | 20,372,294 | 6,277,868.5 | 3.2451 | | large | float | 38,535,168 | 33,304 | 416 | 98.75% | 177,683,098.5 | 84,410,232 | 2.1050 | | small | float | 64 | 904 | 376 | 58.41% | 4,050 | 3,205 | 1.2637 | #### 11 dtype × 4 shape(44 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | small | float16 | 64 | 648 | 376 | 41.98% | 4,020 | 3,305 | 1.2163 | | same | float16 | 4,816,896 | 33,208 | 416 | 98.75% | 20,791,697 | 13,736,184 | 1.5136 | | outer | float16 | 4,816,896 | 33,304 | 416 | 98.75% | 20,608,364.5 | 13,076,213.5 | 1.5760 | | inner | float16 | 4,816,896 | 33,304 | 416 | 98.75% | 89,486,627.5 | 27,968,184 | 3.1996 | | small | float | 64 | 904 | 376 | 58.41% | 4,100 | 3,210 | 1.2773 | | same | float | 4,816,896 | 33,208 | 416 | 98.75% | 21,987,221 | 9,882,961.5 | 2.2248 | | outer | float | 4,816,896 | 33,304 | 416 | 98.75% | 20,630,852 | 7,524,227 | 2.7419 | | inner | float | 4,816,896 | 33,304 | 416 | 98.75% | 84,735,251 | 25,040,879.5 | 3.3839 | | small | double | 64 | 1,416 | 376 | 73.45% | 4,095 | 3,220 | 1.2717 | | same | double | 4,816,896 | 33,208 | 416 | 98.75% | 25,242,786 | 12,864,865.5 | 1.9621 | | outer | double | 4,816,896 | 33,304 | 416 | 98.75% | 25,476,421.5 | 11,286,744.5 | 2.2572 | | inner | double | 4,816,896 | 33,304 | 416 | 98.75% | 106,179,849 | 26,465,351 | 4.0120 | | small | int8 | 64 | 520 | 376 | 27.69% | 4,085 | 3,200 | 1.2766 | | same | int8 | 4,816,896 | 33,208 | 416 | 98.75% | 17,897,798 | 4,791,738.5 | 3.7351 | | outer | int8 | 4,816,896 | 33,304 | 416 | 98.75% | 5,621,702 | 4,883,730 | 1.1511 | | inner | int8 | 4,816,896 | 33,304 | 416 | 98.75% | 71,912,144.5 | 25,131,276 | 2.8615 | | small | int16 | 64 | 648 | 376 | 41.98% | 4,050 | 3,210 | 1.2617 | | same | int16 | 4,816,896 | 33,208 | 416 | 98.75% | 18,820,809.5 | 7,454,666 | 2.5247 | | outer | int16 | 4,816,896 | 33,304 | 416 | 98.75% | 18,696,920 | 6,506,041 | 2.8738 | | inner | int16 | 4,816,896 | 33,304 | 416 | 98.75% | 79,975,075.5 | 24,235,670 | 3.2999 | | small | int32 | 64 | 904 | 376 | 58.41% | 4,040 | 3,210 | 1.2586 | | same | int32 | 4,816,896 | 33,208 | 416 | 98.75% | 21,831,952 | 10,742,992.5 | 2.0322 | | outer | int32 | 4,816,896 | 33,304 | 416 | 98.75% | 20,578,174.5 | 7,480,287 | 2.7510 | | inner | int32 | 4,816,896 | 33,304 | 416 | 98.75% | 86,402,362.5 | 24,881,924 | 3.4725 | | small | int64 | 64 | 1,416 | 376 | 73.45% | 4,155 | 3,220 | 1.2904 | | same | int64 | 4,816,896 | 33,208 | 416 | 98.75% | 25,232,712.5 | 12,414,831.5 | 2.0325 | | outer | int64 | 4,816,896 | 33,304 | 416 | 98.75% | 25,074,675 | 11,000,614.5 | 2.2794 | | inner | int64 | 4,816,896 | 33,304 | 416 | 98.75% | 106,001,023 | 26,417,768.5 | 4.0125 | | small | uint8 | 64 | 520 | 376 | 27.69% | 4,020 | 3,190 | 1.2602 | | same | uint8 | 4,816,896 | 33,208 | 416 | 98.75% | 17,851,950.5 | 5,471,011.5 | 3.2630 | | outer | uint8 | 4,816,896 | 33,304 | 416 | 98.75% | 5,739,069 | 4,999,798 | 1.1479 | | inner | uint8 | 4,816,896 | 33,304 | 416 | 98.75% | 71,831,799 | 25,065,006.5 | 2.8658 | | small | uint16 | 64 | 648 | 376 | 41.98% | 4,095 | 3,220 | 1.2717 | | same | uint16 | 4,816,896 | 33,208 | 416 | 98.75% | 18,678,319 | 7,555,697.5 | 2.4721 | | outer | uint16 | 4,816,896 | 33,304 | 416 | 98.75% | 18,596,043 | 6,349,029.5 | 2.9290 | | inner | uint16 | 4,816,896 | 33,304 | 416 | 98.75% | 78,960,769.5 | 24,240,418.5 | 3.2574 | | small | uint32 | 64 | 904 | 376 | 58.41% | 4,035 | 3,205 | 1.2590 | | same | uint32 | 4,816,896 | 33,208 | 416 | 98.75% | 21,799,641.5 | 10,911,036 | 1.9979 | | outer | uint32 | 4,816,896 | 33,304 | 416 | 98.75% | 20,597,103.5 | 7,327,155 | 2.8111 | | inner | uint32 | 4,816,896 | 33,304 | 416 | 98.75% | 86,393,881.5 | 24,895,675 | 3.4702 | | small | uint64 | 64 | 1,416 | 376 | 73.45% | 4,140 | 3,205 | 1.2917 | | same | uint64 | 4,816,896 | 33,208 | 416 | 98.75% | 25,262,852 | 12,621,062 | 2.0016 | | outer | uint64 | 4,816,896 | 33,304 | 416 | 98.75% | 25,109,645.5 | 10,894,885.5 | 2.3047 | | inner | uint64 | 4,816,896 | 33,304 | 416 | 98.75% | 105,890,322 | 26,490,314.5 | 3.9973 | #### rank 1–8 × 11 dtype(88 档) | case | dtype | 元素数 | 改前堆 B | 改后堆 B | 降幅 | 改前 ns | 改后 ns | speedup | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | rank1 | float16 | 2,097,152 | 33,256 | 376 | 98.87% | 10,161,139 | 4,018,056 | 2.5289 | | rank2 | float16 | 2,097,152 | 33,256 | 400 | 98.80% | 8,731,424.5 | 5,418,765 | 1.6113 | | rank3 | float16 | 2,097,152 | 33,304 | 416 | 98.75% | 8,778,495 | 5,516,465.5 | 1.5913 | | rank4 | float16 | 2,097,152 | 33,304 | 416 | 98.75% | 8,783,470.5 | 5,557,606.5 | 1.5804 | | rank5 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,823,664 | 5,556,041 | 1.5881 | | rank6 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,778,824.5 | 5,547,096.5 | 1.5826 | | rank7 | float16 | 2,097,152 | 33,400 | 464 | 98.61% | 8,858,770.5 | 5,583,231.5 | 1.5867 | | rank8 | float16 | 1,048,576 | 33,400 | 464 | 98.61% | 4,357,628 | 2,782,968 | 1.5658 | | rank1 | float | 2,097,152 | 33,256 | 376 | 98.87% | 8,571,807 | 2,390,739.5 | 3.5854 | | rank2 | float | 2,097,152 | 33,256 | 400 | 98.80% | 8,715,703.5 | 2,688,992.5 | 3.2413 | | rank3 | float | 2,097,152 | 33,304 | 416 | 98.75% | 8,693,812.5 | 2,776,888.5 | 3.1308 | | rank4 | float | 2,097,152 | 33,304 | 416 | 98.75% | 8,679,648.5 | 2,794,678 | 3.1058 | | rank5 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,703,546.5 | 2,812,248.5 | 3.0949 | | rank6 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,686,547 | 2,841,009 | 3.0576 | | rank7 | float | 2,097,152 | 33,400 | 464 | 98.61% | 8,880,154.5 | 2,821,259 | 3.1476 | | rank8 | float | 1,048,576 | 33,400 | 464 | 98.61% | 4,373,304 | 1,384,794 | 3.1581 | | rank1 | double | 2,097,152 | 33,256 | 376 | 98.87% | 9,826,210.5 | 2,439,850 | 4.0274 | | rank2 | double | 2,097,152 | 33,256 | 400 | 98.80% | 9,992,914.5 | 3,094,041.5 | 3.2297 | | rank3 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,077,503 | 3,416,804 | 2.9494 | | rank4 | double | 2,097,152 | 33,304 | 416 | 98.75% | 10,086,401.5 | 3,377,984.5 | 2.9859 | | rank5 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,264,135.5 | 3,462,005.5 | 2.9648 | | rank6 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,067,067 | 3,334,028.5 | 3.0195 | | rank7 | double | 2,097,152 | 33,400 | 464 | 98.61% | 10,344,478 | 3,600,976.5 | 2.8727 | | rank8 | double | 1,048,576 | 33,400 | 464 | 98.61% | 5,085,496.5 | 1,591,371 | 3.1957 | | rank1 | int8 | 2,097,152 | 33,256 | 376 | 98.87% | 7,679,998.5 | 1,966,089.5 | 3.9062 | | rank2 | int8 | 2,097,152 | 33,256 | 400 | 98.80% | 2,434,094.5 | 2,106,456.5 | 1.1555 | | rank3 | int8 | 2,097,152 | 33,304 | 416 | 98.75% | 2,404,954 | 2,106,736 | 1.1416 | | rank4 | int8 | 2,097,152 | 33,304 | See merge request: cann/ops-math!5364 | 1 month ago | |
abs等20个算子新增ascend350平台支持 Co-authored-by: ASCEND222<dongfei16@h-partners.com> # message auto-generated for no-merge-commit merge: !5322 merge master into master abs等20个算子新增ascend350平台支持 Created-by: ASCEND222 Commit-by: ASCEND222 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> abs等20个算子新增ascend350平台支持 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/3028 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5322 | 2 months ago | |
产品名变更 Co-authored-by: gitcode-chenjiao<chenjiao31@huawei.com> # message auto-generated for no-merge-commit merge: !5912 merge master into master 产品名变更 Created-by: gitcode-chenjiao Commit-by: gitcode-chenjiao Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> AI处理器对应的产品型号名称更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#3258](https://gitcode.com/cann/ops-math/issues/3258) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ok ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> *.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5912 | 1 month ago |
Greater
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR&950DT系列产品 | √ |
| Atlas A3系列产品 | √ |
| Atlas A2系列产品 | √ |
| Atlas 200I/500 A2推理产品 | × |
| Atlas推理系列产品 | √ |
| Atlas训练系列产品 | √ |
功能说明
-
算子功能:判断输入Tensor中的每个元素是否大于other Scalar的值,返回一个Bool类型的Tensor,对应输入Tensor中每个位置的大于判断是否成立。
-
计算公式: 对于入参self,和比较标量other,gt可以用如下数学公式表示:
yi=(x1i>x2i)?True:Falsey_{i}= (x1_i > x2_i) ? True : False yi=(x1i>x2i)?True:False
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x1 | 输入 | 公式中的输入张量x1。 | DOUBLE、FLOAT、FLOAT16、BFLOAT16、INT32、UINT32、INT64、UINT64、INT16、UINT16、INT8、UINT8、BOOL | ND |
| x2 | 输入 | 公式中的输入张量x2。 | DOUBLE、FLOAT、FLOAT16、BFLOAT16、INT32、UINT32、INT64、UINT64、INT16、UINT16、INT8、UINT8、BOOL | ND |
| y | 输出 | 公式中的输出张量y。 | BOOL | ND |
约束说明
无
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_gt_scalar | 通过aclnnGtScalar&aclnnInplaceGtScalar接口方式调用Greater算子。 |
| 图模式调用 | test_geir_greater | 通过算子IR构图方式调用Greater算子。 |