| Files | Last commit | Last update |
|---|---|---|
fix(adjacent_difference): 移除示例多余的内置头文件include,修复AdjacentDifference类重定义导致example编译失败 Co-authored-by: caorenlei<caorenlei@huawei.com> # message auto-generated for no-merge-commit merge: !6964 merge adj into master fix(adjacent_difference): 移除示例多余的内置头文件include,修复AdjacentDifference类重定义导致example编译失败 Created-by: caorenlei Commit-by: caorenlei Merged-by: cann-robot Description: ## 描述 **改动原因**:adjacent_difference 算子 graph 模式 example( math/adjacent_difference/examples/test_geir_adjacent_difference.cpp)在 CANN 9.3.0 环境下编译失败。AdjacentDifference 算子 proto 已上库到 CANN 内置头文件 experiment_ops.h(REG_OP(AdjacentDifference)),而 example 同时 include 了内置 experiment_ops.h 与仓库自有 op_graph/adjacent_difference_proto.h,两处 REG_OP 宏均展开为同名类 ge::op::AdjacentDifference,产生类重定义编译错误: error: redefinition of 'class ge::op::AdjacentDifference' adjacent_difference_proto.h:39 REG_OP(AdjacentDifference) experiment_ops.h:5550 REG_OP(AdjacentDifference) (previous definition) **改动方法**: - 删除 example 中多余的 #include "experiment_ops.h" 与 #include "nn_other.h"(example 实际仅依赖 array_ops.h 提供 op::Data、仓库 proto 提供 op::AdjacentDifference,被删头文件无任何实际符号依赖) - 附带 clang-format 对该文件的格式化(宏续行对齐、CreateOppInGraph 函数签名换行),无功能变更 ## 关联的Issue - #4384 ## 测试 - 环境:CANN 9.3.0,soc=ascend950 - 命令:bash build.sh --run_example adjacent_difference graph --example_name=adjacent_difference --soc=ascend950 - 结果:编译通过,example 执行成功(run test_geir_adjacent_difference, execute samples success) - 精度验证:输入 [1.0, 1.0, 2.0, 3.0, 3.0, 4.0, 6.0, 6.0, 6.0, 8.0],输出 [0, 0, 1, 1, 0, 1, 1, 0, 0, 1],与算子语义(y[0]=0, y[i]=x[i]==x[i-1]?0:1)期望逐元素一致 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6964 | 17 days ago | |
add range mod adj pow one_hot Co-authored-by: Nicooo-Wang<wangtianle3@huawei.com> # message auto-generated for no-merge-commit merge: !541 merge move-ops into master add range mod adj pow one_hot Created-by: Nicooo-Wang Commit-by: Nicooo-Wang;王天乐 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!541 | 10 months ago | |
range等算子资料更新 Co-authored-by: suxiaolan2000<jiangyulong10@huawei.com> # message auto-generated for no-merge-commit merge: !697 merge math同步 into master range等算子资料更新 Created-by: suxiaolan2000 Commit-by: suxiaolan2000 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!697 | 10 months ago | |
fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Co-authored-by: wangrunfa<wangrunfa1@huawei.com> Co-authored-by: wkx12138<weikaixuan@h-partners.com> # message auto-generated for no-merge-commit merge: !7302 merge adj into master fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Created-by: wkx12138 Commit-by: wangrunfa;wkx12138 Merged-by: cann-robot Description: ## 描述 修复 adjacent_difference 算子两个 UB 越界问题: 1. **Tiling UB 预算与 Kernel 实际申请不符**:tiling 以 ubSize/(sizeof(in)+sizeof(out)) 约束 tilingNum,未计入 kernel 侧 onesBuf_(sizeof(OUT_TYPE))与 int64 输出 yQueue_ 的 2*BLOCKSIZE 对齐余量,大 shape 触顶时三段 InitBuffer 总量超出 UB(int64 出全 dtype 组合超 8~72B,int32 入/int32 出超 4B)。修复:上限公式改为 (ubSize - 预留) / (sizeof(in)+sizeof(out)),预留 = 2*BLOCKSIZE(x1Queue_ 加载余量 + onesBuf_),int64 出再 +2*BLOCKSIZE(yQueue_ 对齐余量)。 2. **x1Queue_ 整寄存器加载越界**:x1Queue_ 仅按 tilingNum_ 个元素分配,四个计算分支以整寄存器宽度 LoadAlign/LoadUnAlign(+1 偏移)加载,满块 tile 时最大物理读索引 nLoop*vLength_ 可超过 tilingNum_(最多 224B);且 mask 以总长 UpdateMask(copyLen>vLength_ 时饱和为全 mask),尾轮越界读入的垃圾以整寄存器宽度写回 yQueue_,连带越界写。修复: - tiling 取整粒度从 32B(blockNum)提升为整寄存器 256B(vRegNum)倍数,满块 tile 物理读越界收敛为恰好 +1 元素; - x1Queue_ 增加 +BLOCKSIZE 余量覆盖该 +1 元素(LoadUnAlign 的 +1 偏移); - 四个计算分支 mask 改为按每轮剩余元素数更新,store 严格收敛于 copyLen 内。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/4717 ## 测试 - ophost UT 13/13 通过:新增 int64 出(16352)/int32 出(32704)两个 UB 触顶用例(旧代码下分别产出超限的 16384/32768);原 tiling 与 8 个 infershape 用例期望值不受影响 - bash build.sh --opkernel --soc=ascend950 --ops=adjacent_difference 编译通过(22 个 dtype 变体全部生成) - 核算 8 种 dtype 组合触顶 tilingNum 的核内实际 UB 分配,全部 ≤ ubSize;4 个 SoC(950/350/960dt/960pr)同为 dav_3510,host/device GetVRegSize 恒 256B,对齐不变量全域成立 - 本地已跑st,精度pass - 冒烟已跑 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7302 | 6 days ago | |
fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Co-authored-by: wangrunfa<wangrunfa1@huawei.com> Co-authored-by: wkx12138<weikaixuan@h-partners.com> # message auto-generated for no-merge-commit merge: !7302 merge adj into master fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Created-by: wkx12138 Commit-by: wangrunfa;wkx12138 Merged-by: cann-robot Description: ## 描述 修复 adjacent_difference 算子两个 UB 越界问题: 1. **Tiling UB 预算与 Kernel 实际申请不符**:tiling 以 ubSize/(sizeof(in)+sizeof(out)) 约束 tilingNum,未计入 kernel 侧 onesBuf_(sizeof(OUT_TYPE))与 int64 输出 yQueue_ 的 2*BLOCKSIZE 对齐余量,大 shape 触顶时三段 InitBuffer 总量超出 UB(int64 出全 dtype 组合超 8~72B,int32 入/int32 出超 4B)。修复:上限公式改为 (ubSize - 预留) / (sizeof(in)+sizeof(out)),预留 = 2*BLOCKSIZE(x1Queue_ 加载余量 + onesBuf_),int64 出再 +2*BLOCKSIZE(yQueue_ 对齐余量)。 2. **x1Queue_ 整寄存器加载越界**:x1Queue_ 仅按 tilingNum_ 个元素分配,四个计算分支以整寄存器宽度 LoadAlign/LoadUnAlign(+1 偏移)加载,满块 tile 时最大物理读索引 nLoop*vLength_ 可超过 tilingNum_(最多 224B);且 mask 以总长 UpdateMask(copyLen>vLength_ 时饱和为全 mask),尾轮越界读入的垃圾以整寄存器宽度写回 yQueue_,连带越界写。修复: - tiling 取整粒度从 32B(blockNum)提升为整寄存器 256B(vRegNum)倍数,满块 tile 物理读越界收敛为恰好 +1 元素; - x1Queue_ 增加 +BLOCKSIZE 余量覆盖该 +1 元素(LoadUnAlign 的 +1 偏移); - 四个计算分支 mask 改为按每轮剩余元素数更新,store 严格收敛于 copyLen 内。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/4717 ## 测试 - ophost UT 13/13 通过:新增 int64 出(16352)/int32 出(32704)两个 UB 触顶用例(旧代码下分别产出超限的 16384/32768);原 tiling 与 8 个 infershape 用例期望值不受影响 - bash build.sh --opkernel --soc=ascend950 --ops=adjacent_difference 编译通过(22 个 dtype 变体全部生成) - 核算 8 种 dtype 组合触顶 tilingNum 的核内实际 UB 分配,全部 ≤ ubSize;4 个 SoC(950/350/960dt/960pr)同为 dav_3510,host/device GetVRegSize 恒 256B,对齐不变量全域成立 - 本地已跑st,精度pass - 冒烟已跑 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7302 | 6 days ago | |
fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Co-authored-by: wangrunfa<wangrunfa1@huawei.com> Co-authored-by: wkx12138<weikaixuan@h-partners.com> # message auto-generated for no-merge-commit merge: !7302 merge adj into master fix(adjacent_difference): tiling 计入核内固定 UB 开销并修复整寄存器加载越界 Created-by: wkx12138 Commit-by: wangrunfa;wkx12138 Merged-by: cann-robot Description: ## 描述 修复 adjacent_difference 算子两个 UB 越界问题: 1. **Tiling UB 预算与 Kernel 实际申请不符**:tiling 以 ubSize/(sizeof(in)+sizeof(out)) 约束 tilingNum,未计入 kernel 侧 onesBuf_(sizeof(OUT_TYPE))与 int64 输出 yQueue_ 的 2*BLOCKSIZE 对齐余量,大 shape 触顶时三段 InitBuffer 总量超出 UB(int64 出全 dtype 组合超 8~72B,int32 入/int32 出超 4B)。修复:上限公式改为 (ubSize - 预留) / (sizeof(in)+sizeof(out)),预留 = 2*BLOCKSIZE(x1Queue_ 加载余量 + onesBuf_),int64 出再 +2*BLOCKSIZE(yQueue_ 对齐余量)。 2. **x1Queue_ 整寄存器加载越界**:x1Queue_ 仅按 tilingNum_ 个元素分配,四个计算分支以整寄存器宽度 LoadAlign/LoadUnAlign(+1 偏移)加载,满块 tile 时最大物理读索引 nLoop*vLength_ 可超过 tilingNum_(最多 224B);且 mask 以总长 UpdateMask(copyLen>vLength_ 时饱和为全 mask),尾轮越界读入的垃圾以整寄存器宽度写回 yQueue_,连带越界写。修复: - tiling 取整粒度从 32B(blockNum)提升为整寄存器 256B(vRegNum)倍数,满块 tile 物理读越界收敛为恰好 +1 元素; - x1Queue_ 增加 +BLOCKSIZE 余量覆盖该 +1 元素(LoadUnAlign 的 +1 偏移); - 四个计算分支 mask 改为按每轮剩余元素数更新,store 严格收敛于 copyLen 内。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/4717 ## 测试 - ophost UT 13/13 通过:新增 int64 出(16352)/int32 出(32704)两个 UB 触顶用例(旧代码下分别产出超限的 16384/32768);原 tiling 与 8 个 infershape 用例期望值不受影响 - bash build.sh --opkernel --soc=ascend950 --ops=adjacent_difference 编译通过(22 个 dtype 变体全部生成) - 核算 8 种 dtype 组合触顶 tilingNum 的核内实际 UB 分配,全部 ≤ ubSize;4 个 SoC(950/350/960dt/960pr)同为 dav_3510,host/device GetVRegSize 恒 256B,对齐不变量全域成立 - 本地已跑st,精度pass - 冒烟已跑 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7302 | 6 days ago | |
feat: bincount/adjacent_difference 新增 ascend960dt/ascend960pr 注册级支持 Co-authored-by: caorenlei<caorenlei@huawei.com> # message auto-generated for no-merge-commit merge: !6388 merge 1010 into master feat: bincount/adjacent_difference 新增 ascend960dt/ascend960pr 注册级支持 Created-by: caorenlei Commit-by: caorenlei Merged-by: cann-robot Description: ## 描述 bincount、adjacent_difference 两算子新增 ascend960dt/ascend960pr 平台注册级支持(v121 适配)。 ### 改动原因 Ascend960 系列平台上线,算子需同步支持 ascend960dt/ascend960pr 计算单元;适配增量同步自内部仓 cann_out 分支,在 OSS master 基线上叠加。 ### 改动方法(注册级适配,kernel/tiling/aclnn 零改动) 1. **def.cpp 注册**(2 文件):bincount_def.cpp、adjacent_difference_def.cpp 在既有 AddConfig("ascend950"/"ascend350") 后追加 AddConfig("ascend960dt", aicoreConfig) 与 AddConfig("ascend960pr", aicoreConfig),复用同一 aicoreConfig,保留 ascend350 注册不删 2. **config 配置**(8 个新增文件):新增 op_host/config/ascend960dt/、op_host/config/ascend960pr/(2 算子 × 2 芯片 × binary.json + simplified_key.ini),内容与既有 ascend950 配置逐字节一致 3. **CMakeLists**(2 文件):SUPPORT_COMPUTE_UNIT 追加 "ascend960dt" "ascend960pr",SUPPORT_TILING_DIR 等量追加 "arch35"(tiling 复用 arch35) 4. **ascendc_config.json**:Bincount、AdjacentDifference 条目 compute_units 追加 "ascend960dt",compile_options 镜像 ascend950(-mllvm -cce-aicore-dcci-before-kernel-end=false) 5. **.pre-commit-config.yaml**:codespell 忽略列表追加 build-in(config 镜像中 ascend950 既有注释拼写,内容须与 950 逐字节一致不可修改) ## 关联的Issue - #3598 ## 测试 1. **ascend950 编译出包**:bash build.sh --pkg --soc=ascend950 --ops=bincount,adjacent_difference -j8 通过;包内 950 内核齐全(23 个 .o),aic-ascend960dt-ops-info.json 含 Bincount、AdjacentDifference 注册(960 注册生效核验) 2. **950 kernel 零影响硬证据**:适配前后两次编译,23 个 ascend950 kernel .o SHA256 逐字节一致(bit 级不变) 3. **ttk 精度回归 386/386 全 PASS**(Ascend950PR_9579,release 模式,seed=123): - bincount(kernel 级)192/192、adjacent_difference(kernel 级)81/81、aclnnBincount(API 级)113/113 - 正控 PASS / 负控 FAIL,判定链路自证有效 ## 文档更新 无 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6388 | 1 month 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 | |
docs: add English translations for markdown files Co-authored-by: jenny_xiang<jenny.xiang@huawei.com> # message auto-generated for no-merge-commit merge: !7113 merge docs/add-english-translations into master docs: add English translations for markdown files Created-by: jenny_xiang Commit-by: jenny_xiang Merged-by: cann-robot Description: ## 描述 新增仓库Markdown文档英文译稿(第二批,共409个文件):第一批(已合入)之外的其余全部译稿,覆盖conversion、examples、ge、math、random各类算子README译稿,以及CHANGELOG_en.md、.gitcode PR模板英文版等。 本批内全部仓内链接均指向master已有文件(含第一批已合入的21+2篇译稿),合入后本仓432篇英文文档全部就位,链接完整生效。 本批同时包含4篇基于最新源文档的增量更新(math/ada_cast、math/prod_force_se_a、math/sinkhorn、math/xlogy,对应上游近期文档变更)。 ## 关联的Issue 无 ## 测试 文档类变更,无需算子测试;已通过链接有效性校验(本批全部相对链接仅指向master已有文件,无指向本PR外未提交文件的链接),并完成逐篇翻译规范自查与语义校对(含支持状态表、限定词、术语、数值符号核对)。 ## 文档更新 新增409个英文译稿文件(*_en.md / .en-US.md),不修改任何现有文件。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7113 | 14 days ago |
AdjacentDifference
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | × |
| Atlas A2 products | × |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function Description
-
Operator function: compares the differences between adjacent elements of the input tensor. If two adjacent elements are the same, 0 is returned; otherwise, 1 is returned.
-
Computation formula:
outi=(xi==xj? 0:1).to(ydtype) j=i−1out_i = {(x_i == x_j ?\ 0 : 1)}.to(y_dtype) \ j = i - 1 outi=(xi==xj? 0:1).to(ydtype) j=i−1
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input parameter for the AdjacentDifference computation, which is x in the formula. | FLOAT, FLOAT16, BFLOAT16, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64 | ND |
| y_dtype | Input | An attribute that specifies the output type, which is y_dtype in the formula. | INT32 | ND |
| y | Output | Output parameter for the AdjacentDifference computation, which is out in the formula. | INT32, INT64 | ND |
- Atlas training products and Atlas inference products: BFLOAT16 is not supported.
Constraint Description
- None.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| Graph mode | test_geir_adjacent_difference | Invokes the AdjacentDifference operator by building a graph through the operator IR. |