本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。
| Files | Last commit | Last update |
|---|---|---|
添加 sub_pipline_support.yaml 工作流配置 Co-authored-by: huang-chuhong<huangchuhong1@h-partners.com> # message auto-generated for no-merge-commit merge: !5072 merge master into master 添加 sub_pipline_support.yaml 工作流配置 Created-by: huang-chuhong Commit-by: huang-chuhong Merged-by: cann-robot Description: ## 描述 添加 sub_pipline_support.yaml 工作流配置 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2314 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5072 | 5 months ago | |
通过gitmodules引入third_party/catlass Co-authored-by: longjihui<longjihui@huawei.com> # message auto-generated for no-merge-commit merge: !1765 merge master into master 通过gitmodules引入third_party/catlass Created-by: longjihui Commit-by: longjihui Merged-by: cann-robot Description: ## 描述 新增.gitmodules文件,引入第三方库catlass,分支为v1.3.1-notla ## 关联的Issue 不涉及 ## 测试 仅引入三方仓,使用方式暂不确定,无需测试 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:新引入三方仓catlass See merge request: cann/ops-transformer!1765 | 6 months ago | |
amend | 5 months ago | |
modify hcclcontext Co-authored-by: yifux<xiongyifu1@huawei.com> # message auto-generated for no-merge-commit merge: !5465 merge pr_context into master modify hcclcontext Created-by: xiongyifu Commit-by: yifux Merged-by: cann-robot Description: ## 描述 切换修改新的hccl context开源方案 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2844 ## 测试  ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: # PR #5465 代码检视报告 ## 检视概览 - **PR**: [quant_reduce_scatter 新增 Mc2Context 双路径通信 + quant_reduce_scatter_v2 算子工程](https://gitcode.com/cann/ops-transformer/pull/5465) - **变更范围**: 42 个文件,涵盖 op_host/op_kernel/op_api/op_graph/UT/Build 全侧代码 - **算子名**: quant_reduce_scatter / quant_reduce_scatter_v2 - **检视侧别**: Kernel + Tiling + op_api + Build - **检视文档**: cpp-secure.md, ascendc-topk.md, ascendc-api.md, ascendc-perf.md, mc2-specific.md, cpp-general.md, compile-secure.md - **总条例数**: 31 条(聚焦高优先级 SEC/TOPK/API/MC2 条例) - **检视时间**: 2026-06-02 ## 检视统计 | 状态 | 条例数 | 占比 | |------|------|------| | PASS | 30 | 96.8% | | FAIL(发现问题)| 1 | 3.2% | --- ## 发现问题(HIGH 置信度) <span style="color:red">aclnnQuantReduceScatterV2GetWorkspaceSize只是为了保持代码和目录完整性添加的接口,不需做额外校验。这一条检视意见可以忽略。</span> ### [SEC-4.1] 外部输入合法性校验缺失 - **问题描述**: aclnnQuantReduceScatterV2GetWorkspaceSize 作为 V2 算子的外部 API 入口函数,接收 9 个外部输入参数(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor),但**未做任何参数校验**(nullptr 检查、dtype 检查、参数范围检查等),直接透传给内部函数。与 V1 路径通过 CheckParams 进行完整的 CheckNotNull/CheckAllDtypesValid/CheckGroupLength 校验形成对比。 - **代码片段**(mc2/quant_reduce_scatter_v2/op_api/aclnn_quant_reduce_scatter_v2.cpp 行 31-42): cpp extern "C" aclnnStatus aclnnQuantReduceScatterV2GetWorkspaceSize(const aclTensor *context, const aclTensor* x, const aclTensor* scales, int64_t hcclBufferSize, char* reduceOp, int64_t yDtype, int64_t worldSize, const aclTensor* output, uint64_t* workspaceSize, aclOpExecutor** executor) { OP_LOGD("aclnnQuantReduceScatterV2GetWorkspaceSize start"); return aclnnInnerQuantReduceScatterV2GetWorkspaceSize(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor); } - **V1 对比**(mc2/quant_reduce_scatter/op_api/aclnn_quant_reduce_scatter_base.cpp 行 144-151): cpp static aclnnStatus CheckParams(const aclTensor* x, const aclTensor* scales, const char* group, const aclTensor* output) { CHECK_RET(CheckNotNull(x, scales, output), ACLNN_ERR_PARAM_NULLPTR); CHECK_RET(CheckAllDtypesValid(x, scales, output), ACLNN_ERR_PARAM_INVALID); CHECK_RET(CheckGroupLength(group), ACLNN_ERR_PARAM_INVALID); return ACLNN_SUCCESS; } - **假设检验证据**: 正向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | 规范违反 | +40% | 外部 API 入口应校验外部输入,V2 未做任何校验 | | 上下文防御缺失 | +30% | 函数体内无防御代码,直接透传 | | PR 归属 | +20% | 问题代码为本次 PR 新增文件 | | 领域关联 | +10% | 外部 API 入口点是安全校验第一道防线 | 负向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | Tiling 层校验 | -15% | V2 tiling 路径有 CheckMc2Context + CheckTilingFunc 校验 | | 内部层校验 | -15% | 内部函数可能存在校验 | 自信值 = 40 + 30 + 20 + 10 - 15 - 15 = **70%** ≥ 70% → 判定违规 - **修复建议**: 参照 V1 的 aclnnQuantReduceScatterBaseGetWorkspaceSize 模式,在 V2 外部 API 中增加参数校验: 1. OP_CHECK_NULL(context/x/scales/output/workspaceSize/executor) 非空校验 2. x/scales/output 的 dtype 组合校验(与 V1 CheckAllDtypesValid 一致) 3. hcclBufferSize > 0 和 worldSize > 0 的范围校验 --- ## 通过条例 [quant_reduce_scatter_kernel_G1] SEC-2.1 PASS — 无有符号整数算术运算 [quant_reduce_scatter_kernel_G1] SEC-2.2 PASS — 所有 uint32 表达式值域安全(max < UINT32_MAX) [quant_reduce_scatter_kernel_G1] SEC-3.1 PASS — 所有新增成员变量均有类内初始化 [quant_reduce_scatter_kernel_G1] SEC-3.3 PASS — 数组索引均在循环边界内或上游已校验 [quant_reduce_scatter_kernel_G1] SEC-4.1 PASS — mc2Context 路径有上游 Host 侧完整校验链 [quant_reduce_scatter_kernel_G1] SEC-4.2 PASS — PR 未修改 DataCopy 搬运长度 [quant_reduce_scatter_kernel_G1] TOPK-8 PASS — GM 偏移变量均为 uint64_t,中间变量值域安全 [quant_reduce_scatter_kernel_G1] TOPK-9 PASS — 无 atomic 累加操作 [quant_reduce_scatter_kernel_G1] TOPK-11 PASS — 软同步完整(PipeBarrier→WriteStatus→ReadStatus忙等) [quant_reduce_scatter_kernel_G1] API-3 PASS — DataCopy 对齐属性未因 PR 变更改变 [quant_reduce_scatter_kernel_G1] API-6 PASS — AllocTensor/FreeTensor 配对未变更 [quant_reduce_scatter_kernel_G1] MC2-01 PASS — 核间同步机制完整 [quant_reduce_scatter_kernel_G1] MC2-11 PASS — 未修改量化精度逻辑 [quant_reduce_scatter_kernel_G1] MC2-16 PASS — kernel_operator.h 已被 ASC_DEVKIT_MAJOR 宏包裹 [quant_reduce_scatter_host_G1] SEC-2.1 PASS — 所有关键运算为 uint64_t 无符号 [quant_reduce_scatter_host_G1] SEC-2.3 PASS — 除数均有 constexpr/白名单校验保护 [quant_reduce_scatter_host_G1] SEC-4.1 PASS — 外部输入校验链完整(CheckTilingFunc 7 步校验) [quant_reduce_scatter_host_G1] TOPK-1 PASS — 所有函数返回值均有 OP_TILING_CHECK 校验 [quant_reduce_scatter_host_G1] TOPK-7 PASS — Shape/Dtype/Format/属性/指针校验全覆盖 [quant_reduce_scatter_host_G1] MC2-09 PASS — 量化参数类型一致,日志格式化字符串匹配 [quant_reduce_scatter_host_G1] MC2-10 PASS — TG/MX 量化模式校验覆盖所有合法组合 [quant_reduce_scatter_host_G1] MC2-14 PASS — Tiling struct 对齐、并发安全、除零保护到位 [quant_reduce_scatter_host_G1] MC2-15 PASS — group 通过 std::string 深拷贝 [quant_reduce_scatter_v2_kernel_G1] SEC-3.1 PASS — 框架宏/构造函数/Init 保证初始化 [quant_reduce_scatter_v2_kernel_G1] SEC-4.1 PASS — 外部输入命中 Kernel 侧排除规则 [quant_reduce_scatter_v2_kernel_G1] TOPK-8 PASS — GM 偏移使用 uint64_t,数值范围安全 [quant_reduce_scatter_v2_kernel_G1] TOPK-11 PASS — MTE 通信同步链完整 [quant_reduce_scatter_v2_kernel_G1] MC2-01 PASS — 软件同步机制完整 [quant_reduce_scatter_v2_kernel_G1] MC2-16 PASS — ASC_DEVKIT_MAJOR 宏正确包裹 [quant_reduce_scatter_v2_host_G1] SEC-2.1/4.1/TOPK-7/MC2-09/14/15 PASS — 校验链与 V1 共享且完整 [shared] SEC-3.5 PASS — 所有指针使用前有判空或上游保证 [shared] SEC-5.1 PASS — HCCL API 返回值全部检查 [shared] MC2-17 PASS — HCCL API 使用模式与已有 MoE 路径一致 [shared] MC2-18 PASS — V2 上下文生命周期通过 Host 侧预构建,设计合理 See merge request: cann/ops-transformer!5465 | 5 months ago | |
订正动态图fallback符号索引逻辑 Co-authored-by: gitcode_lijd<lijiandong20@huawei.com> # message auto-generated for no-merge-commit merge: !6136 merge fix into master 订正动态图fallback符号索引逻辑 Created-by: gitcode_lijd Commit-by: gitcode_lijd Merged-by: cann-robot Description: ## 描述 目前transformer仓GE动态图回调时寻找符号路径为cust->opapi->各种aclnn,缺少libopapi_transformer.so common/include/fallback/fallback.h中完善寻找路径 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2760 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6136 | 5 months ago | |
docs: MatmulAlltoAllV2文档 Co-authored-by: tongzy1242<tongzeyun@huawei.com> # message auto-generated for no-merge-commit merge: !5787 merge mma2a_docs into master docs: MatmulAlltoAllV2文档 Created-by: tongzy1242 Commit-by: tongzy1242 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 补充aclnnmatmulalltoallV2文档 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#2481](https://gitcode.com/cann/ops-transformer/issues/2481) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 不涉及 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 补充aclnnMatmulAlltoAllV2和aclnnQuantMatmulAlltoAllV2文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [x] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5787 | 5 months ago | |
解除对ascend环境下面的op_common的依赖 Co-authored-by: hblnb<huangbolin3@huawei.com> # message auto-generated for no-merge-commit merge: !2216 merge test_ut_task into master 解除对ascend环境下面的op_common的依赖 Created-by: hblnb Commit-by: hblnb Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-transformer!2216 | 5 months ago | |
add fused operator BiasSigmoid Co-authored-by: slj02<songlijie1@huawei.com> # message auto-generated for no-merge-commit merge: !6224 merge feat/biasSigmoid into master add fused operator BiasSigmoid Created-by: slj02 Commit-by: slj02 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 新增将MOE路由分数sigmoid激活并叠加Bias偏置的算子BiasSigmoid 该算子对输入张量 $expertX$ 执行以下操作: 1. **Sigmoid 激活计算**: $$\text{sigmoidOut} = \sigma(expertX)$$ 2. **叠加 Bias 计算**: $$\text{biasOut} = \text{sigmoidOut} + \text{bias}$$ 其中: - $expertX$ 是输入张量 - $\sigma$ 表示 Sigmoid 激活函数 - $\text{bias}$ 是偏置项 - 输出包含两个张量:纯粹的 Sigmoid 结果和叠加 Bias 后的结果 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> 关联Issue [#2825](https://gitcode.com/cann/ops-transformer/issues/2825) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 测试脚本中测试了NPU和CPU的计算结果对比 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> PR中包含一个README.md新增 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6224 | 5 months ago | |
fix: aclrtMemcpy host to host for schedule_context, 修正示例代码内存拷贝类型错误 Co-authored-by: Developer user<jialimin1@huawei.com> # message auto-generated for no-merge-commit merge: !5918 merge master into master fix: aclrtMemcpy host to host for schedule_context, 修正示例代码内存拷贝类型错误 Created-by: jialimin1 Commit-by: Developer user Merged-by: cann-robot Description: ## 描述 1、修改aclrtMemcpy host to host for schedule_context, 修正示例代码内存拷贝类型错误 2、修改日志打印内容 ## 关联的Issue Issue #2640 Issue #2641 <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 编译包验证: [2026-05-26 03:18:07] ./uninstall.sh [2026-05-26 03:18:07] ./upgrade.sh [2026-05-26 03:18:07] CRC: 1888598674 [2026-05-26 03:18:07] SHA256: e5e52d301ebc0a74b5f34866bf194936a5fc441b6658e781ba1bc761fd8fbde1 [2026-05-26 03:18:07] Skipping md5sum at user request [2026-05-26 03:18:07] [2026-05-26 03:18:07] Self-extractable archive "cann-ops-transformer-custom_linux-x86_64.run" successfully created. 样例验证: [2026-05-26 03:21:42] Start compile and run example file: ../ffn/ffn_worker_scheduler/examples/test_aclnn_inplace_ffn_worker_scheduler.cpp [2026-05-26 03:21:49] Init ffn success, token_info_buf_size=192,token_data_buf_size= 1024. [2026-05-26 03:21:49] layer_ids_buf_size = 8. [2026-05-26 03:21:49] session_ids_buf_size = 8. [2026-05-26 03:21:49] micro_batch_ids_buf_size = 8. [2026-05-26 03:21:49] expert_ids_buf_size = 80. [2026-05-26 03:21:49] layer_ids[0] is: 55 [2026-05-26 03:21:49] layer_ids[1] is: 55 [2026-05-26 03:21:49] session_ids[0] is: 0 [2026-05-26 03:21:49] session_ids[1] is: 1 [2026-05-26 03:21:49] micro_batch_ids[0] is: 0 [2026-05-26 03:21:49] micro_batch_ids[1] is: 0 [2026-05-26 03:21:49] expert_ids[0] is: 0 [2026-05-26 03:21:49] expert_ids[1] is: 1 [2026-05-26 03:21:49] expert_ids[2] is: 2 [2026-05-26 03:21:49] expert_ids[3] is: 3 [2026-05-26 03:21:49] expert_ids[4] is: 4 [2026-05-26 03:21:49] expert_ids[5] is: 5 [2026-05-26 03:21:49] expert_ids[6] is: 6 [2026-05-26 03:21:49] expert_ids[7] is: 7 [2026-05-26 03:21:49] expert_ids[8] is: 8 [2026-05-26 03:21:49] expert_ids[9] is: 9 [2026-05-26 03:21:49] expert_ids[10] is: 0 [2026-05-26 03:21:49] expert_ids[11] is: 1 [2026-05-26 03:21:49] expert_ids[12] is: 2 [2026-05-26 03:21:49] expert_ids[13] is: 3 [2026-05-26 03:21:49] expert_ids[14] is: 4 [2026-05-26 03:21:49] expert_ids[15] is: 5 [2026-05-26 03:21:49] expert_ids[16] is: 6 [2026-05-26 03:21:49] expert_ids[17] is: 7 [2026-05-26 03:21:49] expert_ids[18] is: 8 [2026-05-26 03:21:49] expert_ids[19] is: 9 [2026-05-26 03:21:50] run test_aclnn_ffn_worker_scheduler, execute samples success [2026-05-26 03:21:50] Example completed successfully <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 不涉及 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x]? Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5918 | 5 months ago | |
Fix no-quant matmul error messages Co-authored-by: eternityk<taoyikun@huawei.com> # message auto-generated for no-merge-commit merge: !5693 merge bak into master Fix no-quant matmul error messages Created-by: eternityk Commit-by: eternityk Merged-by: cann-robot Description: ## 描述 本次修改主要针对非量化matmul相关算子的参数校验错误信息进行规范化整改。 改动内容包括: 将 mat_mul_v3/batch_mat_mul_v3/transpose_batch_mat_mul/transpose_quant_batch_mat_mul/gemm_v3/fused_mat_mul算子opapi/ophost文件夹下的部分普通 OP_LOGE / CUBE_INNER_ERR_REPORT 替换为更明确的错误日志宏。 针对 dtype、shape、shape dim、format、value 等非法输入场景,补充参数名、实际值和原因说明,提升报错可读性和问题定位效率。 优化部分错误信息表述,并调整部分日志调用格式,避免函数体过大导致的问题。 ## 关联的Issue [#2838](https://gitcode.com/cann/ops-transformer/issues/2838) ## 测试 已针对本次修改涉及的算子 opapi/ophost 参数校验路径进行代码检查,确认错误日志宏调用格式正确,参数名、实际值和原因说明完整。 ## 文档更新 无 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [x] ❓ 其他,请描述:errmsg整改 See merge request: cann/ops-transformer!5693 | 5 months ago | |
megamoe新增静态tensor和syncfunc功能 Co-authored-by: yangzeheng<yangzeheng@huawei.com> # message auto-generated for no-merge-commit merge: !3608 merge master into master megamoe新增静态tensor和syncfunc功能 Created-by: yangzeheng Commit-by: yangzeheng Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!3608 | 5 months ago | |
调整hin的数据类型适配 Co-authored-by: weixin_44156099<heyuhang20@h-partners.com> # message auto-generated for no-merge-commit merge: !6145 merge fix_mhc_fp16 into master 调整hin的数据类型适配 Created-by: weixin_44156099 Commit-by: weixin_44156099 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 调整MhcPreSinkhorn算子的hin数据类型支持FP16 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-transformer/issues/2802 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。-->  ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6145 | 5 months ago | |
更新moeinitroutingv2错误码 Co-authored-by: kdy18482276080<kongdeyuan3@huawei.com> # message auto-generated for no-merge-commit merge: !6189 merge v2530 into master 更新moeinitroutingv2错误码 Created-by: kdy18482276080 Commit-by: kdy18482276080 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 更新moeinitroutingv2错误码,补充小shape空tensor处理 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> 关联Issue #2816 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。-->  ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6189 | 5 months ago | |
新增norm_rope_concat/_grad算子ATK用例 Co-authored-by: chenyanbin8<chenyanbin8@huawei.com> # message auto-generated for no-merge-commit merge: !5746 merge fix/atk_norm_rope_concat into master 新增norm_rope_concat/_grad算子ATK用例 Created-by: chenyanbin8 Commit-by: chenyanbin8 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 新增aclnnNormRopeConcat、aclnnNormRopeConcatGrad算子ATK用例 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> #2607 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 各泛化210个用例测试PASS   ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [x] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5746 | 5 months ago | |
update: 更新文件 oat_check.sh Co-authored-by: zhangfands<zhangfands@noreply.gitcode.com> # message auto-generated for no-merge-commit merge: !5758 merge master into master update: 更新文件 oat_check.sh Created-by: zhangfands Commit-by: zhangfands Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5758 | 5 months ago | |
modify hcclcontext Co-authored-by: yifux<xiongyifu1@huawei.com> # message auto-generated for no-merge-commit merge: !5465 merge pr_context into master modify hcclcontext Created-by: xiongyifu Commit-by: yifux Merged-by: cann-robot Description: ## 描述 切换修改新的hccl context开源方案 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2844 ## 测试  ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: # PR #5465 代码检视报告 ## 检视概览 - **PR**: [quant_reduce_scatter 新增 Mc2Context 双路径通信 + quant_reduce_scatter_v2 算子工程](https://gitcode.com/cann/ops-transformer/pull/5465) - **变更范围**: 42 个文件,涵盖 op_host/op_kernel/op_api/op_graph/UT/Build 全侧代码 - **算子名**: quant_reduce_scatter / quant_reduce_scatter_v2 - **检视侧别**: Kernel + Tiling + op_api + Build - **检视文档**: cpp-secure.md, ascendc-topk.md, ascendc-api.md, ascendc-perf.md, mc2-specific.md, cpp-general.md, compile-secure.md - **总条例数**: 31 条(聚焦高优先级 SEC/TOPK/API/MC2 条例) - **检视时间**: 2026-06-02 ## 检视统计 | 状态 | 条例数 | 占比 | |------|------|------| | PASS | 30 | 96.8% | | FAIL(发现问题)| 1 | 3.2% | --- ## 发现问题(HIGH 置信度) <span style="color:red">aclnnQuantReduceScatterV2GetWorkspaceSize只是为了保持代码和目录完整性添加的接口,不需做额外校验。这一条检视意见可以忽略。</span> ### [SEC-4.1] 外部输入合法性校验缺失 - **问题描述**: aclnnQuantReduceScatterV2GetWorkspaceSize 作为 V2 算子的外部 API 入口函数,接收 9 个外部输入参数(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor),但**未做任何参数校验**(nullptr 检查、dtype 检查、参数范围检查等),直接透传给内部函数。与 V1 路径通过 CheckParams 进行完整的 CheckNotNull/CheckAllDtypesValid/CheckGroupLength 校验形成对比。 - **代码片段**(mc2/quant_reduce_scatter_v2/op_api/aclnn_quant_reduce_scatter_v2.cpp 行 31-42): cpp extern "C" aclnnStatus aclnnQuantReduceScatterV2GetWorkspaceSize(const aclTensor *context, const aclTensor* x, const aclTensor* scales, int64_t hcclBufferSize, char* reduceOp, int64_t yDtype, int64_t worldSize, const aclTensor* output, uint64_t* workspaceSize, aclOpExecutor** executor) { OP_LOGD("aclnnQuantReduceScatterV2GetWorkspaceSize start"); return aclnnInnerQuantReduceScatterV2GetWorkspaceSize(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor); } - **V1 对比**(mc2/quant_reduce_scatter/op_api/aclnn_quant_reduce_scatter_base.cpp 行 144-151): cpp static aclnnStatus CheckParams(const aclTensor* x, const aclTensor* scales, const char* group, const aclTensor* output) { CHECK_RET(CheckNotNull(x, scales, output), ACLNN_ERR_PARAM_NULLPTR); CHECK_RET(CheckAllDtypesValid(x, scales, output), ACLNN_ERR_PARAM_INVALID); CHECK_RET(CheckGroupLength(group), ACLNN_ERR_PARAM_INVALID); return ACLNN_SUCCESS; } - **假设检验证据**: 正向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | 规范违反 | +40% | 外部 API 入口应校验外部输入,V2 未做任何校验 | | 上下文防御缺失 | +30% | 函数体内无防御代码,直接透传 | | PR 归属 | +20% | 问题代码为本次 PR 新增文件 | | 领域关联 | +10% | 外部 API 入口点是安全校验第一道防线 | 负向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | Tiling 层校验 | -15% | V2 tiling 路径有 CheckMc2Context + CheckTilingFunc 校验 | | 内部层校验 | -15% | 内部函数可能存在校验 | 自信值 = 40 + 30 + 20 + 10 - 15 - 15 = **70%** ≥ 70% → 判定违规 - **修复建议**: 参照 V1 的 aclnnQuantReduceScatterBaseGetWorkspaceSize 模式,在 V2 外部 API 中增加参数校验: 1. OP_CHECK_NULL(context/x/scales/output/workspaceSize/executor) 非空校验 2. x/scales/output 的 dtype 组合校验(与 V1 CheckAllDtypesValid 一致) 3. hcclBufferSize > 0 和 worldSize > 0 的范围校验 --- ## 通过条例 [quant_reduce_scatter_kernel_G1] SEC-2.1 PASS — 无有符号整数算术运算 [quant_reduce_scatter_kernel_G1] SEC-2.2 PASS — 所有 uint32 表达式值域安全(max < UINT32_MAX) [quant_reduce_scatter_kernel_G1] SEC-3.1 PASS — 所有新增成员变量均有类内初始化 [quant_reduce_scatter_kernel_G1] SEC-3.3 PASS — 数组索引均在循环边界内或上游已校验 [quant_reduce_scatter_kernel_G1] SEC-4.1 PASS — mc2Context 路径有上游 Host 侧完整校验链 [quant_reduce_scatter_kernel_G1] SEC-4.2 PASS — PR 未修改 DataCopy 搬运长度 [quant_reduce_scatter_kernel_G1] TOPK-8 PASS — GM 偏移变量均为 uint64_t,中间变量值域安全 [quant_reduce_scatter_kernel_G1] TOPK-9 PASS — 无 atomic 累加操作 [quant_reduce_scatter_kernel_G1] TOPK-11 PASS — 软同步完整(PipeBarrier→WriteStatus→ReadStatus忙等) [quant_reduce_scatter_kernel_G1] API-3 PASS — DataCopy 对齐属性未因 PR 变更改变 [quant_reduce_scatter_kernel_G1] API-6 PASS — AllocTensor/FreeTensor 配对未变更 [quant_reduce_scatter_kernel_G1] MC2-01 PASS — 核间同步机制完整 [quant_reduce_scatter_kernel_G1] MC2-11 PASS — 未修改量化精度逻辑 [quant_reduce_scatter_kernel_G1] MC2-16 PASS — kernel_operator.h 已被 ASC_DEVKIT_MAJOR 宏包裹 [quant_reduce_scatter_host_G1] SEC-2.1 PASS — 所有关键运算为 uint64_t 无符号 [quant_reduce_scatter_host_G1] SEC-2.3 PASS — 除数均有 constexpr/白名单校验保护 [quant_reduce_scatter_host_G1] SEC-4.1 PASS — 外部输入校验链完整(CheckTilingFunc 7 步校验) [quant_reduce_scatter_host_G1] TOPK-1 PASS — 所有函数返回值均有 OP_TILING_CHECK 校验 [quant_reduce_scatter_host_G1] TOPK-7 PASS — Shape/Dtype/Format/属性/指针校验全覆盖 [quant_reduce_scatter_host_G1] MC2-09 PASS — 量化参数类型一致,日志格式化字符串匹配 [quant_reduce_scatter_host_G1] MC2-10 PASS — TG/MX 量化模式校验覆盖所有合法组合 [quant_reduce_scatter_host_G1] MC2-14 PASS — Tiling struct 对齐、并发安全、除零保护到位 [quant_reduce_scatter_host_G1] MC2-15 PASS — group 通过 std::string 深拷贝 [quant_reduce_scatter_v2_kernel_G1] SEC-3.1 PASS — 框架宏/构造函数/Init 保证初始化 [quant_reduce_scatter_v2_kernel_G1] SEC-4.1 PASS — 外部输入命中 Kernel 侧排除规则 [quant_reduce_scatter_v2_kernel_G1] TOPK-8 PASS — GM 偏移使用 uint64_t,数值范围安全 [quant_reduce_scatter_v2_kernel_G1] TOPK-11 PASS — MTE 通信同步链完整 [quant_reduce_scatter_v2_kernel_G1] MC2-01 PASS — 软件同步机制完整 [quant_reduce_scatter_v2_kernel_G1] MC2-16 PASS — ASC_DEVKIT_MAJOR 宏正确包裹 [quant_reduce_scatter_v2_host_G1] SEC-2.1/4.1/TOPK-7/MC2-09/14/15 PASS — 校验链与 V1 共享且完整 [shared] SEC-3.5 PASS — 所有指针使用前有判空或上游保证 [shared] SEC-5.1 PASS — HCCL API 返回值全部检查 [shared] MC2-17 PASS — HCCL API 使用模式与已有 MoE 路径一致 [shared] MC2-18 PASS — V2 上下文生命周期通过 Host 侧预构建,设计合理 See merge request: cann/ops-transformer!5465 | 5 months ago | |
SMLAG算子新增torch适配以及支持新特性 Co-authored-by: hz36amy_00<zhouyangfan8@huawei.com> # message auto-generated for no-merge-commit merge: !5916 merge smlag-0526 into master SMLAG算子新增torch适配以及支持新特性 Created-by: hz36amy_00 Commit-by: hz36amy_00 Merged-by: cann-robot Description: ## 描述 1、新增SMLAG及meta torch适配接口 2、SMLAG ori、cmp部分解耦,并支持cmp_residual_kv 3、支持SCFA场景下,输出cmpSoftmaxL1Norm 4、SMLAG原型修改:可选输入放至必选输入后、删除deterministic字段 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5916 | 5 months ago | |
更新license Co-authored-by: PerrySkywalker<wangmingkang1@huawei.com> # message auto-generated for no-merge-commit merge: !568 merge lic into master 更新license Created-by: PerrySkywalker Commit-by: PerrySkywalker Merged-by: cann-robot Description: ## 描述 更新license <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-transformer!568 | 10 months ago | |
增加pre-commit配置,commit代码时完成代码格式化及OAT扫描 Co-authored-by: hello_simida<wangyi206@huawei.com> # message auto-generated for no-merge-commit merge: !3578 merge master_precommit into master 增加pre-commit配置,commit代码时完成代码格式化及OAT扫描 Created-by: hello_simida Commit-by: hello_simida Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!3578 | 7 months ago | |
通过gitmodules引入third_party/catlass Co-authored-by: longjihui<longjihui@huawei.com> # message auto-generated for no-merge-commit merge: !1765 merge master into master 通过gitmodules引入third_party/catlass Created-by: longjihui Commit-by: longjihui Merged-by: cann-robot Description: ## 描述 新增.gitmodules文件,引入第三方库catlass,分支为v1.3.1-notla ## 关联的Issue 不涉及 ## 测试 仅引入三方仓,使用方式暂不确定,无需测试 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:新引入三方仓catlass See merge request: cann/ops-transformer!1765 | 6 months ago | |
fix: 修复clang-format配置 Co-authored-by: j60100428<jingsong5@h-partners.com> # message auto-generated for no-merge-commit merge: !6029 merge master into master fix: 修复clang-format配置 Created-by: SH_jingsong Commit-by: j60100428 Merged-by: cann-robot Description: ## 描述 fix: 修复clang-format配置 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2728 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6029 | 5 months ago | |
Transformer 更新Latest News Co-authored-by: lidongsheng<lidongsheng43@huawei.com> # message auto-generated for no-merge-commit merge: !771 merge docs into master Transformer 更新Latest News Created-by: qq_46353993 Commit-by: lidongsheng Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-transformer!771 | 9 months ago | |
add short soc Co-authored-by: leiqingji<leiqingji@h-partners.com> # message auto-generated for no-merge-commit merge: !6034 merge v5 into master add short soc Created-by: leiqingji Commit-by: leiqingji Merged-by: cann-robot Description: ## 描述 rename: mc62cm12a → mc62 short soc name ## 改动 - 将 mc62cm12a 重命名为 mc62 统一短命名格式 - 涉及 CMakeLists.txt、build.sh、cmake/func.cmake 及 attention/posembedding 相关配置 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2788 ## 测试 - 编译测试通过 ## 类型标签 - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!6034 | 5 months ago | |
docs: 补充生态算子精度标准引用 Co-authored-by: chaotang233<tangchao47@hisilicon.com> # message auto-generated for no-merge-commit merge: !5006 merge master into master docs: 补充生态算子精度标准引用 Created-by: chaotang233 Commit-by: chaotang233 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 增加精度标准的索引,确保仓可以引用到精度标准 会议纪要:https://etherpad-cann.meeting.osinfra.cn/p/TSC  ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。-->CONTRIBUTING.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [x] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5006 | 6 months ago | |
init | 1 year ago | |
规范化OAT.xml中许可证声明形式 Co-authored-by: chenyx2012<975102023@qq.com> # message auto-generated for no-merge-commit merge: !3571 merge master into master 规范化OAT.xml中许可证声明形式 Created-by: chenyx_2012 Commit-by: chenyx2012 Merged-by: cann-robot Description: ## 描述 规范化OAT.xml中许可证声明形式 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!3571 | 7 months ago | |
新增本地编译FAQ&&新增ascend950算子列表&&quick_op_invocation整改 Co-authored-by: huang-chuhong<huangchuhong1@h-partners.com> # message auto-generated for no-merge-commit merge: !5187 merge master into master 新增本地编译FAQ&&新增ascend950算子列表&&quick_op_invocation整改 Created-by: huang-chuhong Commit-by: huang-chuhong Merged-by: cann-robot Description: ## 描述 新增本地编译FAQ&&新增ascend950算子列表&&quick_op_invocation整改 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2350 https://gitcode.com/cann/ops-transformer/issues/1683 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!5187 | 5 months ago | |
doc Tools工具扫描问题修改 Co-authored-by: gitee-yanglulu<yanglulul@h-partners.com> # message auto-generated for no-merge-commit merge: !3432 merge master into master doc Tools工具扫描问题修改 Created-by: gitee-yanglulu Commit-by: gitee-yanglulu Merged-by: cann-robot Description: doc Tools工具扫描问题修改 See merge request: cann/ops-transformer!3432 | 7 months ago | |
支持按模板参数编译算子kernel、支持编译入参调试异常与调优参数 Co-authored-by: lidongsheng<lidongsheng43@huawei.com> Co-authored-by: 吴剑飞<wujianfei15@huawei.com> # message auto-generated for no-merge-commit merge: !2170 merge 910_lds into master 支持按模板参数编译算子kernel、支持编译入参调试异常与调优参数 Created-by: qq_46353993 Commit-by: 吴剑飞;lidongsheng Merged-by: cann-robot Description: ## 描述 本次修改支持用户通过build.sh的编译入口传入模板参数--kernel_template_input后按tilingkey编译、传入--bisheng_flags进行调试异常 ## 关联的Issue [支持按模板参数指定编译kernel](https://gitcode.com/cann/ops-transformer/issues/1036) [支持编译入参新增调试异常和调优参数](https://gitcode.com/cann/ops-transformer/issues/1044) ## 测试 二级冒烟、指定模板参数编译并执行测试用例 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-transformer!2170 | 8 months ago | |
更新protobuf版本 Co-authored-by: PerrySkywalker<wangmingkang1@huawei.com> # message auto-generated for no-merge-commit merge: !522 merge prof into master 更新protobuf版本 Created-by: PerrySkywalker Commit-by: PerrySkywalker Merged-by: cann-robot Description: ## 描述 更新protobuf版本 ## 关联的Issue 关联Issue [#316](https://gitcode.com/cann/ops-transformer/issues/316) <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-transformer!522 | 10 months ago | |
modify hcclcontext Co-authored-by: yifux<xiongyifu1@huawei.com> # message auto-generated for no-merge-commit merge: !5465 merge pr_context into master modify hcclcontext Created-by: xiongyifu Commit-by: yifux Merged-by: cann-robot Description: ## 描述 切换修改新的hccl context开源方案 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2844 ## 测试  ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: # PR #5465 代码检视报告 ## 检视概览 - **PR**: [quant_reduce_scatter 新增 Mc2Context 双路径通信 + quant_reduce_scatter_v2 算子工程](https://gitcode.com/cann/ops-transformer/pull/5465) - **变更范围**: 42 个文件,涵盖 op_host/op_kernel/op_api/op_graph/UT/Build 全侧代码 - **算子名**: quant_reduce_scatter / quant_reduce_scatter_v2 - **检视侧别**: Kernel + Tiling + op_api + Build - **检视文档**: cpp-secure.md, ascendc-topk.md, ascendc-api.md, ascendc-perf.md, mc2-specific.md, cpp-general.md, compile-secure.md - **总条例数**: 31 条(聚焦高优先级 SEC/TOPK/API/MC2 条例) - **检视时间**: 2026-06-02 ## 检视统计 | 状态 | 条例数 | 占比 | |------|------|------| | PASS | 30 | 96.8% | | FAIL(发现问题)| 1 | 3.2% | --- ## 发现问题(HIGH 置信度) <span style="color:red">aclnnQuantReduceScatterV2GetWorkspaceSize只是为了保持代码和目录完整性添加的接口,不需做额外校验。这一条检视意见可以忽略。</span> ### [SEC-4.1] 外部输入合法性校验缺失 - **问题描述**: aclnnQuantReduceScatterV2GetWorkspaceSize 作为 V2 算子的外部 API 入口函数,接收 9 个外部输入参数(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor),但**未做任何参数校验**(nullptr 检查、dtype 检查、参数范围检查等),直接透传给内部函数。与 V1 路径通过 CheckParams 进行完整的 CheckNotNull/CheckAllDtypesValid/CheckGroupLength 校验形成对比。 - **代码片段**(mc2/quant_reduce_scatter_v2/op_api/aclnn_quant_reduce_scatter_v2.cpp 行 31-42): cpp extern "C" aclnnStatus aclnnQuantReduceScatterV2GetWorkspaceSize(const aclTensor *context, const aclTensor* x, const aclTensor* scales, int64_t hcclBufferSize, char* reduceOp, int64_t yDtype, int64_t worldSize, const aclTensor* output, uint64_t* workspaceSize, aclOpExecutor** executor) { OP_LOGD("aclnnQuantReduceScatterV2GetWorkspaceSize start"); return aclnnInnerQuantReduceScatterV2GetWorkspaceSize(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor); } - **V1 对比**(mc2/quant_reduce_scatter/op_api/aclnn_quant_reduce_scatter_base.cpp 行 144-151): cpp static aclnnStatus CheckParams(const aclTensor* x, const aclTensor* scales, const char* group, const aclTensor* output) { CHECK_RET(CheckNotNull(x, scales, output), ACLNN_ERR_PARAM_NULLPTR); CHECK_RET(CheckAllDtypesValid(x, scales, output), ACLNN_ERR_PARAM_INVALID); CHECK_RET(CheckGroupLength(group), ACLNN_ERR_PARAM_INVALID); return ACLNN_SUCCESS; } - **假设检验证据**: 正向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | 规范违反 | +40% | 外部 API 入口应校验外部输入,V2 未做任何校验 | | 上下文防御缺失 | +30% | 函数体内无防御代码,直接透传 | | PR 归属 | +20% | 问题代码为本次 PR 新增文件 | | 领域关联 | +10% | 外部 API 入口点是安全校验第一道防线 | 负向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | Tiling 层校验 | -15% | V2 tiling 路径有 CheckMc2Context + CheckTilingFunc 校验 | | 内部层校验 | -15% | 内部函数可能存在校验 | 自信值 = 40 + 30 + 20 + 10 - 15 - 15 = **70%** ≥ 70% → 判定违规 - **修复建议**: 参照 V1 的 aclnnQuantReduceScatterBaseGetWorkspaceSize 模式,在 V2 外部 API 中增加参数校验: 1. OP_CHECK_NULL(context/x/scales/output/workspaceSize/executor) 非空校验 2. x/scales/output 的 dtype 组合校验(与 V1 CheckAllDtypesValid 一致) 3. hcclBufferSize > 0 和 worldSize > 0 的范围校验 --- ## 通过条例 [quant_reduce_scatter_kernel_G1] SEC-2.1 PASS — 无有符号整数算术运算 [quant_reduce_scatter_kernel_G1] SEC-2.2 PASS — 所有 uint32 表达式值域安全(max < UINT32_MAX) [quant_reduce_scatter_kernel_G1] SEC-3.1 PASS — 所有新增成员变量均有类内初始化 [quant_reduce_scatter_kernel_G1] SEC-3.3 PASS — 数组索引均在循环边界内或上游已校验 [quant_reduce_scatter_kernel_G1] SEC-4.1 PASS — mc2Context 路径有上游 Host 侧完整校验链 [quant_reduce_scatter_kernel_G1] SEC-4.2 PASS — PR 未修改 DataCopy 搬运长度 [quant_reduce_scatter_kernel_G1] TOPK-8 PASS — GM 偏移变量均为 uint64_t,中间变量值域安全 [quant_reduce_scatter_kernel_G1] TOPK-9 PASS — 无 atomic 累加操作 [quant_reduce_scatter_kernel_G1] TOPK-11 PASS — 软同步完整(PipeBarrier→WriteStatus→ReadStatus忙等) [quant_reduce_scatter_kernel_G1] API-3 PASS — DataCopy 对齐属性未因 PR 变更改变 [quant_reduce_scatter_kernel_G1] API-6 PASS — AllocTensor/FreeTensor 配对未变更 [quant_reduce_scatter_kernel_G1] MC2-01 PASS — 核间同步机制完整 [quant_reduce_scatter_kernel_G1] MC2-11 PASS — 未修改量化精度逻辑 [quant_reduce_scatter_kernel_G1] MC2-16 PASS — kernel_operator.h 已被 ASC_DEVKIT_MAJOR 宏包裹 [quant_reduce_scatter_host_G1] SEC-2.1 PASS — 所有关键运算为 uint64_t 无符号 [quant_reduce_scatter_host_G1] SEC-2.3 PASS — 除数均有 constexpr/白名单校验保护 [quant_reduce_scatter_host_G1] SEC-4.1 PASS — 外部输入校验链完整(CheckTilingFunc 7 步校验) [quant_reduce_scatter_host_G1] TOPK-1 PASS — 所有函数返回值均有 OP_TILING_CHECK 校验 [quant_reduce_scatter_host_G1] TOPK-7 PASS — Shape/Dtype/Format/属性/指针校验全覆盖 [quant_reduce_scatter_host_G1] MC2-09 PASS — 量化参数类型一致,日志格式化字符串匹配 [quant_reduce_scatter_host_G1] MC2-10 PASS — TG/MX 量化模式校验覆盖所有合法组合 [quant_reduce_scatter_host_G1] MC2-14 PASS — Tiling struct 对齐、并发安全、除零保护到位 [quant_reduce_scatter_host_G1] MC2-15 PASS — group 通过 std::string 深拷贝 [quant_reduce_scatter_v2_kernel_G1] SEC-3.1 PASS — 框架宏/构造函数/Init 保证初始化 [quant_reduce_scatter_v2_kernel_G1] SEC-4.1 PASS — 外部输入命中 Kernel 侧排除规则 [quant_reduce_scatter_v2_kernel_G1] TOPK-8 PASS — GM 偏移使用 uint64_t,数值范围安全 [quant_reduce_scatter_v2_kernel_G1] TOPK-11 PASS — MTE 通信同步链完整 [quant_reduce_scatter_v2_kernel_G1] MC2-01 PASS — 软件同步机制完整 [quant_reduce_scatter_v2_kernel_G1] MC2-16 PASS — ASC_DEVKIT_MAJOR 宏正确包裹 [quant_reduce_scatter_v2_host_G1] SEC-2.1/4.1/TOPK-7/MC2-09/14/15 PASS — 校验链与 V1 共享且完整 [shared] SEC-3.5 PASS — 所有指针使用前有判空或上游保证 [shared] SEC-5.1 PASS — HCCL API 返回值全部检查 [shared] MC2-17 PASS — HCCL API 使用模式与已有 MoE 路径一致 [shared] MC2-18 PASS — V2 上下文生命周期通过 Host 侧预构建,设计合理 See merge request: cann/ops-transformer!5465 | 5 months ago | |
modify hcclcontext Co-authored-by: yifux<xiongyifu1@huawei.com> # message auto-generated for no-merge-commit merge: !5465 merge pr_context into master modify hcclcontext Created-by: xiongyifu Commit-by: yifux Merged-by: cann-robot Description: ## 描述 切换修改新的hccl context开源方案 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2844 ## 测试  ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [x] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: # PR #5465 代码检视报告 ## 检视概览 - **PR**: [quant_reduce_scatter 新增 Mc2Context 双路径通信 + quant_reduce_scatter_v2 算子工程](https://gitcode.com/cann/ops-transformer/pull/5465) - **变更范围**: 42 个文件,涵盖 op_host/op_kernel/op_api/op_graph/UT/Build 全侧代码 - **算子名**: quant_reduce_scatter / quant_reduce_scatter_v2 - **检视侧别**: Kernel + Tiling + op_api + Build - **检视文档**: cpp-secure.md, ascendc-topk.md, ascendc-api.md, ascendc-perf.md, mc2-specific.md, cpp-general.md, compile-secure.md - **总条例数**: 31 条(聚焦高优先级 SEC/TOPK/API/MC2 条例) - **检视时间**: 2026-06-02 ## 检视统计 | 状态 | 条例数 | 占比 | |------|------|------| | PASS | 30 | 96.8% | | FAIL(发现问题)| 1 | 3.2% | --- ## 发现问题(HIGH 置信度) <span style="color:red">aclnnQuantReduceScatterV2GetWorkspaceSize只是为了保持代码和目录完整性添加的接口,不需做额外校验。这一条检视意见可以忽略。</span> ### [SEC-4.1] 外部输入合法性校验缺失 - **问题描述**: aclnnQuantReduceScatterV2GetWorkspaceSize 作为 V2 算子的外部 API 入口函数,接收 9 个外部输入参数(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor),但**未做任何参数校验**(nullptr 检查、dtype 检查、参数范围检查等),直接透传给内部函数。与 V1 路径通过 CheckParams 进行完整的 CheckNotNull/CheckAllDtypesValid/CheckGroupLength 校验形成对比。 - **代码片段**(mc2/quant_reduce_scatter_v2/op_api/aclnn_quant_reduce_scatter_v2.cpp 行 31-42): cpp extern "C" aclnnStatus aclnnQuantReduceScatterV2GetWorkspaceSize(const aclTensor *context, const aclTensor* x, const aclTensor* scales, int64_t hcclBufferSize, char* reduceOp, int64_t yDtype, int64_t worldSize, const aclTensor* output, uint64_t* workspaceSize, aclOpExecutor** executor) { OP_LOGD("aclnnQuantReduceScatterV2GetWorkspaceSize start"); return aclnnInnerQuantReduceScatterV2GetWorkspaceSize(context, x, scales, hcclBufferSize, reduceOp, yDtype, worldSize, output, workspaceSize, executor); } - **V1 对比**(mc2/quant_reduce_scatter/op_api/aclnn_quant_reduce_scatter_base.cpp 行 144-151): cpp static aclnnStatus CheckParams(const aclTensor* x, const aclTensor* scales, const char* group, const aclTensor* output) { CHECK_RET(CheckNotNull(x, scales, output), ACLNN_ERR_PARAM_NULLPTR); CHECK_RET(CheckAllDtypesValid(x, scales, output), ACLNN_ERR_PARAM_INVALID); CHECK_RET(CheckGroupLength(group), ACLNN_ERR_PARAM_INVALID); return ACLNN_SUCCESS; } - **假设检验证据**: 正向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | 规范违反 | +40% | 外部 API 入口应校验外部输入,V2 未做任何校验 | | 上下文防御缺失 | +30% | 函数体内无防御代码,直接透传 | | PR 归属 | +20% | 问题代码为本次 PR 新增文件 | | 领域关联 | +10% | 外部 API 入口点是安全校验第一道防线 | 负向证据: | 证据类型 | 分值 | 证据描述 | |---------|------|---------| | Tiling 层校验 | -15% | V2 tiling 路径有 CheckMc2Context + CheckTilingFunc 校验 | | 内部层校验 | -15% | 内部函数可能存在校验 | 自信值 = 40 + 30 + 20 + 10 - 15 - 15 = **70%** ≥ 70% → 判定违规 - **修复建议**: 参照 V1 的 aclnnQuantReduceScatterBaseGetWorkspaceSize 模式,在 V2 外部 API 中增加参数校验: 1. OP_CHECK_NULL(context/x/scales/output/workspaceSize/executor) 非空校验 2. x/scales/output 的 dtype 组合校验(与 V1 CheckAllDtypesValid 一致) 3. hcclBufferSize > 0 和 worldSize > 0 的范围校验 --- ## 通过条例 [quant_reduce_scatter_kernel_G1] SEC-2.1 PASS — 无有符号整数算术运算 [quant_reduce_scatter_kernel_G1] SEC-2.2 PASS — 所有 uint32 表达式值域安全(max < UINT32_MAX) [quant_reduce_scatter_kernel_G1] SEC-3.1 PASS — 所有新增成员变量均有类内初始化 [quant_reduce_scatter_kernel_G1] SEC-3.3 PASS — 数组索引均在循环边界内或上游已校验 [quant_reduce_scatter_kernel_G1] SEC-4.1 PASS — mc2Context 路径有上游 Host 侧完整校验链 [quant_reduce_scatter_kernel_G1] SEC-4.2 PASS — PR 未修改 DataCopy 搬运长度 [quant_reduce_scatter_kernel_G1] TOPK-8 PASS — GM 偏移变量均为 uint64_t,中间变量值域安全 [quant_reduce_scatter_kernel_G1] TOPK-9 PASS — 无 atomic 累加操作 [quant_reduce_scatter_kernel_G1] TOPK-11 PASS — 软同步完整(PipeBarrier→WriteStatus→ReadStatus忙等) [quant_reduce_scatter_kernel_G1] API-3 PASS — DataCopy 对齐属性未因 PR 变更改变 [quant_reduce_scatter_kernel_G1] API-6 PASS — AllocTensor/FreeTensor 配对未变更 [quant_reduce_scatter_kernel_G1] MC2-01 PASS — 核间同步机制完整 [quant_reduce_scatter_kernel_G1] MC2-11 PASS — 未修改量化精度逻辑 [quant_reduce_scatter_kernel_G1] MC2-16 PASS — kernel_operator.h 已被 ASC_DEVKIT_MAJOR 宏包裹 [quant_reduce_scatter_host_G1] SEC-2.1 PASS — 所有关键运算为 uint64_t 无符号 [quant_reduce_scatter_host_G1] SEC-2.3 PASS — 除数均有 constexpr/白名单校验保护 [quant_reduce_scatter_host_G1] SEC-4.1 PASS — 外部输入校验链完整(CheckTilingFunc 7 步校验) [quant_reduce_scatter_host_G1] TOPK-1 PASS — 所有函数返回值均有 OP_TILING_CHECK 校验 [quant_reduce_scatter_host_G1] TOPK-7 PASS — Shape/Dtype/Format/属性/指针校验全覆盖 [quant_reduce_scatter_host_G1] MC2-09 PASS — 量化参数类型一致,日志格式化字符串匹配 [quant_reduce_scatter_host_G1] MC2-10 PASS — TG/MX 量化模式校验覆盖所有合法组合 [quant_reduce_scatter_host_G1] MC2-14 PASS — Tiling struct 对齐、并发安全、除零保护到位 [quant_reduce_scatter_host_G1] MC2-15 PASS — group 通过 std::string 深拷贝 [quant_reduce_scatter_v2_kernel_G1] SEC-3.1 PASS — 框架宏/构造函数/Init 保证初始化 [quant_reduce_scatter_v2_kernel_G1] SEC-4.1 PASS — 外部输入命中 Kernel 侧排除规则 [quant_reduce_scatter_v2_kernel_G1] TOPK-8 PASS — GM 偏移使用 uint64_t,数值范围安全 [quant_reduce_scatter_v2_kernel_G1] TOPK-11 PASS — MTE 通信同步链完整 [quant_reduce_scatter_v2_kernel_G1] MC2-01 PASS — 软件同步机制完整 [quant_reduce_scatter_v2_kernel_G1] MC2-16 PASS — ASC_DEVKIT_MAJOR 宏正确包裹 [quant_reduce_scatter_v2_host_G1] SEC-2.1/4.1/TOPK-7/MC2-09/14/15 PASS — 校验链与 V1 共享且完整 [shared] SEC-3.5 PASS — 所有指针使用前有判空或上游保证 [shared] SEC-5.1 PASS — HCCL API 返回值全部检查 [shared] MC2-17 PASS — HCCL API 使用模式与已有 MoE 路径一致 [shared] MC2-18 PASS — V2 上下文生命周期通过 Host 侧预构建,设计合理 See merge request: cann/ops-transformer!5465 | 5 months ago | |
移除gawk依赖,使用shell内置命令替代 Co-authored-by: huang-chuhong<huangchuhong1@h-partners.com> # message auto-generated for no-merge-commit merge: !4704 merge master into master 移除gawk依赖,使用shell内置命令替代 Created-by: huang-chuhong Commit-by: huang-chuhong Merged-by: cann-robot Description: ## 描述 移除gawk依赖,使用shell内置命令替代 资料描述错误修改 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2119 https://gitcode.com/cann/ops-transformer/issues/2049 https://gitcode.com/cann/ops-transformer/issues/2149 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!4704 | 6 months ago | |
前置依赖资料修改&&build.sh --help提示&&requirement.txt明确依赖版本 Co-authored-by: huang-chuhong<huangchuhong1@h-partners.com> # message auto-generated for no-merge-commit merge: !4532 merge master into master 前置依赖资料修改&&build.sh --help提示&&requirement.txt明确依赖版本 Created-by: huang-chuhong Commit-by: huang-chuhong Merged-by: cann-robot Description: ## 描述 1、手动安装,最小化环境依赖不清晰 资料调整 2、SOC 参数错误应更新 build.sh 支持列表并完善文档说明 3、requirement.txt Python 依赖冲突应显式声明版本约束与缺失依赖 ## 关联的Issue https://gitcode.com/cann/ops-transformer/issues/2018 https://gitcode.com/cann/ops-transformer/issues/2017 https://gitcode.com/cann/ops-transformer/issues/2016 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [ ] ❓ 其他,请描述: See merge request: cann/ops-transformer!4532 | 6 months ago | |
chore: upgrade ops-transformer version to 9.1.0 and update opbase tag Co-authored-by: huang-chuhong<huangchuhong1@h-partners.com> # message auto-generated for no-merge-commit merge: !5895 merge chore/version-upgrade-9.1.0 into master chore: upgrade ops-transformer version to 9.1.0 and update opbase tag Created-by: huang-chuhong Commit-by: huang-chuhong Merged-by: cann-robot Description: ## 描述 ops-transformer 版本升级至 9.1.0,同步更新 opbase 依赖 tag,移除不再需要的 asc-tools 构建依赖。 ## 改动 - version.cmake: 版本号从 9.0.0 升级至 9.1.0 - version.cmake: 移除 asc-tools >=8.5 构建依赖 - cmake/third_party/opbase.cmake: opbase tag ID 从 6604d3c 更新为 ee5334d ## 关联的Issue #2662 https://gitcode.com/cann/ops-transformer/issues/2599 ## 测试 - bash build.sh --pkg --jit 编译打包通过 ## 类型标签 - [ ] 🐛 Bug 修复 - [ ] ✨ 新特性 - [ ] ⚡ 性能优化 - [ ] ♻️ 重构 - [ ] 🧪 测试 - [ ] 📦 构建/CI - [ ] 🔧 配置变更 - [ ] 📝 文档更新 - [ ] ⬆️ 依赖升级 - [ ] 🔒 安全修复 - [ ] 🧹 代码清理 - [x] ❓ 其他,请描述:版本升级 See merge request: cann/ops-transformer!5895 | 5 months ago | |
check_compile_version Co-authored-by: 吴剑飞<wujianfei15@huawei.com> # message auto-generated for no-merge-commit merge: !2085 merge check_version into master check_compile_version Created-by: hid81635372 Commit-by: 吴剑飞 Merged-by: cann-robot Description: ## 描述 工程上支持在编译时对子包版本进行校验 ## 关联的Issue https://gitcode.com/cann/ops-transformer/pull/2085 ## 测试 功能上可以在子包版本低于构建依赖时进行告警,RDV已通过 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述: 工程能力增加编译时版本校验功能 See merge request: cann/ops-transformer!2085 | 8 months ago |
ops-transformer
🔥Latest News
- [2026/02] 新支持算子mhc_post、mhc_pre、mhc_res。
- [2026/01] 新支持算子grouped_matmul<<<>>>调用示例,方便用户自定义使用。
- [2026/01] 新支持算子fused_floyd_attention、fused_floyd_attention_grad、matmul_allto_all。
- [2025/12] 新增QuickStart,指导新手零基础入门算子项目部署(支持Docker环境)、算子开发和贡献流程。
- [2025/12] 优化指南类文档,聚焦算子开发指南,明确最小交付件和关键示例代码,针对Ascend/samples仓算子提供迁移本项目的指导。
- [2025/12] 支持transformer类onnx算子插件,包括NPUFlashAttention、NPUMultiHeadAttention、NPUMoeComputeExpertTokens等。
- [2025/12] 新支持算子kv_rms_norm_rope_cache、attention_update、attention_worker_scheduler、gather_pa_kv_cache、kv_quant_sparse_flash_attention、lightning_indexer_grad、mla_preprocess、mla_preprocess_v2、grouped_matmul_swiglu_quant_v2、attention_to_ffn、ffn_to_attention。
- [2025/12] 开源算子支持CANN Simulator仿真工具开发调试。
- [2025/12] 开源算子支持Ascend 950PR/Ascend 950DT/KirinX90系列产品。
- [2025/11] 新支持算子kv_quant_sparse_flash_attention、lightning_indexer、quant_lightning_indexer、sparse_flash_attention。
- [2025/11] 新支持示例算子rope_matrix和all_gather_add。
- [2025/11] 新增算子开发工程模板NpuOpsTransformerExt,无缝集成PyTorch张量操作,支持自动微分和GPU/NPU统一接口。
- [2025/10] 新增experimental目录,完善贡献指南,支持开发者调试并贡献自定义算子。
- [2025/09] ops-transformer项目首次上线,开源算子支持Atlas A2/A3系列产品。
🚀概述
ops-transformer是CANN (Compute Architecture for Neural Networks)算子库中提供transformer类大模型计算的进阶算子库,包括attention类、moe类、mc2类等,覆盖各类attention、MoE计算、通算融合等场景,算子库在架构图中的位置如下。

📌版本配套
本项目源码会跟随CANN软件版本发布,关于CANN软件版本与本项目标签的对应关系请参阅release仓库中的相应版本说明 。 请注意,为确保您的源码定制开发顺利进行,请选择配套的CANN版本与Gitcode标签源码,使用master分支可能存在版本不匹配的风险。
🛠️环境准备
环境部署是体验本项目能力的前提,请先完成NPU驱动、CANN包安装等,确保环境正常。
⬇️源码下载
环境准备好后,下载与CANN版本配套的分支源码,命令如下,${tag_version}替换为分支标签名。
说明:若环境中已存在配套分支源码,可跳过本步骤,例如CANNLab默认已提供最新商发版CANN对应的源码 。
git clone -b ${tag_version} https://gitcode.com/cann/ops-transformer.git
📖学习教程
💬相关信息
PS:本项目功能和文档正在持续更新和完善中,欢迎您关注最新版本。