| Files | Last commit | Last update |
|---|---|---|
refactor: 迁移 arch35 算子 Reg API、修正拼写并规范化日志文案 Co-authored-by: esok11<yangsifa@huawei.com> # message auto-generated for no-merge-commit merge: !5135 merge f082601 into master refactor: 迁移 arch35 算子 Reg API、修正拼写并规范化日志文案 Created-by: esok11 Commit-by: esok11 Merged-by: cann-robot Description: ## 描述 对 arch35 架构下多个算子进行 AscendC Reg API 迁移、命名拼写修正及日志文案规范化,共 46 个文件,涉及 conversion/ 与 math/ 下 15 个算子。 主要改动: - AscendC Reg API 迁移(arch35 kernel 代码,21 个 .h 文件): - 地址空间修饰符: __local_mem__ → __ubuf__ - Reg 数据搬运 API 细化:加载用 AscendC::Reg::LoadAlign(原 Reg::DataCopy 加载语义),存储用 AscendC::Reg::StoreAlign(原 Reg::DataCopy 存储语义) - 掩码操作 API 重命名:AscendC::Reg::MaskNot → AscendC::Reg::Not、AscendC::Reg::MaskAnd → AscendC::Reg::And - 移除冗余 using AscendC::Reg::DataCopy; 声明 - 命名拼写修正(op_host/arch35,3 个文件): - 方法名 TilingForReleatedTranspose → TilingForRelatedTranspose(Releated→Related) - 成员变量 isReleatedTranspsoe_ → isRelatedTranspose_(Releated→Related, Transpsoe→Transpose) - 同步修改 confusion_transpose_d、depth_to_space 中对该方法的调用 - 日志清理(examples、op_host、op_api,22 个文件): - 失败路径日志级别 INFO → ERROR(Initialize ge failed、Run graph failed、Finalize ir graph session failed 等) - 文案语法修正:only support → only supports、is: %s and %s → are: %s and %s、expect %f → expected %f、multiples's → multiples' - tile 示例代码宏定义缩进格式化 ### 改动原因 配合 AscendC Reg API 演进,将 arch35 算子迁移至新的地址空间修饰符与 LoadAlign/StoreAlign/Not/And API;修正 transpose 相关命名中的拼写错误;统一日志级别与文案规范,提升日志可读性与问题定位效率。 ### 改动方法 - kernel 侧:逐文件替换 __local_mem__→__ubuf__、Reg::DataCopy(加载)→Reg::LoadAlign、Reg::DataCopy(存储)→Reg::StoreAlign、Reg::MaskNot→Reg::Not、Reg::MaskAnd→Reg::And,不改变控制流。 - host 侧:重命名 TilingForReleatedTranspose→TilingForRelatedTranspose、isReleatedTranspsoe_→isRelatedTranspose_,同步所有调用点。 - 日志:修改 printf/OP_LOGE/OP_LOGW/OP_LOGI 文案与级别字符串,不改变校验逻辑。 ## 关联的Issue - #2916 ## 测试 本 PR 为 API 迁移、命名修正与日志清理,通过已有测试用例(含 arch35 tiling UT 与 examples 二级冒烟)回归验证。 ## 文档更新 本 PR 未包含文档更新。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述:AscendC Reg API 迁移 + 命名拼写修正 + 日志规范化 See merge request: cann/ops-math!5135 | 2 months ago | |
refactor: 规范化多算子日志文案与错误提示信息 Co-authored-by: esok11<yangsifa@huawei.com> # message auto-generated for no-merge-commit merge: !4924 merge f0821 into master refactor: 规范化多算子日志文案与错误提示信息 Created-by: esok11 Commit-by: esok11 Merged-by: cann-robot Description: ## 描述 对多个算子的日志文案与错误提示信息进行规范化清理,涉及 depth_to_space、matrix_set_diag_v2、pad_v3、pad_v3_grad_replicate、pad_v3_grad_replication、transpose 共 6 个算子、11 个文件。 主要改动: - 修复语法错误: must greater than → must be greater than、must less than → must be less than - 修复拼写错误:dimention → dimension、strat → start - 序数词规范化:-2th → -2nd、-1th → -1st - 补充缺失动词/介词:cannot empty → cannot be empty、Failed to vector size → Failed to get vector size - 统一用语:on aicore situation → in AICore situation - 增强日志信息量:部分校验失败日志补充实际的 dim num / padding size 数值,便于定位问题 - 统一错误提示描述:wrong gradOutput shape. → gradOutput shape does not match the expected shape derived from input and padding. - 格式化:transpose_onnx_plugin.cpp 中 REGISTER_CUSTOM_OP 缩进对齐 ### 改动原因 原有日志文案存在语法错误、拼写错误和表述不清晰的问题,影响问题定位效率和用户体验。本次统一规范化,提升日志的可读性和准确性。 ### 改动方法 逐文件修改 OP_LOGE/OP_LOGW/OP_LOGI 等日志调用中的文案字符串,不改变任何控制流和校验逻辑。transpose_onnx_plugin.cpp 额外对 REGISTER_CUSTOM_OP 调用做了缩进格式化。 ## 关联的Issue - #2786 ## 测试 本 PR 仅修改日志文案字符串,不涉及逻辑变更,通过已有测试用例回归验证。 ## 文档更新 本 PR 未包含文档更新。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码规范化/日志文案清理 See merge request: cann/ops-math!4924 | 2 months ago | |
format: batch_to_space_nd 等算子代码格式化 Co-authored-by: zhanw_coding<zhanwang@huawei.com> # message auto-generated for no-merge-commit merge: !3822 merge fix-fmt into master format: batch_to_space_nd 等算子代码格式化 Created-by: zhanw_coding Commit-by: zhanw_coding Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> format: batch_to_space_nd 等算子代码格式化 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/2147 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码格式化 See merge request: cann/ops-math!3822 | 4 months ago | |
[ascend960dt/ascend960pr] conversion/math类9个算子新增ascend960dt/ascend960pr平台支持 Co-authored-by: yangjinwen<yangjinwen2@huawei.com> # message auto-generated for no-merge-commit merge: !5778 merge dev-v121 into master [ascend960dt/ascend960pr] conversion/math类9个算子新增ascend960dt/ascend960pr平台支持 Created-by: yangjinwen Commit-by: yangjinwen Merged-by: cann-robot Description: ## 描述 conversion 类 7 个算子(batch_to_space_nd、concat、concat_d、concat_v2、depth_to_space、pack、space_to_depth)与 math 类 2 个算子(erfc、rint)新增 ascend960dt / ascend960pr 平台支持,复用 arch35 tiling 框架,主要改动: - 平台注册:9 个算子 CMakeLists.txt 的 COMPUTE_UNIT/SUPPORT_COMPUTE_UNIT 新增 ascend960dt、ascend960pr(TILING_DIR 复用 arch35),op_host/*_def.cpp 新增对应 this->AICore().AddConfig(...) 注册; - 预编译 binary 接入:batch_to_space_nd、concat_d、depth_to_space、pack、space_to_depth、rint 新增 op_host/config/ascend960dt/、op_host/config/ascend960pr/ 下的 *_binary.json 与 *_simplified_key.ini;concat_v2 为 HOSTCPU 算子(依赖 concat),无独立 binary;erfc 的 kernel 源码(arch35/erfc.cpp)通过 add_kernel_sources 的 COMPUTE_UNITS 纳入新平台编译; - concat 的 arch35 tiling/kernel 适配 DAV_9201 架构(仅 9201 生效,不影响既有平台路径): - tiling 侧:DAV_9201 平台 ubFactorDim0 按两倍 BLOCK(64B)对齐修正;新增 dtypeSize 提升优化(末轴字节满足 128/64/32/16B 对齐时提升 dtypeSize,减少搬运次数),并注册 bitwidth=16 系列 tilingKey(12116/12126/21116/21216/30016 等); - kernel 侧:__NPU_ARCH__ == 9201 下 DataCopyPad 使用带 enAtomicSync 参数的接口分支。 ## 关联的Issue #3222 https://gitcode.com/cann/ops-math/issues/3222 ## 测试 平台注册与预编译 binary 接入部分不涉及既有 kernel 逻辑修改;concat 为 DAV_9201 架构适配新增专属分支,既有平台路径不变;可通过 PR 评论 compile 触发 CI 编译流水线验证。 ## 文档更新 无 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5778 | 27 days ago | |
format: batch_to_space_nd 等算子代码格式化 Co-authored-by: zhanw_coding<zhanwang@huawei.com> # message auto-generated for no-merge-commit merge: !3822 merge fix-fmt into master format: batch_to_space_nd 等算子代码格式化 Created-by: zhanw_coding Commit-by: zhanw_coding Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> format: batch_to_space_nd 等算子代码格式化 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/2147 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码格式化 See merge request: cann/ops-math!3822 | 4 months ago | |
fix: pad系列、depth_to_space UT问题 Co-authored-by: zhanw_coding<zhanwang@huawei.com> # message auto-generated for no-merge-commit merge: !6710 merge fix-ut into master fix: pad系列、depth_to_space UT问题 Created-by: zhanw_coding Commit-by: zhanw_coding Merged-by: cann-robot Description: ## 描述 修复 pad 系列(Pad / PadV2 / MirrorPad)与 CircularPadGrad、DepthToSpace 共 5 个算子 arch35 tiling UT 的过期期望,使其与上游 tiling 改动对齐,恢复 UT 通过。 改动原因: - commit 63be43b14(MR !5969「pad_v3/pad_v3_grad 去除tiling多余workspace申请」)将共享 tiling 的 workspace 由 16MB 改为 0,但复用同一 PadACTiling / PadV3GradACTiling 的 Pad、PadV2、MirrorPad、CircularPadGrad arch35 用例仍期望 16777216,未同步更新,导致 tiling_case_executor 断言 workspace 不符而失败。 - commit a3439d3c9(MR !6332「transpose 支持 ascend960dt/ascend960pr 平台及 4bit 类型」)在 TransposeOpTilingData 中新增 int64 字段 bigDimBufferNum,DepthToSpaceTilingData 内嵌复用该结构,depth_to_space 用例 expectTilingData 未同步,字段整体错位一位而失败。 改动方法: - 将上述非 slice 分支的 arch35 用例 expectWorkspaces 由 16777216 更新为 0;PadV2 的 slice 分支(tilingKey 10102/10150)在 tiling 中提前返回、不设置 workspace,仍保持 16777216。 - 将 depth_to_space 4 个用例的 expectTilingData 按新结构补齐 bigDimBufferNum 字段(SIMT 小 shape 路径默认值 1)。 ## 关联的Issue 本 PR 修复以下 36 个 UT 失败 issue: ### CircularPadGrad(conversion/circular_pad_grad) - https://gitcode.com/cann/ops-math/issues/4025 - https://gitcode.com/cann/ops-math/issues/4026 - https://gitcode.com/cann/ops-math/issues/4027 - https://gitcode.com/cann/ops-math/issues/4028 - https://gitcode.com/cann/ops-math/issues/4029 - https://gitcode.com/cann/ops-math/issues/4030 - https://gitcode.com/cann/ops-math/issues/4031 - https://gitcode.com/cann/ops-math/issues/4032 - https://gitcode.com/cann/ops-math/issues/4033 - https://gitcode.com/cann/ops-math/issues/4034 - https://gitcode.com/cann/ops-math/issues/4035 ### DepthToSpace(conversion/depth_to_space) - https://gitcode.com/cann/ops-math/issues/4036 - https://gitcode.com/cann/ops-math/issues/4037 - https://gitcode.com/cann/ops-math/issues/4038 - https://gitcode.com/cann/ops-math/issues/4039 ### MirrorPad(conversion/mirror_pad) - https://gitcode.com/cann/ops-math/issues/4041 ### Pad(conversion/pad) - https://gitcode.com/cann/ops-math/issues/4042 - https://gitcode.com/cann/ops-math/issues/4043 - https://gitcode.com/cann/ops-math/issues/4044 - https://gitcode.com/cann/ops-math/issues/4045 - https://gitcode.com/cann/ops-math/issues/4046 - https://gitcode.com/cann/ops-math/issues/4047 ### PadV2(conversion/pad_v2) - https://gitcode.com/cann/ops-math/issues/4048 - https://gitcode.com/cann/ops-math/issues/4049 - https://gitcode.com/cann/ops-math/issues/4050 - https://gitcode.com/cann/ops-math/issues/4051 - https://gitcode.com/cann/ops-math/issues/4052 - https://gitcode.com/cann/ops-math/issues/4053 - https://gitcode.com/cann/ops-math/issues/4054 - https://gitcode.com/cann/ops-math/issues/4055 - https://gitcode.com/cann/ops-math/issues/4056 - https://gitcode.com/cann/ops-math/issues/4057 - https://gitcode.com/cann/ops-math/issues/4058 - https://gitcode.com/cann/ops-math/issues/4059 - https://gitcode.com/cann/ops-math/issues/4060 - https://gitcode.com/cann/ops-math/issues/4061 ## 测试 对每个算子执行 bash build.sh -u --ophost --soc=ascend950 --ops=<算子名>,全部通过: | 算子 | 结果 | |------|------| | circular_pad_grad | 15/15 PASSED | | depth_to_space | 11/11 PASSED | | mirror_pad | 10/10 PASSED | | pad | 16/16 PASSED | | pad_v2 | 43/43 PASSED | ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6710 | 16 days ago | |
[ascend960dt/ascend960pr] conversion/math类9个算子新增ascend960dt/ascend960pr平台支持 Co-authored-by: yangjinwen<yangjinwen2@huawei.com> # message auto-generated for no-merge-commit merge: !5778 merge dev-v121 into master [ascend960dt/ascend960pr] conversion/math类9个算子新增ascend960dt/ascend960pr平台支持 Created-by: yangjinwen Commit-by: yangjinwen Merged-by: cann-robot Description: ## 描述 conversion 类 7 个算子(batch_to_space_nd、concat、concat_d、concat_v2、depth_to_space、pack、space_to_depth)与 math 类 2 个算子(erfc、rint)新增 ascend960dt / ascend960pr 平台支持,复用 arch35 tiling 框架,主要改动: - 平台注册:9 个算子 CMakeLists.txt 的 COMPUTE_UNIT/SUPPORT_COMPUTE_UNIT 新增 ascend960dt、ascend960pr(TILING_DIR 复用 arch35),op_host/*_def.cpp 新增对应 this->AICore().AddConfig(...) 注册; - 预编译 binary 接入:batch_to_space_nd、concat_d、depth_to_space、pack、space_to_depth、rint 新增 op_host/config/ascend960dt/、op_host/config/ascend960pr/ 下的 *_binary.json 与 *_simplified_key.ini;concat_v2 为 HOSTCPU 算子(依赖 concat),无独立 binary;erfc 的 kernel 源码(arch35/erfc.cpp)通过 add_kernel_sources 的 COMPUTE_UNITS 纳入新平台编译; - concat 的 arch35 tiling/kernel 适配 DAV_9201 架构(仅 9201 生效,不影响既有平台路径): - tiling 侧:DAV_9201 平台 ubFactorDim0 按两倍 BLOCK(64B)对齐修正;新增 dtypeSize 提升优化(末轴字节满足 128/64/32/16B 对齐时提升 dtypeSize,减少搬运次数),并注册 bitwidth=16 系列 tilingKey(12116/12126/21116/21216/30016 等); - kernel 侧:__NPU_ARCH__ == 9201 下 DataCopyPad 使用带 enAtomicSync 参数的接口分支。 ## 关联的Issue #3222 https://gitcode.com/cann/ops-math/issues/3222 ## 测试 平台注册与预编译 binary 接入部分不涉及既有 kernel 逻辑修改;concat 为 DAV_9201 架构适配新增专属分支,既有平台路径不变;可通过 PR 评论 compile 触发 CI 编译流水线验证。 ## 文档更新 无 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5778 | 27 days 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 |
DepthToSpace
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR&950DT系列产品 | √ |
| Atlas A3系列产品 | √ |
| Atlas A2系列产品 | √ |
| Atlas 200I/500 A2推理产品 | × |
| Atlas推理系列产品 | √ |
| Atlas训练系列产品 | √ |
功能说明
-
算子功能:将深度(通道)维度的数据移动到空间维度(高度和宽度)。该算子通过对输入张量的深度(通道)维度进行重新排列,将其转换为空间维度(高度和宽度)。具体来说,它将输入张量的深度维度按照指定的块大小(block_size)进行划分,并将这些深度块重新排列到空间维度中,从而增加空间维度的大小,同时减少通道维度的深度。
-
计算公式: 设输入张量形状为:
- 当data_format="NHWC"时:
[batch, height, width, channels] - 当data_format="NCHW"时:
[batch, channels, height, width]
设block_size为B,输出张量形状为:
- 当data_format="NHWC"时:
[batch, height*B, width*B, channels/(B*B)] - 当data_format="NCHW"时:
[batch, channels/(B*B), height*B, width*B]
其中,B*B必须能够整除通道维度。
- 当data_format="NHWC"时:
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 表示输入张量,支持多种数据类型。数据格式必须与data_format属性指定的格式一致 | FLOAT、FLOAT16、INT8、INT16、INT32、UINT8、UINT16、UINT32、INT64、UINT64、BFLOAT16 | NHWC、NCHW |
| y | 输出 | 表示输出张量,与输入x具有相同的数据类型。输出形状根据block_size、mode和data_format进行计算 | 与x一致 | NHWC、NCHW |
| block_size | 属性(必需) | 表示空间块的尺寸大小,必须是大于等于2的整数。通道维度必须能被block_size的平方整除 | INT | - |
| mode | 属性(必需) | 表示数据重排的模式,支持"DCR"和"CRD"两种模式 | STRING | - |
| data_format | 属性(可选) | 表示数据格式,指定输入和输出的维度排列顺序。支持"NHWC"和"NCHW"两种格式,默认为"NHWC" | STRING | - |
约束说明
- 输入和输出张量的维度必须是4D
- 输入和输出的数据格式必须相同,且仅支持NCHW和NHWC格式
- block_size必须是大于等于2的整数
- 通道维度必须能被block_size的平方整除
- mode属性必须是"DCR"或"CRD"
- data_format属性必须与输入张量的实际格式一致
调用说明
| 调用方式 | 样例代码 | 说明 |
|---|---|---|
| 图模式 | test_geir_depth_to_space | 通过算子IR构图方式调用DepthToSpace算子。 |