OpPlugin of Ascend Extension for PyTorch
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[docs]add PR notes info Co-authored-by: liangsongwei<liangsongwei@huawei.com> # message auto-generated for no-merge-commit merge: !4253 merge master into master [docs]add PR notes info Created-by: liangsongwei Commit-by: liangsongwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [x] 资料更新 # 【修改方案】 一是要求必须关联社区issue链接; 二是禁止填写需求链接、问题单等内部流程信息。 该修改通过直接更新模板文件生效,不涉及任何代码逻辑变更。 # 【资料变更】 PR提交模板信息补充 # 【接口变更】 不涉及 # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!4253 | 6 个月前 | |
Fix fmt update error Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !5296 merge master_ci into master Fix fmt update error Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】  三方代码仓损坏,这里新改为完成clone,不阻塞CI流程。后续联系仓库管理员修复。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 不涉及 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5296 | 2 个月前 | |
fix npu_rotate_quant bugs and test case Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !5438 merge master into master fix npu_rotate_quant bugs and test case Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [x] 资料更新 # 【修改方案】 is_mx_type 仅与 c10_npu::DType 的值(291/292/296)进行比较,但 torch.float8_e5m2和torch.float8_e4m3fn传入的是 at::ScalarType 的值(23和26)。由于这23/26不等于 291/292,因此 is_mx_type = false → 缩放比例输出(scale)被错误地分配为 ACL_FLOAT。 修复方案:将 dst_dtype_val 统一归一化为 aclDataType,这样两套枚举系统都能被统一处理。c10_npu::GetAclDataType 已经处理了这两种情况(t ≥ 256 → c10_npu::DType;否则 → at::ScalarType)。 # 【资料变更】 对入参的约束做出更清晰的描述,并对A2/A3和A5上的不同约束进行了区分说明 # 【接口变更】 不涉及,此前cann侧已进行变更 # 【功能验证】 A5 atk:  A5 ut:  A2A3 atk:  执行失败的用例为内存超限 A2A3 ut:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5438 | 1 个月前 | |
修改commMode参数资料 Co-authored-by: wuziyu<wuziyu11@huawei.com> # message auto-generated for no-merge-commit merge: !5495 merge master_zl into master 修改commMode参数资料 Created-by: wuziyu Commit-by: wuziyu Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/op-plugin/issues/288 - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [x] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 修改alltoallvquantgmm算子commMode参数描述,去掉支持空字符串 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5495 | 1 个月前 | |
modify document Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com> # message auto-generated for no-merge-commit merge: !5458 merge cherry-pick-mr-5456-1783913093877-auto into master modify document Created-by: m0_68000167 Commit-by: m0_68000167 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单https://gitcode.com/Ascend/pytorch/issues/1880 - [ ] 重构优化 - [x] 资料更新 # 【修改方案】 文件链接修改 # 【资料变更】 涉及 # 【接口变更】 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5458 | 1 个月前 | |
sdpa use component impl when the last dim of input is greater than 256 | 1 个月前 | |
feat: 新增gitleaks敏感信息检测 Co-authored-by: zhoupeng<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !5416 merge gitleaks-master into master feat: 新增gitleaks敏感信息检测 Created-by: thickhair Commit-by: zhoupeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/op-plugin/issues/258 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 引入gitleaks二进制离线扫描工具 新增pre-commit/.gitleaks.toml配置,继承官方全部检测规则 配置pre-commit钩子,提交前自动扫描密钥硬编码风险。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5416 | 1 个月前 | |
sdpa use component impl when the last dim of input is greater than 256 | 1 个月前 | |
compat(v2.14): register v2.14, follow upstream #185272 and #187115 Co-authored-by: chz34<chenhaozhe1@huawei.com> # message auto-generated for no-merge-commit merge: !5388 merge compat/2.14 into master compat(v2.14): register v2.14, follow upstream #185272 and #187115 Created-by: c_34 Commit-by: chz34 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/2578 , https://gitcode.com/Ascend/pytorch/issues/2594 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 针对https://gitcode.com/Ascend/pytorch/issues/2578,临时采用python白名单控制转换,依赖隐式转换实现多版本的兼容。正式方案依赖算子补充.out类型,并参照上游进行meta处理与device处理的解耦,特殊算子依赖950硬件验证,后续单独处理 2. 针对https://gitcode.com/Ascend/pytorch/issues/2594,直接补齐缺省参数,天然兼容历史版本,补齐的参数与原默认参数保持一致。 compat(v2.14): register v2.14, follow upstream #185272 and #187115 Register PyTorch 2.14 as a supported minor across op-plugin's version housekeeping so gencode.sh can produce the v2r14 dispatch tables and VERSION_BETWEEN(...) macros compile in a torch 2.14 build: * op_plugin/utils/Version.h -- add #define V2R14 13 and move VERSION_NEWEST from V2R13 to V2R14. Without this, torch 2.14 builds cause CMakeLists.txt to inject -DCURRENT_VERSION=V2R14, which then fails at preprocessing. * op_plugin/config/op_plugin_functions.yaml + derivatives.yaml -- append v2.14 to the all_version list so gencode.sh generates registration entries for v2.14. * gencode.sh -- bump newest_minor_version=13 to 14 so the test/test_v2r{n}_ops loop covers v2r14. * test/test_v2r14_ops/unsupported_ops_info.yaml -- new stub matching the v2r13 template (the header-only comment file; gencode.sh will prepend test/unsupported_ops_info_base.yaml at build time). Also, follow upstream pytorch#185272 which converted _scaled_mm_v2 into a structured operator (landed 2026-06-15, releasing in 2.14). As a side effect, torchgen switched the C++ binding of the Tensor[] scale_a / scale_b params from at::TensorList to const at::ITensorListRef&, so the wrapper generated in torch_npu's RegisterNPU.cpp on 2.14 no longer matches op_plugin::_scaled_mm_v2, which still expects at::TensorList: * torchnpugen/context.py -- add a small op whitelist that force-enables param_use_ilistref_for_tensor_lists for _scaled_mm_v2 regardless of what op_plugin_functions.yaml says. Codegen output for the four interface files now declares scale_a / scale_b as const at::ITensorListRef&; the other 73 ops that use Tensor[] params are untouched. * op_plugin/ops/opapi/ScaledMmV2KernelNpuOpApi.cpp -- change the handwritten impl signature to match, then materialize the ilist inputs into a local at::TensorList at function entry so the existing body -- ten scale_a[i] indexings, .empty() / .size() checks, matcher_fn pass-through -- needs no further edit. Both directions of the boundary are safe without version gating: * On 2.11-2.13, torch_npu's wrapper still passes at::TensorList; IListRef has an implicit constructor from ArrayRef so it converts transparently to const ITensorListRef&. * On 2.14, torch_npu's wrapper passes const at::ITensorListRef& directly and the types match. Follow upstream pytorch#187115, which dropped the includeBool=false default on at::isIntegralType(t): all such callsites in MatmulAllReduceBaseKernelNpuOpApi.cpp, RangeKernelNpuOpApi.cpp, OpUtils.cpp and ScalarOpApi.cpp now pass the second argument explicitly to compile on both 2.13 and 2.14. Users must rerun gencode.sh <version> python3 to regenerate the four untracked interface files after this change; the source-tracked change alone is not enough for a working build. Independent follow-up (not in this commit): upstream 2.14 deprecates c10::value_or_else in favor of std::optional::value_or; op_plugin emits many warnings but no errors. See docs/issue_scaled_mm_v2_structured.md. # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 兼容性修改,依赖历史测试用例 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5388 | 1 个月前 | |
Add static code check and support pre-commit Co-authored-by: root<Jingwei Huang> # message auto-generated for no-merge-commit merge: !4793 merge code-check into master Add static code check and support pre-commit Created-by: huangjingwei Commit-by: root Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 对接PUD静态检查工具和规则。支持pre-commit。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 直接运行pre-commit命令:  git cherry-pick 或 git commit 自动运行代码静态检查:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!4793 | 4 个月前 | |
init submodule | 3 年前 | |
feat: 新增gitleaks敏感信息检测 Co-authored-by: zhoupeng<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !5416 merge gitleaks-master into master feat: 新增gitleaks敏感信息检测 Created-by: thickhair Commit-by: zhoupeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/op-plugin/issues/258 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 引入gitleaks二进制离线扫描工具 新增pre-commit/.gitleaks.toml配置,继承官方全部检测规则 配置pre-commit钩子,提交前自动扫描密钥硬编码风险。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5416 | 1 个月前 | |
Add static code check and support pre-commit Co-authored-by: root<Jingwei Huang> # message auto-generated for no-merge-commit merge: !4793 merge code-check into master Add static code check and support pre-commit Created-by: huangjingwei Commit-by: root Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 对接PUD静态检查工具和规则。支持pre-commit。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 直接运行pre-commit命令:  git cherry-pick 或 git commit 自动运行代码静态检查:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!4793 | 4 个月前 | |
update LICENSE. Signed-off-by: weili10 <liwei386@huawei.com> | 2 年前 | |
Update URL (gitcode) Co-authored-by: dilililiwhy<why.wuhuanyu@huawei.com> # message auto-generated for no-merge-commit merge: merge update_url into master Update URL (gitcode) Created-by: dilililiwhy Commit-by: dilililiwhy Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Special notes for your reviewers**: See merge request: Ascend/op-plugin!3165 | 11 个月前 | |
modify document Co-authored-by: molly123321<malei54@h-partners.com> # message auto-generated for no-merge-commit merge: !4914 merge master into master modify document Created-by: molly123321 Commit-by: molly123321 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单https://gitcode.com/Ascend/pytorch/issues/1874 - [ ] 重构优化 - [x] 资料更新 # 【修改方案】 刷新相关配套信息 # 【资料变更】 刷新相关配套信息 # 【接口变更】 “不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!4914 | 3 个月前 | |
[Fix] Fix static check errors by the end-of-file fixer Co-authored-by: zhoupeng<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !5077 merge op_end-of-file-fixer into master [Fix] Fix static check errors by the end-of-file fixer Created-by: thickhair Commit-by: zhoupeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/op-plugin/issues/129 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 修改pre-commit-config.yaml,开启end-of-file-fixer检查,使用pre-commit进行检查和修复 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5077 | 2 个月前 | |
compat(v2.14): register v2.14, follow upstream #185272 and #187115 Co-authored-by: chz34<chenhaozhe1@huawei.com> # message auto-generated for no-merge-commit merge: !5388 merge compat/2.14 into master compat(v2.14): register v2.14, follow upstream #185272 and #187115 Created-by: c_34 Commit-by: chz34 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/2578 , https://gitcode.com/Ascend/pytorch/issues/2594 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 针对https://gitcode.com/Ascend/pytorch/issues/2578,临时采用python白名单控制转换,依赖隐式转换实现多版本的兼容。正式方案依赖算子补充.out类型,并参照上游进行meta处理与device处理的解耦,特殊算子依赖950硬件验证,后续单独处理 2. 针对https://gitcode.com/Ascend/pytorch/issues/2594,直接补齐缺省参数,天然兼容历史版本,补齐的参数与原默认参数保持一致。 compat(v2.14): register v2.14, follow upstream #185272 and #187115 Register PyTorch 2.14 as a supported minor across op-plugin's version housekeeping so gencode.sh can produce the v2r14 dispatch tables and VERSION_BETWEEN(...) macros compile in a torch 2.14 build: * op_plugin/utils/Version.h -- add #define V2R14 13 and move VERSION_NEWEST from V2R13 to V2R14. Without this, torch 2.14 builds cause CMakeLists.txt to inject -DCURRENT_VERSION=V2R14, which then fails at preprocessing. * op_plugin/config/op_plugin_functions.yaml + derivatives.yaml -- append v2.14 to the all_version list so gencode.sh generates registration entries for v2.14. * gencode.sh -- bump newest_minor_version=13 to 14 so the test/test_v2r{n}_ops loop covers v2r14. * test/test_v2r14_ops/unsupported_ops_info.yaml -- new stub matching the v2r13 template (the header-only comment file; gencode.sh will prepend test/unsupported_ops_info_base.yaml at build time). Also, follow upstream pytorch#185272 which converted _scaled_mm_v2 into a structured operator (landed 2026-06-15, releasing in 2.14). As a side effect, torchgen switched the C++ binding of the Tensor[] scale_a / scale_b params from at::TensorList to const at::ITensorListRef&, so the wrapper generated in torch_npu's RegisterNPU.cpp on 2.14 no longer matches op_plugin::_scaled_mm_v2, which still expects at::TensorList: * torchnpugen/context.py -- add a small op whitelist that force-enables param_use_ilistref_for_tensor_lists for _scaled_mm_v2 regardless of what op_plugin_functions.yaml says. Codegen output for the four interface files now declares scale_a / scale_b as const at::ITensorListRef&; the other 73 ops that use Tensor[] params are untouched. * op_plugin/ops/opapi/ScaledMmV2KernelNpuOpApi.cpp -- change the handwritten impl signature to match, then materialize the ilist inputs into a local at::TensorList at function entry so the existing body -- ten scale_a[i] indexings, .empty() / .size() checks, matcher_fn pass-through -- needs no further edit. Both directions of the boundary are safe without version gating: * On 2.11-2.13, torch_npu's wrapper still passes at::TensorList; IListRef has an implicit constructor from ArrayRef so it converts transparently to const ITensorListRef&. * On 2.14, torch_npu's wrapper passes const at::ITensorListRef& directly and the types match. Follow upstream pytorch#187115, which dropped the includeBool=false default on at::isIntegralType(t): all such callsites in MatmulAllReduceBaseKernelNpuOpApi.cpp, RangeKernelNpuOpApi.cpp, OpUtils.cpp and ScalarOpApi.cpp now pass the second argument explicitly to compile on both 2.13 and 2.14. Users must rerun gencode.sh <version> python3 to regenerate the four untracked interface files after this change; the source-tracked change alone is not enough for a working build. Independent follow-up (not in this commit): upstream 2.14 deprecates c10::value_or_else in favor of std::optional::value_or; op_plugin emits many warnings but no errors. See docs/issue_scaled_mm_v2_structured.md. # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 兼容性修改,依赖历史测试用例 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/op-plugin!5388 | 1 个月前 |
OpPlugin
简介
本项目开发了Ascend Extension for Pytorch(torch_npu)算子插件,为使用PyTorch框架的开发者提供便捷的NPU算子库调用能力。 OpPlugin算子插件的编译、使用依赖昇腾Ascend Extension for PyTorch。因此,在编译OpPlugin之前,需要了解、安装昇腾PyTorch。使用手册可参考昇腾社区Ascend Extension for Pytorch。
目录结构
关键目录如下:
├─docs # 文档目录
├─ci # 自动化构建与测试脚本目录
├─op_plugin # 项目核心目录
│ ├─config # 配置管理目录
│ ├─ops # 算子实现目录
│ ├─python # python绑定目录
├─codegen # 代码生成目录
├─examples # 示例目录
└─test # 测试目录
版本配套表
op-plugin仓旨在为torch_npu提供运行所需要的算子适配文件,两个仓的对应关系如下:
| op-plugin分支 | 对应Ascend Extension for PyTorch版本 |
|---|---|
| master | 主线版本,如v2.7.1等 |
| 26.0.0 | 26.0.0版本,如v2.7.1-26.0.0等 |
| 7.3.0 | 7.3.0版本,如v2.7.1-7.3.0等 |
| 7.2.0 | 7.2.0版本,如v2.7.1-7.2.0等 |
| 7.1.0 | 7.1.0版本,如v2.1.0-7.1.0等 |
| 7.0.0 | 7.0.0版本,如v2.1.0-7.0.0等 |
| 6.0.0 | 6.0.0版本,如v2.1.0-6.0.0等 |
| 6.0.rc3 | 6.0.rc3版本,如v2.1.0-6.0.rc3等 |
| 6.0.rc2 | 6.0.rc2版本,如v2.1.0-6.0.rc2等 |
| 6.0.rc1 | 6.0.rc1版本,如v2.1.0-6.0.rc1等 |
| 5.0.0 | 5.0.0版本,如v2.1.0-5.0.0等 |
| 5.0.rc3 | 5.0.rc3版本,如v2.1.0-5.0.rc3等 |
安装OpPlugin
支持通过源码编译的方式安装OpPlugin。具体操作,请参考安装OpPlugin。
快速入门
提供了一个通过OpPlugin插件实现PyTorch调用Ascend C自定义算子的完整开发指南,涵盖了从环境配置、算子注册、适配实现到测试验证提供了全流程说明。具体操作,请参考调用样例。
API参考
基于PyTorch2.10.0/2.9.0/2.8.0/2.7.1版本,提供Ascend Extension for PyTorch自定义API的功能说明、函数原型、参数说明与调用示例等。具体信息,请参考自定义API参考。
生命周期
op-plugin仓依赖torch_npu运行,生命周期请参考torch_npu中的PyTorch版本维护策略。
贡献指导
介绍如何向OpPlugin仓库贡献代码,具体请参见贡献指南。
联系我们
如果有任何疑问或建议,请提交GitCode Issues,我们会尽快回复。感谢您的支持。
安全声明
主要描述了OpPlugin的安全加固信息、公网地址信息及通信矩阵等内容。具体介绍,请参考OpPlugin安全声明。
免责声明
致OpPlugin插件使用者
-
本插件仅供调试和开发使用,使用者需自行承担使用风险,并理解以下内容:
- 数据处理及删除:用户在使用本插件过程中产生的数据属于用户责任范畴。建议用户在使用完毕后及时删除相关数据,以防信息泄露。
- 数据保密与传播:使用者了解并同意不得将通过本插件产生的数据随意外发或传播。对于由此产生的信息泄露、数据泄露或其他不良后果,本插件及其开发者概不负责。
- 用户输入安全性:用户需自行保证输入的命令行的安全性,并承担因输入不当而导致的任何安全风险或损失。对于输入命令行不当所导致的问题,本插件及其开发者概不负责。
-
免责声明范围:本免责声明适用于所有使用本插件的个人或实体。使用本插件即表示您同意并接受本声明的内容,并愿意承担因使用该功能而产生的风险和责任,如有异议请停止使用本插件。
-
在使用本工具之前,请谨慎阅读并理解以上免责声明的内容。对于使用本插件所产生的任何问题或疑问,请及时联系开发者。
License
OpPlugin的使用许可证,详见LICENSE。
致谢
感谢来自社区的每一个PR,欢迎贡献Ascend Extension for TensorPipe插件!