| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
compat(v2.13): reintroduce csrc compat module for upstream 2.13 Co-authored-by: chz34<chenhaozhe1@huawei.com> # message auto-generated for no-merge-commit merge: !39206 merge compat/2.13_ori into master compat(v2.13): reintroduce csrc compat module for upstream 2.13 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> pytorch 上游重构修改,将 shared_ptr<Node> 重构为 intrusive_ptr<Node>,主线适配上游main分支编译报错 https://github.com/pytorch/pytorch/pull/181782 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1812 https://gitcode.com/Ascend/pytorch/issues/2497 https://gitcode.com/Ascend/pytorch/issues/2508 - [x] 重构优化 https://gitcode.com/Ascend/pytorch/issues/1688 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) compat(v2.13): reintroduce csrc compat module for upstream 2.13 C++ side (torch_npu/csrc/_compat/): - version.h: TORCH_NPU_VERSION_GE(MAJOR, MINOR) macro plus TORCH_NPU_MIN_SUPPORTED constants kept in sync with the Python side. - autograd.h: torch_npu::compat::GradFnPtr<T> alias and make_grad_fn<Op>(args...) wrap the Node smart pointer migration from std::shared_ptr+deleteNode (<=2.12) to c10::intrusive_ptr+make_intrusive (>=2.13, pytorch#181782). SavedForPtr covers SavedVariable::unpack's parameter type change. Hand-written C++ updated to use the alias: - VariableFallbackKernel.cpp, VariableTypeManual.cpp (grad_fn locals) - reducer.hpp (grad_accumulators_ and hooks_ element types) - torchnpugen/autograd/templates/Functions.h (unpack_list/unpack_opt_list saved_for parameter) Python side (torch_npu/_compat/utils.py): - make_config_entry(config, *, name) wraps _ConfigEntry which gained a required name parameter in PyTorch 2.12. _dynamo.patch_inductor_wrapper uses the helper instead of branching inline. torchgen's packaged emit_body and gen_autograd_functions were updated upstream alongside pytorch#181782, so no codegen post-processing is needed -- only the hand-written sources need the compat aliases. # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 基于现有用例 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39206 | 1 个月前 | |
support strutured meta Co-authored-by: maoyuanpeng<maoyuanpeng@huawei.com> # message auto-generated for no-merge-commit merge: !36640 merge br_support_structure_ops_master into master support strutured meta Created-by: maoyuanpeng1 Commit-by: maoyuanpeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/2110 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36640 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
[feat] exposed customed api Co-authored-by: chenshuai<chenshuai81@huawei.com> # message auto-generated for no-merge-commit merge: !31346 merge feat_34 into master [feat] exposed customed api Created-by: culechan Commit-by: chenshuai Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 对自定义算子做暴露处理 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!31346 | 5 个月前 | |
fix: avoid quantized flip registration for aclnn extensions Co-authored-by: hz893<zhanghao491@huawei.com> # message auto-generated for no-merge-commit merge: !38786 merge fix_aclnn_quantized_flip_codegen_master into master fix: avoid quantized flip registration for aclnn extensions Created-by: hz893 Commit-by: hz893 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font> > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 https://gitcode.com/Ascend/pytorch/issues/2428 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. 将 QuantizedRegister 的 header 和 extra impl 注册从静态配置改为 helper 构造。 2. 当 ACLNN_EXTENSION_SWITCH 置位时,判定当前为外部 ACLNN extension codegen 场景,不生成 https://gitcode.com/Ascend/pytorch/pull/36068/commit 引入的 QuantizedFlipKernelNpu.h include 和 m.impl("flip", TORCH_FN(at_npu::native::quantized_flip)); 注册。 3. 当 ACLNN_EXTENSION_SWITCH 未置位时,保留原有 torch_npu 自身 quantized NPU flip dispatch 行为不变。 4. 采用 ACLNN_EXTENSION_SWITCH 的原因:现有 torchnpugen/op-plugin/autograd/custom 相关 codegen 已使用该变量标识 ACLNN extension 客户扩展生成场景,fla_npu 的 gen.sh 也会设置该变量。复用现有开关可以只影响外部扩展生成,避免新增重复环境变量,同时不改变 torch_npu 自身 codegen 默认行为。 # 【资料变更】 不涉及。 # 【接口变更】 不涉及。 # 【功能验证】 目标分支:v2.7.1 1. 生成器轻量验证通过: - python3 -m py_compile torchnpugen/gen_backend_stubs.py - git diff --check -- torchnpugen/gen_backend_stubs.py - ACLNN_EXTENSION_SWITCH=TRUE 时,QuantizedRegister 配置不包含 QuantizedFlipKernelNpu/quantized_flip - ACLNN_EXTENSION_SWITCH 未设置时,QuantizedRegister 配置保留 QuantizedFlipKernelNpu/quantized_flip 2. 代码检查:lintrunner torchnpugen/gen_backend_stubs.py 通过。 3. fla_npu 回归验证:基于 flash-linear-attention-npu v26.1.0,在 v2.7.1 环境使用修复后的 torch_npu codegen 重新生成并编译 fla_npu,生成的 QuantizedRegister.cpp 不再包含 QuantizedFlipKernelNpu/quantized_flip;python setup.py bdist_wheel、pip install dist/fla_npu*.whl --force-reinstall --no-deps、import torch_npu; import fla_npu 均通过。 4. 补齐 ct 测试依赖后,cd torch_custom/fla_npu/test && bash test.sh 通过,结果 PASSED (9)、FAILED (0)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38786 | 2 个月前 | |
[feature] add torchnpugen packages Co-authored-by: liangsongwei<liangsongwei@huawei.com> # message auto-generated for no-merge-commit merge: !30021 merge master into master [feature] add torchnpugen packages Created-by: liangsongwei Commit-by: liangsongwei 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**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!30021 | 6 个月前 | |
add npu_nosupported_ops: _scaled_mm and _scaled_grouped_mm Co-authored-by: wencaiwen<caiwen13@huawei.com> # message auto-generated for no-merge-commit merge: !36980 merge master into master add npu_nosupported_ops: _scaled_mm and _scaled_grouped_mm Created-by: wencaiwen Commit-by: wencaiwen Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 关联issue:https://gitcode.com/Ascend/pytorch/issues/2147 在torchnpugen/gen_npu_c_shim.py中增加 npu_nosupported_ops(需要新增对齐torch原生的算子:_scaled_mm&_scaled_grouped_mm)即可绕过 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 在本地编译通过 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36980 | 2 个月前 | |
fix structured ops codegen Co-authored-by: maoyuanpeng<maoyuanpeng@huawei.com> # message auto-generated for no-merge-commit merge: !37198 merge br_fix_structured_ops_codegen_master into master fix structured ops codegen Created-by: maoyuanpeng1 Commit-by: maoyuanpeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/2187 https://gitcode.com/Ascend/pytorch/issues/2110 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 该问题为PTA支持structured算子代码合入之后出现,直接原因是cat算子的输入tensor device id 为1,但是全局device id未被设置为1,仍然为0。 解决方案: 按照原生pytorch structured算子类似方法,在 structured_xxx_out_functional/ structured_xxx_out_out 等类中的set_output_strided和set_output_raw_strided方法中添加 device_guard。将遗漏的tensor_data_unsafe check和NPURecordFunction guard一并添加。 修改之前cat算子的注册函数wrapper_NPU_cat: struct structured_cat_out_functional final : public at_npu::native::structured_cat_out { void set_output_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { xxx } void set_output_raw_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { xxx } xxx }; at::Tensor wrapper_NPU_cat(const at::ITensorListRef & tensors, int64_t dim) { c10::optional<at::Device> common_device = at::nullopt; (void)common_device; // Suppress unused variable warning c10::impl::check_and_update_common_device(common_device, tensors, "wrapper_NPU_cat", "tensors"); const bool op_hook_enabled = C10_UNLIKELY(at_npu::native::env::CheckOpHookEnable()); if (op_hook_enabled) { at_npu::native::OpHook::GetInstance().PreHook("cat", tensors, dim); } structured_cat_out_functional op; op.meta(tensors, dim); op.impl(tensors, dim, op.outputs_[0]); auto op_hook_result = std::move(op.outputs_[0]); if (op_hook_enabled) { at_npu::native::OpHook::GetInstance().PostHook(op_hook_result); } return op_hook_result; } 修改之后cat算子的注册函数wrapper_NPU_cat: struct structured_cat_out_functional final : public at_npu::native::structured_cat_out { void set_output_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { auto current_device = guard_.current_device(); if (C10_UNLIKELY(current_device.has_value())) { TORCH_INTERNAL_ASSERT(*current_device == options.device(), "structured kernels don't support multi-device outputs"); } else { guard_.reset_device(options.device()); // 增加device_guard } xxx } void set_output_raw_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { auto current_device = guard_.current_device(); if (C10_UNLIKELY(current_device.has_value())) { TORCH_INTERNAL_ASSERT(*current_device == options.device(), "structured kernels don't support multi-device outputs"); } else { guard_.reset_device(options.device()); // 增加device_guard } xxx } xxx }; at::Tensor wrapper_NPU_cat(const at::ITensorListRef & tensors, int64_t dim) { c10::optional<at::Device> common_device = at::nullopt; (void)common_device; // Suppress unused variable warning c10::impl::check_and_update_common_device(common_device, tensors, "wrapper_NPU_cat", "tensors"); if (c10_npu::get_npu_data_unsafe_flag()) { // 补充了data_unsafe_check c10_npu::check_npu_tensor_is_safe(tensors); } #ifndef BUILD_LIBTORCH torch_npu::profiler::NPURecordFunction guard; // 补充了data_unsafe_check #endif const bool op_hook_enabled = C10_UNLIKELY(at_npu::native::env::CheckOpHookEnable()); if (op_hook_enabled) { at_npu::native::OpHook::GetInstance().PreHook("cat", tensors, dim); } structured_cat_out_functional op; op.meta(tensors, dim); op.impl(tensors, dim, op.outputs_[0]); auto op_hook_result = std::move(op.outputs_[0]); if (op_hook_enabled) { at_npu::native::OpHook::GetInstance().PostHook(op_hook_result); } return op_hook_result; } 原生pytorch cuda cat算子的注册函数wrapper_CUDA_cat: struct structured_cat_out_cuda_functional final : public at::native::structured_cat_out_cuda { void set_output_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { auto current_device = guard_.current_device(); if (C10_UNLIKELY(current_device.has_value())) { TORCH_INTERNAL_ASSERT(*current_device == options.device(), "structured kernels don't support multi-device outputs"); } else { guard_.reset_device(options.device()); } outputs_[output_idx] = create_out(sizes, strides, options); if (!names.empty()) { namedinference::propagate_names(outputs_[output_idx], names); } // super must happen after, so that downstream can use maybe_get_output // to retrieve the output } void set_output_raw_strided( int64_t output_idx, IntArrayRef sizes, IntArrayRef strides, TensorOptions options, DimnameList names ) override { auto current_device = guard_.current_device(); if (C10_UNLIKELY(current_device.has_value())) { TORCH_INTERNAL_ASSERT(*current_device == options.device(), "structured kernels don't support multi-device outputs"); } else { guard_.reset_device(options.device()); } outputs_[output_idx] = create_out(sizes, strides, options); if (!names.empty()) { namedinference::propagate_names(outputs_[output_idx], names); } // super must happen after, so that downstream can use maybe_get_output // to retrieve the output } const Tensor& maybe_get_output(int64_t output_idx) override { return outputs_[output_idx]; } std::array<Tensor, 1> outputs_; c10::cuda::OptionalCUDAGuard guard_; }; at::Tensor wrapper_CUDA_cat(const at::ITensorListRef & tensors, int64_t dim) { std::optional<Device> common_device = std::nullopt; (void)common_device; // Suppress unused variable warning c10::impl::check_and_update_common_device(common_device, tensors, "wrapper_CUDA_cat", "tensors"); structured_cat_out_cuda_functional op; auto precompute = op.meta(tensors, dim); (void)precompute; op.impl(tensors, precompute.dim, precompute.valid, precompute.all_contiguous, precompute.all_same_dtype, precompute.all_same_sizes_and_stride, precompute.memory_format, op.outputs_[0]); return std::move(op.outputs_[0]); } # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 问题单中的脚本已测试通过。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!37198 | 2 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 5 个月前 | ||
| 2 个月前 | ||
| 6 个月前 | ||
| 2 个月前 | ||
| 2 个月前 |