| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
modified md files (modified the product name and link path) Co-authored-by: duhuiping<duhuiping@h-partners.com> # message auto-generated for no-merge-commit merge: !11029 merge master into master modified md files (modified the product name and link path) Created-by: gitee-duhuiping Commit-by: duhuiping Merged-by: cann-robot Description: ## 描述 Changed the product name and link path ## 关联的Issue [#6092](https://gitcode.com/cann/ops-nn/issues/6092) ## 测试 Only involves updating the MD document description, does not involve testing. ## 文档更新 md files ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-nn!11029 | 20 天前 | |
foreach 示例代码增加aclrtMemcpy返回值校验 Co-authored-by: tramp-ll<linglong4@huawei.com> # message auto-generated for no-merge-commit merge: !7791 merge master into master foreach 示例代码增加aclrtMemcpy返回值校验 Created-by: tramp-ll Commit-by: tramp-ll Merged-by: cann-robot Description: ## 描述 foreach 示例代码增加aclrtMemcpy返回值校验 ## 关联的Issue Issue: https://gitcode.com/cann/ops-nn/issues/4219 ## 测试 NA ## 文档更新 更新foreach系列算子md资料 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!7791 | 2 个月前 | |
update foreach and licence Co-authored-by: daiwei18<daiwei18@huawei.com> # message auto-generated for no-merge-commit merge: !966 merge master into master update foreach and licence Created-by: daiwei18 Commit-by: daiwei18 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-nn!966 | 8 个月前 | |
bn_infer等26个算子新增ascend350平台支持 Co-authored-by: Developer user<zhuzixian1@h-partners.com> # message auto-generated for no-merge-commit merge: !10255 merge ascend350_adapt_w2 into master bn_infer等26个算子新增ascend350平台支持 Created-by: zhuzixian-lr Commit-by: Developer user Merged-by: cann-robot Description: ## 描述 26个算子新增ascend350平台支持:foreach_mul_scalar、foreach_sqrt、foreach_addcmul_scalar、foreach_div_scalar_list、foreach_lerp_scalar、foreach_norm、bn_infer、apply_adagrad_d、apply_gradient_descent、apply_adam、apply_adam_w_v2、embedding_hash_table_apply_adam_w、embedding_hash_table_export、embedding_hash_table_import、embedding_hash_table_lookup_or_insert、init_embedding_hash_table、binary_cross_entropy、sigmoid_cross_entropy_with_logits_v2、binary_cross_entropy_grad、l2_loss、nll_loss、nll_loss_grad、sparse_softmax_cross_entropy_with_logits、softmax_cross_entropy_with_logits、swiglu_group_quant、swi_glu。 修改模式(350与ascend950完全同配,两者同为 DAV_3510,走同一代码分支): - op_host/<op>_def.cpp:追加 AddConfig("ascend350"),复用 ascend950 同一 config 对象(regbase 形态含 foreach 系/bn_infer/apply_adam_w_v2/swi_glu 等) - CMakeLists:SUPPORT_COMPUTE_UNIT/SUPPORT_TILING_DIR(或 COMPUTE_UNITS 形态)增加 ascend350/arch35(bn_infer 为 op_host/CMakeLists 特殊形态,对标 bn_training_reduce 先例) - op_host/config/ascend350/:拷贝 ascend950 的 <op>_binary.json - scripts/kernel/binary_config/ascendc_config.json:仅对 json 中已有条目的算子修改(foreach 系 6 个 + SwiGlu 共 7 条 compute_units 加 ascend350,compile_options 与 ascend950 逐项相同);原无条目的算子不新增登记,避免影响默认编译选项行为 - nll_loss_grad 的 CMakeLists.txt 版权头规范化(OAT 合规检查要求) ## 测试 A5(Ascend950PR)环境实测: - bash build.sh --pkg --soc=ascend350 --ops=<op> --vendor_name=customize -j4 编译验证:26/26 算子通过(产物 .o、run 包产出、json 选项注入均验证;softmax_cross_entropy_with_logits 用 --soc=ascend950 对照编译确认两侧产物同构) - pre-commit 全部检查通过(按文件运行,含 clang-format/codespell/OAT 合规) ## 关联的Issue https://gitcode.com/cann/ops-nn/issues/5780 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 ## SocVersion 判断合规化 - 规则:不允许 SocVersion 区间判断隐式覆盖芯片,950/350 需显式 IsRegBase() 判断,不再依赖枚举顺序副作用 - 本 MR 涉及 1 处(sigmoid_cross_entropy_with_logits_v2 的 binary_cross_entropy_with_logits),已完成修改 - 改法:保留原 [ASCEND910B, ASCEND910E] 区间(覆盖 910B/910C/910E),或逻辑增加 IsRegbase()(显式覆盖 regbase 芯片,与 upstream !10101 已合入的 Ops::NN::AclnnUtil::IsRegbase() 同形态) - 行为零变化:950 原区间命中(true)→现 IsRegbase()(true);350 原被区间覆盖(true)→现 IsRegbase()(true);910B/C/E 走原区间不变 - 分支已 rebase 至最新 upstream master ## 四件套完整性检视修复 - 全量检视发现 17 个算子的 ascendc_config.json 登记缺失(摸底时带下划线 grep 未命中全驼峰条目名,误记为 950 无条目) - 涉及:loss 7(BinaryCrossEntropy/Grad、L2Loss、NLLLoss/Grad、SigmoidCrossEntropyWithLogitsV2、SparseSoftmaxCrossEntropyWithLogits)、hash 5(EmbeddingHashTableApplyAdamW/Export/Import/LookupOrInsert、InitEmbeddingHashTable)、optim 4(ApplyAdagradD、ApplyAdam、ApplyAdamWV2、ApplyGradientDescent)、activation 1(SoftmaxCrossEntropyWithLogits) - 修复:对标各自 ascend950 条目补登 ascend350(compute_units 追加 + compile_options 照抄),def/CMake/config 三件原已齐备 - 其余 84 算子四件套核查全绿或形态与 950 一致(详见任务侧检视报告) ## 补充算子 - foreach_add_scalar:清单补充登记,四件套补齐(def AddConfig ascend350 与 950 同 regbaseCfg 对象、op_kernel CMake COMPUTE_UNITS、config/ascend350/binary.json、ascendc_config.json 条目对标 950 追加 + compile_options 照抄),与同族 foreach_addcmul_scalar 等先例形态一致 ## 算子目录内融合规则适配 - 全量排查两波 84 算子目录 op_graph 层:仓内融合 pass 共 2 个、graph_infer 12 个、graph_plugin 1 个 - 🔴 修复 1 处:layer_norm/op_graph/fusion_pass/layer_norm_remove_broadcast_fusion_pass.cpp:102 support_soc 集合 {"Ascend950","MC62"} 增加 Ascend350(原 350 跳过融合与 950 分叉);ops-transformer 的 apply_rotary_pos_emb_tensormove_pass 无平台门控天然放行 See merge request: cann/ops-nn!10255 | 23 天前 | |
bn_infer等26个算子新增ascend350平台支持 Co-authored-by: Developer user<zhuzixian1@h-partners.com> # message auto-generated for no-merge-commit merge: !10255 merge ascend350_adapt_w2 into master bn_infer等26个算子新增ascend350平台支持 Created-by: zhuzixian-lr Commit-by: Developer user Merged-by: cann-robot Description: ## 描述 26个算子新增ascend350平台支持:foreach_mul_scalar、foreach_sqrt、foreach_addcmul_scalar、foreach_div_scalar_list、foreach_lerp_scalar、foreach_norm、bn_infer、apply_adagrad_d、apply_gradient_descent、apply_adam、apply_adam_w_v2、embedding_hash_table_apply_adam_w、embedding_hash_table_export、embedding_hash_table_import、embedding_hash_table_lookup_or_insert、init_embedding_hash_table、binary_cross_entropy、sigmoid_cross_entropy_with_logits_v2、binary_cross_entropy_grad、l2_loss、nll_loss、nll_loss_grad、sparse_softmax_cross_entropy_with_logits、softmax_cross_entropy_with_logits、swiglu_group_quant、swi_glu。 修改模式(350与ascend950完全同配,两者同为 DAV_3510,走同一代码分支): - op_host/<op>_def.cpp:追加 AddConfig("ascend350"),复用 ascend950 同一 config 对象(regbase 形态含 foreach 系/bn_infer/apply_adam_w_v2/swi_glu 等) - CMakeLists:SUPPORT_COMPUTE_UNIT/SUPPORT_TILING_DIR(或 COMPUTE_UNITS 形态)增加 ascend350/arch35(bn_infer 为 op_host/CMakeLists 特殊形态,对标 bn_training_reduce 先例) - op_host/config/ascend350/:拷贝 ascend950 的 <op>_binary.json - scripts/kernel/binary_config/ascendc_config.json:仅对 json 中已有条目的算子修改(foreach 系 6 个 + SwiGlu 共 7 条 compute_units 加 ascend350,compile_options 与 ascend950 逐项相同);原无条目的算子不新增登记,避免影响默认编译选项行为 - nll_loss_grad 的 CMakeLists.txt 版权头规范化(OAT 合规检查要求) ## 测试 A5(Ascend950PR)环境实测: - bash build.sh --pkg --soc=ascend350 --ops=<op> --vendor_name=customize -j4 编译验证:26/26 算子通过(产物 .o、run 包产出、json 选项注入均验证;softmax_cross_entropy_with_logits 用 --soc=ascend950 对照编译确认两侧产物同构) - pre-commit 全部检查通过(按文件运行,含 clang-format/codespell/OAT 合规) ## 关联的Issue https://gitcode.com/cann/ops-nn/issues/5780 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 ## SocVersion 判断合规化 - 规则:不允许 SocVersion 区间判断隐式覆盖芯片,950/350 需显式 IsRegBase() 判断,不再依赖枚举顺序副作用 - 本 MR 涉及 1 处(sigmoid_cross_entropy_with_logits_v2 的 binary_cross_entropy_with_logits),已完成修改 - 改法:保留原 [ASCEND910B, ASCEND910E] 区间(覆盖 910B/910C/910E),或逻辑增加 IsRegbase()(显式覆盖 regbase 芯片,与 upstream !10101 已合入的 Ops::NN::AclnnUtil::IsRegbase() 同形态) - 行为零变化:950 原区间命中(true)→现 IsRegbase()(true);350 原被区间覆盖(true)→现 IsRegbase()(true);910B/C/E 走原区间不变 - 分支已 rebase 至最新 upstream master ## 四件套完整性检视修复 - 全量检视发现 17 个算子的 ascendc_config.json 登记缺失(摸底时带下划线 grep 未命中全驼峰条目名,误记为 950 无条目) - 涉及:loss 7(BinaryCrossEntropy/Grad、L2Loss、NLLLoss/Grad、SigmoidCrossEntropyWithLogitsV2、SparseSoftmaxCrossEntropyWithLogits)、hash 5(EmbeddingHashTableApplyAdamW/Export/Import/LookupOrInsert、InitEmbeddingHashTable)、optim 4(ApplyAdagradD、ApplyAdam、ApplyAdamWV2、ApplyGradientDescent)、activation 1(SoftmaxCrossEntropyWithLogits) - 修复:对标各自 ascend950 条目补登 ascend350(compute_units 追加 + compile_options 照抄),def/CMake/config 三件原已齐备 - 其余 84 算子四件套核查全绿或形态与 950 一致(详见任务侧检视报告) ## 补充算子 - foreach_add_scalar:清单补充登记,四件套补齐(def AddConfig ascend350 与 950 同 regbaseCfg 对象、op_kernel CMake COMPUTE_UNITS、config/ascend350/binary.json、ascendc_config.json 条目对标 950 追加 + compile_options 照抄),与同族 foreach_addcmul_scalar 等先例形态一致 ## 算子目录内融合规则适配 - 全量排查两波 84 算子目录 op_graph 层:仓内融合 pass 共 2 个、graph_infer 12 个、graph_plugin 1 个 - 🔴 修复 1 处:layer_norm/op_graph/fusion_pass/layer_norm_remove_broadcast_fusion_pass.cpp:102 support_soc 集合 {"Ascend950","MC62"} 增加 Ascend350(原 350 跳过融合与 950 分叉);ops-transformer 的 apply_rotary_pos_emb_tensormove_pass 无平台门控天然放行 See merge request: cann/ops-nn!10255 | 23 天前 | |
add cases Co-authored-by: zhaogrug<zhaohai16@h-partners.com> # message auto-generated for no-merge-commit merge: !8026 merge the_rest_of_cases into master add cases Created-by: zhaogrug Commit-by: zhaogrug Merged-by: cann-robot Description: ## 描述 新增仓内新版ttk用例 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue [#4386](https://gitcode.com/cann/ops-nn/issues/4386) <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> ## 测试 冒烟测试,本地验证 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:用例添加 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!8026 | 2 个月前 | |
update foreach and licence Co-authored-by: daiwei18<daiwei18@huawei.com> # message auto-generated for no-merge-commit merge: !966 merge master into master update foreach and licence Created-by: daiwei18 Commit-by: daiwei18 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-nn!966 | 8 个月前 | |
modified md files (modified the product name and link path) Co-authored-by: duhuiping<duhuiping@h-partners.com> # message auto-generated for no-merge-commit merge: !11029 merge master into master modified md files (modified the product name and link path) Created-by: gitee-duhuiping Commit-by: duhuiping Merged-by: cann-robot Description: ## 描述 Changed the product name and link path ## 关联的Issue [#6092](https://gitcode.com/cann/ops-nn/issues/6092) ## 测试 Only involves updating the MD document description, does not involve testing. ## 文档更新 md files ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-nn!11029 | 20 天前 |
ForeachNorm
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR&950DT系列产品 | √ |
| Atlas A3系列产品 | √ |
| Atlas A2系列产品 | √ |
| Atlas 200I/500 A2推理产品 | × |
| Atlas推理系列产品 | × |
| Atlas训练系列产品 | × |
| Kirin X90处理器系列产品 | √ |
| Kirin 9030处理器系列产品 | √ |
功能说明
- 算子功能:对输入张量列表的每个张量进行范数运算。
- 计算公式:
-
Atlas A2系列产品、Atlas A3系列产品:
x=[x0,x1,...xn−1]x = [{x_0}, {x_1}, ... {x_{n-1}}]\\ x=[x0,x1,...xn−1]
y=(∑i=0n−1∣xi∣p)1p(i=0,1,...n−1)y = \left(\sum_{i=0}^{n-1}|x_i|^{p}\right)^{\frac{1}{{p}}} (i=0,1,...n-1) y=(i=0∑n−1∣xi∣p)p1(i=0,1,...n−1)
-
Ascend 950PR&950DT系列产品:
x=[x0,x1,...xn−1]x = [{x_0}, {x_1}, ... {x_{n-1}}]\\ x=[x0,x1,...xn−1]
-
scalar = +Inf:
y=max∣xi∣y = \max|x_i| y=max∣xi∣
-
int(scalar) = 1:
y=∑i=0n−1∣xi∣y = \sum_{i=0}^{n-1}|x_i| y=i=0∑n−1∣xi∣
-
other:
y=(∑i=0n−1∣xi∣2)12y = \left(\sum_{i=0}^{n-1}|x_i|^{2}\right)^{\frac{1}{{2}}} y=(i=0∑n−1∣xi∣2)21
-
-
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 表示进行范数运算的输入张量列表,对应公式中的`x`。该参数中所有Tensor的数据类型保持一致。 | FLOAT32、FLOAT16、BFLOAT16 | ND |
| scalar | 输入 | 表示进行范数运算的阶数,对应公式中的`p`。 | FLOAT32、INT64 | ND |
| y | 输出 | 表示进行范数运算的输出张量列表,对应公式中的`y`。数据类型、数据格式与入参`x`的数据类型、数据格式一致,shape size为1。 | FLOAT32、FLOAT16、BFLOAT16 | ND |
-
Ascend 950PR&950DT系列产品:
- 输入
x、输出y支持的最大长度为256个。 - 输入
scalar的取值,仅支持1或者2。
- 输入
-
Kirin X90处理器系列产品、Kirin 9030处理器系列产品:x和y的数据类型不支持BFLOAT16。
约束说明
- 输出不支持非连续Tensor。
调用说明
| 调用方式 | 样例代码 | 说明 |
|---|---|---|
| aclnn接口 | test_aclnn_foreach_norm | 通过aclnnForeachNorm接口方式调用ForeachNorm算子。 |
| 图模式 | - | 通过算子IR构图方式调用ForeachNorm算子。 |