| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
fix: fix npugrphs backend bug and add indexput test case Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !31724 merge Pta_add_index_put_test_case_v2.7.1 into v2.7.1 fix: fix npugrphs backend bug and add indexput test case Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. **修复 patch_get_first_incompatible_cudagraph_node monkey patch 不生效的问题**(torch_npu/_inductor/utils.py): - 去除 compile_fx 和 cudagraphs 模块 patch 时的 hasattr 条件判断,改为直接赋值覆盖,因为 torch_npu 与 torch 是固定版本匹配的,不需要兼容性判断 - 新增对 torch_npu.utils._graph_tree 模块的 patch:该模块通过 from torch._inductor.utils import get_first_incompatible_cudagraph_node 拿走了原始引用,必须显式覆盖该模块命名空间中的引用,否则 npugraphs 后端无法正确检测 cudagraph-unsafe 算子 2. **修复 _graph_tree.py 中的代码格式问题**(torch_npu/npu/_graph_tree.py): - 清理行尾多余空格 3. **新增 ACL graph 特殊算子的测试用例**(test_acl_graph_special_op.py): - test_masked_assign_forward:验证 tensor[bool_mask] = -1(aten.index_put_ with bool indices)在 inductor 后端 cudagraphs 模式下被正确检测为 cudagraph-unsafe 并回退到 eager 执行,支持 float32/float16 参数化测试 - test_masked_assign_forward_backward:验证包含 bool index_put 的前向+反向传播在 inductor 后端下的正确性 - test_npugraphs_masked_assign_forward:同上,使用 npugraphs 后端验证 - test_npugraphs_masked_assign_forward_backward:同上,使用 npugraphs 后端验证前向输出和梯度正确性 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已新增 UT 测试用例 test_acl_graph_special_op.py,覆盖以下场景: - **inductor 后端 + cudagraphs**:bool index_put 前向(float32/float16)、前向+反向 - **npugraphs 后端**:bool index_put 前向(float32/float16)、前向+反向 - 测试方法:torch.compile 编译后与 eager 模式对比输出和梯度一致性 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!31724 | 4 个月前 | |
[fix] support memory reuse in launch_host_func_pending Co-authored-by: Chukun Wang<wangchukun@huawei.com> # message auto-generated for no-merge-commit merge: !36054 merge v2.7.1 into v2.7.1 [fix] support memory reuse in launch_host_func_pending Created-by: kita-ikuyo Commit-by: Chukun Wang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2009 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) launch_host_func_pending由直接传递Tensor改为传递tensor地址,由callback thread根据地址做h2h拷贝,拷贝结束后原始tensor的pinned memory可以被释放并复用。回调线程/python线程使用被拷贝的tensor值做后续print/save,并在print/save结束后释放内存,以节省运行时host内存使用。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 验证ok,修改前整网出现host oom,修改后解决。  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36054 | 2 个月前 | |
[fix][v2.7.1]aclgraph testcase add 910C support Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !31718 merge v2.7.1_acltest into v2.7.1 [fix][v2.7.1]aclgraph testcase add 910C support Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] 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!31718 | 5 个月前 | |
fix: fix task queue aclgraph bug Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !32804 merge Pynative_fix_task_queue_aclgraph_bug_add_wait_stream_status_20260327_v2.7.1 into v2.7.1 fix: fix task queue aclgraph bug Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. **NPUCachingAllocator.h/cpp**:新增 hasCapturesUnderway(device) 接口,用于查询当前设备是否有正在进行的 ACLGraph capture。在 DeviceCachingAllocator 中加锁读取 captures_underway 容器是否为空;在 NpuCachingAllocator 顶层类中实现 override 并转发到对应 device allocator;在头文件中新增 inline 辅助函数 hasCapturesUnderway(device) 供外部调用。 2. **NPUEvent.cpp**:在 NPUEvent::block() 函数中,LaunchWaitEventTask 之后增加判断:若当前设备处于 ACLGraph capture 状态(hasCapturesUnderway 返回 true),则调用 emptyAllNPUStream() 刷新 task queue。修复了多流场景下(主流与旁路流通过 wait_stream 交互时)capture replay 结果不正确的问题。 3. **test/npu/test_aclgraph_multi_stream.py**:新增多流 ACLGraph 正确性测试,覆盖两种场景:shared-expert 旁路流 fork/join 模式、并行分支 fork/join 模式,验证 replay 后数值结果与 eager 模式一致。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 新增内部接口 NPUCachingAllocator::hasCapturesUnderway(c10::DeviceIndex device),为 NPU allocator 虚函数扩展,不属于对外客户面 API,不涉及跨仓接口变更。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增测试文件 test/npu/test_aclgraph_multi_stream.py,包含以下用例: - test_shared_expert_stream_capture_replay:验证 shared-expert 旁路流模式下 capture/replay 数值正确性 - test_parallel_branch_capture_replay:验证并行分支 fork-join 模式下 capture/replay 数值正确性 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32804 | 4 个月前 | |
【feat】新增第三批sk_options并更新autofusion commit id Co-authored-by: wangkai<wangkai579@huawei.com> # message auto-generated for no-merge-commit merge: !36331 merge v2.7.1_sk2 into v2.7.1 【feat】新增第三批sk_options并更新autofusion commit id Created-by: mihudan Commit-by: wangkai 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/2004 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图  已增加测试用例,出包 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36331 | 2 个月前 | |
[fix][v2.7.1]aclgraph testcase add 910C support Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !31718 merge v2.7.1_acltest into v2.7.1 [fix][v2.7.1]aclgraph testcase add 910C support Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] 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!31718 | 5 个月前 | |
[Feature] generate aligned trace in NPUGraph debug dump Co-authored-by: ChengLyric<licheng236@huawei.com> # message auto-generated for no-merge-commit merge: !43288 merge feat/npugraph-debug-dump-aligned-v2.7.1 into v2.7.1 [Feature] generate aligned trace in NPUGraph debug dump Created-by: LyriCheng Commit-by: ChengLyric 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能力等内容) - 在 NPUGraph.debug_dump() 成功生成新的原始 JSON 后,额外生成 *.aligned.json。 - 对齐处理仅调整可视化时间轴,不修改原始 JSON。 - 对齐失败仅打印 warning,不影响原始 debug_dump() 返回或原始文件。 - 未成功 capture 或未生成新 dump 时,跳过对齐处理,避免处理旧文件。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 自验证ok # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!43288 | 14 天前 | |
feat: Add ACLGraph update plans Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !36821 merge Pynative_refactor_aclgraph_update_20260519_2.7.1 into v2.7.1 feat: Add ACLGraph update plans Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2338 (https://gitcode.com/Ascend/pytorch/issues/2338) - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 新增 torch_npu._inductor.aclgraph_update_plan 模块,在 Inductor codegen 阶段生成 ACLGraph update plan,并在运行期根据 callable 属性解析 new_inputs 到 FA 类算子 actual sequence 参数的映射。 2. 在 NPU Python wrapper、MLIR/DVM wrapper、graph partition 子图 wrapper 中挂载 plan,支持 graph partition 开关下分别写入 call 或 partition_x 函数属性。 3. 在 _graph_tree record/replay 路径消费 update plan,record 后校验 plan 与真实 capture record 的顺序、算子名和可更新 key,replay 前解析为 CPU update input。 4. 将 IFA/IFA v2/FA3 等 npugraph handler 的 actual sequence 更新点改为 UPDATE_SPECS 声明式描述,并由 base handler 统一更新 args/kwargs。 5. 补充 plan 构建、plan 解析、handler 注册、wrapper emit、npugraphify callable 属性保持等单元测试,替换旧的集中测试文件。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及对外资料变更。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见 API 变更;新增 torch_npu._inductor.aclgraph_update_plan 为内部编译与 ACLGraph 运行期协同模块。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已补充并验证以下单测: 1. test/npu/test_aclgraph_update_plan.py 覆盖 plan 构建、输入映射、常量解析、非法 plan 校验。 2. test/npu/test_npugraph_handler.py 覆盖 IFA/IFA v2 handler 的 UPDATE_SPECS 注册。 3. test/_inductor/test_aclgraph_update_plan_compile.py 覆盖 wrapper/graph partition emit、MLIR/DVM wrapper、npugraphify callable 属性保持等非设备单测。 4. 多版本迁移后已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 分支通过静态检查和不涉及设备的单测验证。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36821 | 2 个月前 | |
[fix]multi_stream_lazy_reclaim coredump error Co-authored-by: xuyun15<xuyun15@huawei.com> # message auto-generated for no-merge-commit merge: !42370 merge fix_multi_stream_lazy_reclaim_v2.7.1 into v2.7.1 [fix]multi_stream_lazy_reclaim coredump error Created-by: xuyun15 Commit-by: xuyun15 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 选取issue中方案2作为解决方案 ### 方案2:将 sum > kLazyQuerySize 的 process_events 移到 get_free_block 之前(推荐) 将 sum > kLazyQuerySize 触发的 process_events() 移到 get_free_block 之前,保持与原生 PyTorch 相同的安全时序。同时引入 reaped 变量避免 process_events() 的冗余二次调用。 #### 2.1 process_events() 二次调用问题分析 方案2将 process_events() 的调用拆分为两段: 1. **第一段**:sum > kLazyQuerySize 时在 get_free_block 之前调用 2. **第二段**:!block_found 时在 get_free_block 之后调用 当 sum > kLazyQuerySize 且 get_free_block() 仍然失败时,两段都会触发 process_events(),导致**同一轮 malloc() 中 process_events() 被调用两次**。 # 【资料变更】 不涉及:当前pr不涉及,但是后续会持续跟踪搜集用户诉求,逐步补齐对应的资料和用例 # 【接口变更】 不涉及 # 【功能验证】 修复前:  修复后:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42370 | 28 天前 | |
| 1 年前 | ||
Support allocator trace tracker in NPU caching allocator Co-authored-by: zzhongmin<zhongmin23@huawei.com> # message auto-generated for no-merge-commit merge: !38691 merge v2.7.1_tratra into v2.7.1 Support allocator trace tracker in NPU caching allocator Created-by: zzhongmin Commit-by: zzhongmin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 将 NPU Caching Allocator 对齐到上游 CUDA 实现,补齐 Allocator Trace Tracker 回调机制。v2.7.1 分支的 NPU 侧尚未引入 mempool ID 直接存储等重构,本次仅对齐 attachAllocatorTraceTracker 核心功能,不涉及 mempool 相关改动。 1. 新增 AllocatorTraceTracker 回调机制(NPUCachingAllocator.h + .cpp) - 新增 AllocatorTraceTracker 类型、虚方法、trace_trackers_ 成员、公共接口层转发及便捷函数,与 CUDA 接口对齐 2. record_trace 支持 tracker 回调分发(NPUCachingAllocator.cpp) - 入口条件改为 !record_history && trace_trackers_.empty(),构造 TraceEntry 后遍历 trace_trackers_ 调用回调 3. NPUPluggableAllocator 补齐接口(NPUPluggableAllocator.h + .cpp) - 新增 attachAllocatorTraceTracker override,TORCH_CHECK(false) 拒绝调用 4. 新增测试 - C++ 扩展注册回调统计 SEGMENT_ALLOC/FREE 事件,Python 测试验证两种场景下回调正确触发 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 test/npu/test_allocator_trace_tracker.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38691 | 1 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[2.7.1]fix aoe ut Co-authored-by: DaiFu<daifu2@huawei.com> # message auto-generated for no-merge-commit merge: !27467 merge v2.7.1 into v2.7.1 [2.7.1]fix aoe ut Created-by: daifu1234567 Commit-by: DaiFu 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 **What does this PR do / why do we need it**: 需要走aclop才会有aoe的dump图,现在conv2d需要切aclnn,所以用例并不会保存aoe图。 **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!27467 | 8 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
fix ut Co-authored-by: DaiFu<daifu2@huawei.com> # message auto-generated for no-merge-commit merge: merge v2.7.1 into v2.7.1 fix ut Created-by: daifu1234567 Commit-by: DaiFu Merged-by: ascend-robot Description: fix test_binary_cross_with_logits_float16 by setting random seed See merge request: Ascend/pytorch!25305 | 10 个月前 | |
Revert "fix: fix aclnn npu_format_cast to respect allow_internal_format=False" Co-authored-by: wangzili<wangzili14@huawei.com> # message auto-generated for no-merge-commit merge: !39259 merge v2.7.1 into v2.7.1 Revert "fix: fix aclnn npu_format_cast to respect allow_internal_format=False" Created-by: wangzili121 Commit-by: wangzili Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 回退 fix aclnn npu_format_cast to respect allow_internal_format=False,删除 npu_format_cast 的 aclnn 路径中对 allow_internal_format 的处理 # 【资料变更】 当前PR不涉及,相应资料已在op-plugin仓呈现 # 【接口变更】 不涉及 # 【功能验证】 UT通过 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39259 | 1 个月前 | |
skip ci error (update cann) Co-authored-by: SCh_zx<1325467101@qq.com> # message auto-generated for no-merge-commit merge: !34621 merge v2.7.1 into v2.7.1 skip ci error (update cann) Created-by: SCh_zx Commit-by: SCh_zx Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 详见关联issue # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34621 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
[v2.7.1][Fix] Fix static check errors detected by TABS Co-authored-by: thickhair<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !37994 merge tabs_fix_2.7.1 into v2.7.1 [v2.7.1][Fix] Fix static check errors detected by TABS Created-by: thickhair Commit-by: thickhair 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/1865 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!37994 | 2 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[test]add ut for native APIs Co-authored-by: mamba_ni<niningxi@huawei.com> # message auto-generated for no-merge-commit merge: !35009 merge v2.7.1 into v2.7.1 [test]add ut for native APIs Created-by: mamba_ni Commit-by: mamba_ni Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1826 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充torch.cuda.get_rng_state_all等17个API的ut用例 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35009 | 3 个月前 | |
[feat] support custom segment_size for expandable_segments Co-authored-by: XDaoHong<xudaohong@huawei.com> # message auto-generated for no-merge-commit merge: !26372 merge v2.7.1 into v2.7.1 [feat] support custom segment_size for expandable_segments Created-by: XDaoHong Commit-by: XDaoHong 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 > feature **What does this PR do / why do we need it**: 虚拟内存管理场景,增加segment_size环境变量,优化集合通信zerocopy内存映射性能 **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!26372 | 9 个月前 | |
add set_deterministic_level Co-authored-by: SCh-zx<1325467101@qq.com> # message auto-generated for no-merge-commit merge: !30382 merge v2.7.1 into v2.7.1 add set_deterministic_level Created-by: SCh_zx Commit-by: SCh-zx 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!30382 | 6 个月前 | |
| 2 年前 | ||
fix torch.randint testcases Co-authored-by: chaijinwei<chaijinwei@huawei.com> # message auto-generated for no-merge-commit merge: !30889 merge random-2.7.1 into v2.7.1 fix torch.randint testcases Created-by: chaijinwei Commit-by: chaijinwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/1547 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. tensor.random_框架测加入了校验逻辑对齐原生torch。torch.randint(-10, 10, (2, ,3 ,4), dtype=uint8)会调用tensor.random_接口,这里传入的-10小于uint8类型最小值0,需要适配用例。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!30889 | 6 个月前 | |
[Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt Co-authored-by: hongwei-2026<feizi_050920@qq.com> # message auto-generated for no-merge-commit merge: !42011 merge adapt-gradcheck-emit-itt-v2.7.1 into v2.7.1 [Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt Created-by: hongwei-2026 Commit-by: hongwei-2026 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联Issue: - https://gitcode.com/Ascend/pytorch/issues/2956 - https://gitcode.com/Ascend/pytorch/issues/2957 # 【修改方案】 本 PR 属于 Torch-NPU API 一致性对齐任务,面向 torch.autograd.gradcheck 与 torch.autograd.profiler.emit_itt 完成 v2.7.1 版本的测试用例补齐。 ## API 功能说明 ### torch.autograd.gradcheck gradcheck(func, inputs, *, eps=1e-6, atol=1e-5, rtol=1e-3, ...) -> bool 通过小有限差分计算数值梯度并与分析梯度比较,验证自动微分实现的正确性。是 PyTorch 官方提供的梯度验证工具函数,默认使用 float64 精度以保证数值稳定性。 ### torch.autograd.profiler.emit_itt emit_itt(enabled=True, record_shapes=False) 上下文管理器,使每个 autograd 操作发出 ITT 范围标注,用于 Intel VTune Profiler 性能分析。 ## 用例完整性说明 ### torch.autograd.gradcheck 经检索 PyTorch 官方仓库(v2.7.1),对 test/ 目录执行了检索: grep -rn "def test.*gradcheck" test/test_autograd.py --include="*.py" 检索结论:PyTorch 官方已包含 test_gradcheck_single_input 等一系列独立聚焦测试用例。 Ascend NPU 不支持 float64 的 linalg.vector_norm、dot、mm、relu 算子,因此 fast_mode 无法直接在 NPU 上运行。按任务文档场景一规范,在 slow_mode 下对 NPU 支持的 float64 运算编写测试用例,覆盖单输入、多输入、返回元组、二阶梯度等场景。 ### torch.autograd.profiler.emit_itt PyTorch 官方在 test/test_autograd.py 中包含 test_profiler_emit_itt 测试用例,带以下装饰器: @unittest.skipIf(not torch.profiler.itt.is_available(), "ITT is required") def test_profiler_emit_itt(self, device): a = torch.tensor([1, 2, 3], dtype=torch.float32, device=device) with emit_itt(): a.add(1.0) Ascend NPU 上 torch.profiler.itt.is_available() 返回 False,用例被自动跳过。 检索结论:上游用例在 NPU 上无法直接运行,需通过 test_upstream patch 适配并新增独立测试。 ## 具体修改内容 本 PR 新增 2 个测试文件,修改 1 个 test_upstream patch:test_upstream/test/test_autograd.py.patch: - test/npu/test_gradcheck.py - test/npu/test_emit_itt.py ### test/npu/test_gradcheck.py(9 个测试方法) | 测试方法 | 覆盖场景 | |---------|---------| | test_gradcheck_slow_mode_mul | 单输入 mul | | test_gradcheck_slow_mode_linear | 线性函数 | | test_gradcheck_slow_mode_sin_cos | sin().cos() | | test_gradcheck_slow_mode_exp | exp() | | test_gradcheck_slow_mode_sum | sum() | | test_gradcheck_slow_mode_multiple_inputs | 多输入 | | test_gradcheck_slow_mode_return_tuple | 返回元组 | | test_gradgradcheck_slow_mode_mul | 二阶梯度 | | test_gradgradcheck_slow_mode_multiple_inputs | 多输入二阶梯度 | ### test/npu/test_emit_itt.py(3 个测试方法) | 测试方法 | 覆盖场景 | |---------|---------| | test_emit_itt_import | API 导入 | | test_emit_itt_construction | 对象构造 | | test_emit_itt_disabled_noop | enabled=False no-op | # 【资料变更】 不涉及。 torch.autograd.gradcheck、torch.autograd.gradgradcheck、torch.autograd.profiler.emit_itt 在 v2.7.1 版本文档中均已收录,无需补充。 # 【接口变更】 不涉及。 # 【功能验证】 | 组件 | 版本 | |------|------| | torch | v2.7.1 | | CANN | 9.1.0 | | NPU | Ascend 910B3 | 测试命令: python test/npu/test_gradcheck.py -v # Ran 9 tests OK python test/npu/test_emit_itt.py -v # Ran 3 tests OK ## 测试截图  # 【CheckList】 - [x] 代码注释完备 - [x] 返回值、空指针等校验 - [x] PR标题正确使用类型标签 - [ ] PR持续集成流水线(CI)执行通过 --- ## 结论 torch.autograd.gradcheck 和 torch.autograd.profiler.emit_itt 在 v2.7.1 版本 NPU 环境下通过测试用例补齐,功能与 PyTorch 官方行为一致。 See merge request: Ascend/pytorch!42011 | 8 天前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
feat(inductor): Add dispatcher-free _empty_strided_npu fast path allocation Co-authored-by: liuyutong_bury<liuyutong25@huawei.com> # message auto-generated for no-merge-commit merge: !41836 merge feat/empty-strided-npu-fastpath-for-v2.7.1 into v2.7.1 feat(inductor): Add dispatcher-free _empty_strided_npu fast path allocation Created-by: liuyutong_bury Commit-by: liuyutong_bury Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2888 - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 Add a torch_npu._C._empty_strided_npu binding that mirrors upstream's _empty_strided_ (CUDA/XPU/MTIA) fast path for inductor-generated wrappers, bypassing the operator dispatcher. - InitNpuBindings.cpp: THPModule_empty_strided_npu METH_VARARGS stub that parses the (sizes, strides, dtype) 3-tuple directly and calls the native factory; registered in TorchNpuMethods. - TensorFactories.{h,cpp}: TORCH_NPU_API empty_strided_npu — inlines the essential empty_strided steps (storage byte-size from size/stride, single allocate, set sizes/strides, one SetDesc) without empty({0})'s RECORD_FUNCTION / NPURecordFunction guard / 0-byte resize round-trip. at::empty_strided(device='npu') is dispatched (~2us/alloc). Inductor backward graphs allocate many buffers per step, so this host overhead dominates; the fast path removes it while keeping the NPU storage-descriptor setup. # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 #### 基础功能测试 | 测试用例 | 状态 | 验证功能 | |---------|------|---------| | test/npu/test_tensor.py::TestTensor::test_empty_strided | ✅ PASSED | 基本empty_strided功能、各种shape/stride组合、空tensor处理、storage大小计算正确性 | #### API兼容性测试 | 测试用例 | 状态 | 验证功能 | |---------|------|---------| | test/npu/test_npu.py::TestNpu::test_function_torch_empty_strided | ✅ PASSED | torch.empty_strided API、不同dtype支持 | | test/test_tensor_creation_ops.py::TestTensorCreationPRIVATEUSE1::test_empty_strided_npu | ✅ PASSED | 通用tensor创建、跨设备一致性 | #### 新增测试用例验证 新增 test/npu/test_empty_strided_npu.py 测试文件,包含9个测试用例全面验证 _empty_strided_npu fast path 功能。 **测试覆盖:** - 基础功能、空tensor、多dtype支持 (float32/16, int32/8, uint8, bool) - 复杂stride模式、广播stride - 确定性计算场景torch.empty_strided一致性验证、Storage大小计算正确性 - new_empty_strided API集成、@Dtypes装饰器测试 **测试结果:** 9/9 passed ✅ **文件信息:** - 路径: test/npu/test_empty_strided_npu.py - 行数: 200行 - 运行: pytest test/npu/test_empty_strided_npu.py -v 该测试套件确保了inductor NPU内存分配fast path的功能正确性和兼容性。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41836 | 27 天前 | |
| 2 年前 | ||
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
Change the test case name to make it easier to write automation scripts Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !42146 merge v2.7.1_name into v2.7.1 Change the test case name to make it easier to write automation scripts Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 统一测试用例名称,便于写自动化测试脚本 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42146 | 29 天前 | |
test(npu): add SupportedDevices decorator for test_fault_mode Co-authored-by: xftxyz<pangxiaoyu@h-partners.com> # message auto-generated for no-merge-commit merge: !32019 merge v2.7.1-2603180 into v2.7.1 test(npu): add SupportedDevices decorator for test_fault_mode Created-by: xftxyz Commit-by: xftxyz Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) test/npu/test_fault_mode.py:Ascend950不支持aclop,为test_aclopCompile、test_ascyn这两个用例添加@SupportedDevices(['Ascend910A', 'Ascend910B', 'Ascend910_93'])装饰器 test/distributed/test_fault_mode.py:Ascend950日志字符串改变,为test_hccl_timeout用例添加@SupportedDevices(['Ascend910A', 'Ascend910B', 'Ascend910_93'])装饰器,并新增test_hccl_timeout_950,将断言修改为task timeout # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32019 | 4 个月前 | |
| 2 年前 | ||
[Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt Co-authored-by: hongwei-2026<feizi_050920@qq.com> # message auto-generated for no-merge-commit merge: !42011 merge adapt-gradcheck-emit-itt-v2.7.1 into v2.7.1 [Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt Created-by: hongwei-2026 Commit-by: hongwei-2026 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联Issue: - https://gitcode.com/Ascend/pytorch/issues/2956 - https://gitcode.com/Ascend/pytorch/issues/2957 # 【修改方案】 本 PR 属于 Torch-NPU API 一致性对齐任务,面向 torch.autograd.gradcheck 与 torch.autograd.profiler.emit_itt 完成 v2.7.1 版本的测试用例补齐。 ## API 功能说明 ### torch.autograd.gradcheck gradcheck(func, inputs, *, eps=1e-6, atol=1e-5, rtol=1e-3, ...) -> bool 通过小有限差分计算数值梯度并与分析梯度比较,验证自动微分实现的正确性。是 PyTorch 官方提供的梯度验证工具函数,默认使用 float64 精度以保证数值稳定性。 ### torch.autograd.profiler.emit_itt emit_itt(enabled=True, record_shapes=False) 上下文管理器,使每个 autograd 操作发出 ITT 范围标注,用于 Intel VTune Profiler 性能分析。 ## 用例完整性说明 ### torch.autograd.gradcheck 经检索 PyTorch 官方仓库(v2.7.1),对 test/ 目录执行了检索: grep -rn "def test.*gradcheck" test/test_autograd.py --include="*.py" 检索结论:PyTorch 官方已包含 test_gradcheck_single_input 等一系列独立聚焦测试用例。 Ascend NPU 不支持 float64 的 linalg.vector_norm、dot、mm、relu 算子,因此 fast_mode 无法直接在 NPU 上运行。按任务文档场景一规范,在 slow_mode 下对 NPU 支持的 float64 运算编写测试用例,覆盖单输入、多输入、返回元组、二阶梯度等场景。 ### torch.autograd.profiler.emit_itt PyTorch 官方在 test/test_autograd.py 中包含 test_profiler_emit_itt 测试用例,带以下装饰器: @unittest.skipIf(not torch.profiler.itt.is_available(), "ITT is required") def test_profiler_emit_itt(self, device): a = torch.tensor([1, 2, 3], dtype=torch.float32, device=device) with emit_itt(): a.add(1.0) Ascend NPU 上 torch.profiler.itt.is_available() 返回 False,用例被自动跳过。 检索结论:上游用例在 NPU 上无法直接运行,需通过 test_upstream patch 适配并新增独立测试。 ## 具体修改内容 本 PR 新增 2 个测试文件,修改 1 个 test_upstream patch:test_upstream/test/test_autograd.py.patch: - test/npu/test_gradcheck.py - test/npu/test_emit_itt.py ### test/npu/test_gradcheck.py(9 个测试方法) | 测试方法 | 覆盖场景 | |---------|---------| | test_gradcheck_slow_mode_mul | 单输入 mul | | test_gradcheck_slow_mode_linear | 线性函数 | | test_gradcheck_slow_mode_sin_cos | sin().cos() | | test_gradcheck_slow_mode_exp | exp() | | test_gradcheck_slow_mode_sum | sum() | | test_gradcheck_slow_mode_multiple_inputs | 多输入 | | test_gradcheck_slow_mode_return_tuple | 返回元组 | | test_gradgradcheck_slow_mode_mul | 二阶梯度 | | test_gradgradcheck_slow_mode_multiple_inputs | 多输入二阶梯度 | ### test/npu/test_emit_itt.py(3 个测试方法) | 测试方法 | 覆盖场景 | |---------|---------| | test_emit_itt_import | API 导入 | | test_emit_itt_construction | 对象构造 | | test_emit_itt_disabled_noop | enabled=False no-op | # 【资料变更】 不涉及。 torch.autograd.gradcheck、torch.autograd.gradgradcheck、torch.autograd.profiler.emit_itt 在 v2.7.1 版本文档中均已收录,无需补充。 # 【接口变更】 不涉及。 # 【功能验证】 | 组件 | 版本 | |------|------| | torch | v2.7.1 | | CANN | 9.1.0 | | NPU | Ascend 910B3 | 测试命令: python test/npu/test_gradcheck.py -v # Ran 9 tests OK python test/npu/test_emit_itt.py -v # Ran 3 tests OK ## 测试截图  # 【CheckList】 - [x] 代码注释完备 - [x] 返回值、空指针等校验 - [x] PR标题正确使用类型标签 - [ ] PR持续集成流水线(CI)执行通过 --- ## 结论 torch.autograd.gradcheck 和 torch.autograd.profiler.emit_itt 在 v2.7.1 版本 NPU 环境下通过测试用例补齐,功能与 PyTorch 官方行为一致。 See merge request: Ascend/pytorch!42011 | 8 天前 | |
[inductor][Feature] Adaptive Gear Update Co-authored-by: zhudada0120<zhuguanda@huawei.com> # message auto-generated for no-merge-commit merge: !35530 merge v2.7.1-gear into v2.7.1 [inductor][Feature] Adaptive Gear Update Created-by: zhudada Commit-by: zhudada0120 Merged-by: ascend-robot Description: ## 1. 背景 当前 torch_npu inductor 动态 shape 的 gear 分档主要在初始化阶段确定,后续运行过程中基本保持不变。这种静态分档策略在实际 workload 中可能暴露出两类问题: 1. 部分档位利用率低:初始化的档位分布可能与实际 shape 分布不匹配,导致某些档位长期闲置,浪费预留资源 2. padding 比例过高:档位设置不合理时,大量请求会被映射到偏大的档位,导致受控维度上持续的高比例 padding,降低计算效率 为解决上述问题,需要引入自适应档位更新机制,根据运行时统计动态调整档位分布,在保持稳定性的同时提升资源利用率。 系统在运行期间持续回答三个问题:当前哪些 gear 值得保留、哪些可以安全删除、哪些区域值得新增。 ## 2. 设计目标 1. 优先保留近期命中率高、padding/split 代价低的 gear 2. 在有限资源预算下,让 gear 集合朝更高收益方向演化 3. 支持单维 BATCHSIZE / SEQLEN 及双维组合场景 4. 更新不破坏请求一致性:通过锁保证原子性,通过快照保证请求线程不受影响 ## 3. 总体运行时流程 ### 3.1 端到端闭环 mermaid flowchart LR A[请求进入 shape handling] --> B[读取当前 gears 快照] B --> C[按 current gears 执行 transform] C --> D[记录 raw shape / mapped gear / pad / split] D --> E[执行 compiled graph] E --> F[执行 recover] F --> G[请求返回] H[Worker 线程定时醒来] --> I{检查触发条件} I -- 距上次更新 ≥ 300s --> J[执行更新] I -- 显存使用率 ≥ 阈值 --> J I -- 都不满足 --> H J --> K[加锁: 获取快照 + 构建统计 + 打分 + 淘汰 + 新增 + 预算判断] K --> L[更新 current gears 快照] L --> M[调用 pool.remove_by_keys 清理 graph] M --> H ### 3.2 职责划分 - **请求线程**:get_snapshot() 读快照 → transform → src_fn(compile+execute) → consume_recent_keys() → record_event → recover - **Worker daemon 线程**:每 60s 检查触发条件 → run_once(在 _commit_lock 下完成打分、淘汰、新增、提交)→ 锁外 pool.remove_by_keys mermaid sequenceDiagram participant Req as 请求线程 participant RT as AdaptiveGearRuntime participant Worker as Worker 线程 (daemon) participant WK as GearUpdateWorker Note over Worker: 每 60s 醒来一次 Req->>RT: get_snapshot() (无锁读) RT-->>Req: gears 快照副本 Req->>RT: record_event(...) RT-->>Req: 返回 Note over Req,RT: 请求线程只做快照读取和事件记录 Worker->>Worker: _should_trigger_update() alt 触发条件满足 Worker->>WK: run_once(now_ts) Note over WK: 在 _commit_lock 保护下 WK->>RT: get_snapshot() + build_stats_snapshot() WK->>WK: score / evict / add / budget WK->>RT: commit_update() Note over WK: 释放 _commit_lock WK->>WK: pool.remove_by_keys(keys) else 条件不满足 Worker->>Worker: 继续等待 end ### 3.3 并发控制 | 锁 | 保护对象 | 使用场景 | |---|---|---| | _sample_lock | _states 读写 | record_event、build_stats_snapshot、_collect_cleanup_keys | | _commit_lock | 更新计算串行化 | run_once 全程 | | GearSnapshotStore._lock | 快照写入 | publish_snapshot | get_snapshot() 无锁(clone-on-read),请求线程不阻塞。graph 清理在所有锁外执行。 ### 3.4 Graph 清理机制 图资源通过 GraphResourcePool(per-device 单例)管理,使用**不透明整数句柄**作为 key: python pool = GraphResourcePool.get_pool(device_index) key = pool.register(resource) # 下层 — graph capture 期间 → int keys = pool.consume_recent_keys() # 上层 — src_fn 返回后 → List[int] pool.remove_by_keys([42, 43]) # 后台 — gear 淘汰后 (幂等) 只有下层构造 key,上层通过 consume_recent_keys() 读回,从根本上消除 key 一致性问题。 **完整生命周期**: mermaid sequenceDiagram participant NF as new_fn (上层) participant SF as src_fn participant RF as record_function (下层) participant Pool as GraphResourcePool participant MGR as AdaptiveGearRuntime participant WK as GearUpdateWorker (后台) Note over NF: variant 0: BATCHSIZE→32, SEQLEN→128 NF->>SF: src_fn(call_args) activate SF loop 每个子图 (graph break) SF->>RF: record_function(sub_inputs, func_id) RF->>RF: node = NPUGraphNode(...) RF->>Pool: key = pool.register(node) Note over Pool: _entries[key] = node<br/>_pending_by_thread[tid].append(key) Pool-->>RF: key (int, e.g. 100) end SF-->>NF: result deactivate SF NF->>Pool: keys = pool.consume_recent_keys() Pool-->>NF: [100, 101, 102] Note over Pool: _pending_by_thread[tid] 已清空 loop 每个 key NF->>MGR: record_event(..., cleanup_key=key) MGR->>MGR: state["BATCHSIZE:32"].cleanup_keys.add(key) MGR->>MGR: state["SEQLEN:128"].cleanup_keys.add(key) end Note over WK: --- 后台:gear 淘汰 (每 60s) --- WK->>MGR: commit_update(removed_gears=["BATCHSIZE:32"]) MGR->>MGR: 收集 cleanup_keys = {100, 101, 102} MGR-->>WK: removed_keys = [100, 101, 102] WK->>Pool: remove_by_keys([100, 101, 102]) loop 每个 key Pool->>Pool: resource = _entries.pop(key, None) alt resource 存在 Pool->>Pool: torch.npu.synchronize() Pool->>Pool: resource.release() / reset() else resource 不存在 (已删) Note over Pool: pop 返回 None,跳过 end end **线程隔离**:register 和 consume_recent_keys 构成 per-thread 生产者-消费者对。register 在 _lock 下自增分配 key,追加到 _pending_by_thread[tid];consume 排空当前线程的 pending 列表。不同线程互不干扰,同一函数断图产生的 N 个 key 在同一线程上一次性全部消费。 **Key-Gear 关联**:一个 variant 内产生的所有子图 key 挂到该 variant 命中的全部 gear 上。任意 gear 淘汰后该 shape 组合不再生成,所有依赖子图都应清理。收集到的 key 传给 remove_by_keys,使用 _entries.pop(key, None) 保证幂等——同一 key 被多个 gear 共享时,首次淘汰 pop 拿到资源并释放,后续 pop 返回 None 跳过。 ## 4. 时间窗口与统计规则 - 窗口长度 300s(window_seconds),半衰期 150s,衰减系数 $\lambda = \frac{\ln 2}{150}$ - 事件权重:$w_t(e) = \exp(-\lambda \cdot \Delta t_e)$ 对 gear $g$: $$ hit\_rate_g = \frac{\sum_{e \in g} w_t(e)}{\sum_{e \in all} w_t(e)} \qquad avg\_pad_g = \frac{\sum_{e \in g} w_t(e) \cdot pad\_ratio(e)}{\sum_{e \in g} w_t(e)} \qquad avg\_split_g = \frac{\sum_{e \in g} w_t(e) \cdot split\_ratio(e)}{\sum_{e \in g} w_t(e)} $$ 双维场景按维度独立统计。 ## 5. 基础打分 单一公式:$Score_g = w_h H_g - w_p P_g - w_{sp} SP_g$ 默认权重:$w_h = 0.60$,$w_p = 0.20$,$w_{sp} = 0.20$。命中率越高分越高,padding/split 越高分越低。双维按两个独立一维问题处理。 ## 6. 淘汰机制 **触发**:定时(距上次 ≥ update_interval_seconds,默认 300s)或显存压力(≥ device_memory_usage_threshold_ratio)。 **多层过滤**(每维度至多淘汰 1 个): 1. 跳过最大 gear(max_gear_by_type) 2. 使用保护:now - max(created_ts, last_hit_ts) < recent_use_protect_seconds(默认 300s)→ 跳过 3. 数量下限:len(gears) ≤ min_gear_count_per_type → 跳过 4. 替代损失:计算删除后 raw_samples 重映射到最佳替代 gear 的平均损失,超过 replace_loss_threshold(0.60)→ 跳过并延长保护 mermaid flowchart TD A[按维度分组构建候选队列] --> B{候选为空?} B -- 是 --> Z[结束] B -- 否 --> C[按维度遍历] C --> D{该维度 gear 数 > 下限?} D -- 否 --> C D -- 是 --> E[过滤: 跳过最大 gear / 使用保护窗口过滤] E --> F{过滤后仍有候选?} F -- 否 --> C F -- 是 --> G[取最低分候选] G --> H{替代损失超过阈值?} H -- 是 --> I[延长保护窗口] I --> C H -- 否 --> J[标记 gear 为待淘汰] J --> K[继续下一个维度或结束] K --> Z 提交阶段:加锁更新 current_gears,收集 cleanup_keys,删除 GearRuntimeState。清理阶段:锁外 pool.remove_by_keys(keys)。 ## 7. 新增机制 两类独立触发(共用同一份窗口统计): - **padding 驱动**:pad_sample_count ≥ add_min_samples 且 avg_pad ≥ pad_add_threshold(默认 0.35) - **split 驱动**:split_sample_count ≥ add_min_samples 且 avg_split ≥ split_add_threshold(默认 0.20),仅对最大 gear 生效 候选值 = median(raw_samples),去重后按 pressure 排序。显存超阈值时 budget = len(removed_gears)(替换式新增),否则不限制。每个 shape_type 上限 max_gears_per_type(默认 64)。 mermaid flowchart TD A["遍历所有 gear 的窗口统计"] --> B{"当前 gear 是最大档位?"} B -- 是 --> C["检查 split:<br>avg_split >= theta 且样本数 >= N_min?"] B -- 是 --> D["检查 pad:<br>avg_pad >= theta 且样本数 >= N_min?"] B -- 否 --> D C -- 是 --> E["g_new = median(raw_samples)<br>候选类型: 新最大档位"] D -- 是 --> E C -- 否 --> F["不触发 split 新增"] D -- 否 --> G["不触发 pad 新增"] E --> H["加入候选集合"] H --> I["所有候选按 pressure 排序"] I --> J{"显存压力高?"} J -- 是 --> K["budget = 已淘汰 gear 数<br>(替换式新增)"] J -- 否 --> L["budget = 无限制<br>(直接新增)"] K --> M L --> M["按 pressure 顺序遍历候选"] M --> N{"budget 耗尽?"} N -- 是 --> O["结束"] N -- 否 --> P["加入 active_gears<br>budget -= 1"] P --> M ## 8. 资源预算 - device_memory_usage_ratio = 1 - free / total,通过 torch.npu.mem_get_info() 获取 - 达到 device_memory_usage_threshold_ratio(默认 0.90)时立即触发更新,新增转为替换式(addition_budget = len(removed_gears)) - 配置为 None 时不启用显存检查 ## 9. 测试覆盖 测试文件:test/_inductor/test_shape_handling.py(63 个用例)、test/npu/test_graph_tree.py(15 个用例)。 元数据采集 ─── transform metadata → raw/mapped shapes → pad/split ratios 统计采集 ─── snapshot 创建 → record_event → build_stats ├─ pad/split 分离统计 ├─ 双维独立统计 └─ cleanup_keys 追踪 (Set[int]) 淘汰决策 ─── 基础打分 → 保护过滤 → 替代损失 → 提交 ├─ 最近使用/新建保护 ├─ 零使用优先淘汰 └─ 最大 gear 跳过 新增决策 ─── pad 驱动 / split 驱动 → 候选生成 → 重复过滤 → 提交 资源守卫 ─── 显存压力 ─┬─ 触发更新 └─ 阻止直接新增 并发安全 ─── daemon 线程 ── _commit_lock 串行化 ── 快照隔离 ── 高并发稳定性 GraphResourcePool ─── register → consume_recent_keys → remove_by_keys ├─ per-thread 线程隔离 └─ 幂等删除 ## 10. 实现边界限制 1. 双维场景分维独立决策,不构造联合候选 2. 显存使用率基于当前观测值,不预测新增后的增量 3. 新增候选仅做精确重复检查,不做距离阈值过滤 4. 每轮每维度至多淘汰 1 个 gear,数量远超下限时需多轮收敛 ## 11. 总结 本方案引入运行时自适应齿轮调整机制:通过时间衰减窗口统计量化 gear 价值,经多层过滤实现可解释的淘汰决策,由 padding/split 信号驱动新增,在显存预算约束下控制 gear 数量。请求线程无锁读取快照,后台 daemon 线程自主触发更新,graph 清理在锁外幂等执行。 See merge request: Ascend/pytorch!35530 | 1 个月前 | |
[feat]: A5 only supports INF_NAN mode Co-authored-by: weixin_47897441<wuyouqi1@h-partners.com> Co-authored-by: wanglijun55<wanglijun54@huawei.com> # message auto-generated for no-merge-commit merge: !35335 merge v2.7.1-infnan into v2.7.1 [feat]: A5 only supports INF_NAN mode Created-by: wanglijun55 Commit-by: weixin_47897441;wanglijun55 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/1918 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 A5上torch.utils.is_support_inf_nan()接口始终返回ture,INF_NAN_MODE_ENABLE和INF_NAN_MODE_FORCE_DISABLE两个环境变量配置不生效 # 【资料变更】 涉及资料更改,PR见https://gitcode.com/Ascend/pytorch/pull/35330 # 【接口变更】 涉及接口变更,torch.utils.is_support_inf_nan()接口在A5上始终返回ture,在其他型号上保持不变; # 【功能验证】 UT测试ok # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35335 | 3 个月前 | |
[v2.7.1][feature][bugfix]support IPC 64k and HDK xx.xx.xx.b version Co-authored-by: Dring<17737727613@163.com> # message auto-generated for no-merge-commit merge: !41875 merge v2.7.1 into v2.7.1 [v2.7.1][feature][bugfix]support IPC 64k and HDK xx.xx.xx.b version Created-by: Dring Commit-by: Dring Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2919 - [✓ ] 需求 - [✕ ] 问题单 - [✕ ] issue/工单 - [✕ ] 重构优化 - [✕ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 64k pagesize,新版本HDK已支持,去除4k校验限制。同时增加HDK b版本判断分支。 版本排序语义:b-build < T版本 < RC版本 < 正式release |版本 |release |关键项 |数值| |--|--|--|--| |26.1.0 |0| (0+1)*10000| 2702010000| |26.1.0.T1| -1 |(1+1)*100| 2702000200| |26.1.0.b083| -1(不设)| +83(patch)| 2702000083| 验证:2702000083 < 2702000200 < 2702010000 → b083 < T1 < 正式版 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 64k页机器 ut验证:  4k页机器 ut验证:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [✓ ] 代码注释完备,正确记录错误日志 - [✕ ] 代码实现进行了返回值、空指针等校验 - [ ✓] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [✓ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41875 | 30 天前 | |
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
[feat] support environment variable LD_PRELOAD Co-authored-by: liujunzhu<liujunzhu@huawei.com> # message auto-generated for no-merge-commit merge: !34372 merge v2.7.1 into v2.7.1 [feat] support environment variable LD_PRELOAD Created-by: liujunzhu Commit-by: liujunzhu 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能力等内容) 用户自实现 aclrtMallocAlign32 等 ACL 符号并打包成 .so,通过 LD_PRELOAD 注入 torch_npu 进程,期望拦截对 ACL 函数的调用,但实际未被调用。 根因:torch_npu 中部分 ACL 函数(如 aclrtMallocAlign32、aclrtFreePhysical)通过 FunctionLoader::Get() 使用 dlsym(handle, name) 查找符号,该方式限定在 handle 对应的库中查找,不搜索 LD_PRELOAD 预加载的库,导致覆盖失效。而直接链接调用的 ACL 符号(如 aclrtFree)走 PLT 全局符号解析,天然支持 LD_PRELOAD。 修改方案: 1. 修改 FunctionLoader::Get() 方法,当 LD_PRELOAD 环境变量非空时,优先通过 dlsym(RTLD_DEFAULT, name) 在全局符号表中查找函数,使 LD_PRELOAD 注入的同名符号可被命中;未命中时回落原有 dlopen + dlsym(handle) 路径。 2. 以 LD_PRELOAD 非空作为门控条件,未设置时完全走旧路径,行为与修改前一致。 3. 仅修改 torch_npu/csrc/core/npu/register/FunctionLoader.cpp,不新增头文件、不改变调用方。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 测试场景:通过 LD_PRELOAD 注入自定义 aclrtMallocAlign32 实现,验证 FunctionLoader 路径的符号可被覆盖。 测试方法:子进程隔离测试,每个用例在独立子进程中设置不同 LD_PRELOAD 环境变量。 | 测试用例 | 验证内容 | |---------|---------| | 无 LD_PRELOAD | 行为与修改前一致,hook 不被调用 | | LD_PRELOAD 设置 hook so | aclrtMallocAlign32 被 hook 拦截 | | LD_PRELOAD 设置不含 ACL 符号的 so | 正确回落到原始库,功能不受影响 | | LD_PRELOAD 多 so | 先加载的 hook 优先命中 | 新增测试文件:test/npu/test_ld_preload_acl_hook.py。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34372 | 3 个月前 | |
[v2.7.1]test: add clone coverage for torch.autograd.grad_mode.set_grad_enabled Co-authored-by: Zky0803<kyzhang0803@163.com> # message auto-generated for no-merge-commit merge: !42460 merge pr/set-grad-enabled-clone-v2.7.1 into v2.7.1 [v2.7.1]test: add clone coverage for torch.autograd.grad_mode.set_grad_enabled Created-by: Zky0803 Commit-by: Zky0803 Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 - 来源任务 Issue:[【社区任务】7月社区任务第二期-Ascend for PyTorch API 一致性开发(31)](https://gitcode.com/Ascend/pytorch/issues/2954) - 结果 Issue:[torch.autograd.grad_mode.set_grad_enabled.clone API 一致性补齐](https://gitcode.com/Ascend/pytorch/issues/3102) # 【分支范围】 本 PR 面向 v2.7.1 目标分支。 本任务整体覆盖: text master、v2.7.1、v2.11.0、v2.12.0 v2.9.0、v2.10.0 已进入维护阶段,不再合入新特性或本类新增测试,因此本任务 不再对这两个分支作补齐要求。 # 【修改方案】 本次仅补充 torch.autograd.grad_mode.set_grad_enabled.clone 的 NPU 单元测试, 不修改 API 实现。 修改文件: text test/npu/test_locally_disabling_gradient_omputation.py 整改后提交: text 源分支:pr/set-grad-enabled-clone-v2.7.1 Commit:1da804b44681ace1c8ff9fd7b06e9ccf3d05b31c 提交标题:test: add clone coverage for set_grad_enabled 文件 SHA-256:642c2b526d025de467b3b1ef728526b64977e22485ceafb0e8c60a58f25b1120 文件头增加 Huawei BSD 3-Clause copyright 和 API 覆盖说明: python # Copyright (c) 2026 Huawei Technologies Co., Ltd # All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Add validation cases for gradient-mode APIs on NPU. This file validates torch.no_grad, torch.enable_grad, torch.set_grad_enabled, and torch.autograd.grad_mode.set_grad_enabled.clone, including clone object independence, mode preservation, grad-mode restoration, and decorator behavior with NPU tensors. """ ## 1. clone 直接行为 整改后的 test_set_grad_enabled_clone: python def test_set_grad_enabled_clone(self): initial_grad_enabled = torch.is_grad_enabled() with torch.set_grad_enabled(initial_grad_enabled): for mode in (False, True): ctx = torch.set_grad_enabled(mode) cloned = ctx.clone() self.assertIsNot(ctx, cloned) self.assertIsInstance( cloned, torch.autograd.grad_mode.set_grad_enabled, ) self.assertEqual(cloned.mode, mode) self.assertEqual(torch.is_grad_enabled(), initial_grad_enabled) 验证: - torch.set_grad_enabled(False).clone(); - torch.set_grad_enabled(True).clone(); - clone 后对象与原对象不是同一实例; - clone 后对象类型保持; - clone 后 mode 状态保持; - 测试结束后线程 grad mode 与测试开始时一致。 ## 2. NPU Tensor 装饰器调用链 整改后的 test_set_grad_enabled_clone_decorator: python def test_set_grad_enabled_clone_decorator(self): initial_grad_enabled = torch.is_grad_enabled() x = torch.tensor( [1.0], device="npu:0", requires_grad=True, ) with torch.set_grad_enabled(initial_grad_enabled): @torch.set_grad_enabled(False).clone() def grad_disabled(tensor): return tensor * 2 with torch.enable_grad(): disabled_result = grad_disabled(x) self.assertEqual(disabled_result.device, x.device) self.assertFalse(disabled_result.requires_grad) @torch.set_grad_enabled(True).clone() def grad_enabled(tensor): return tensor * 2 with torch.no_grad(): enabled_result = grad_enabled(x) self.assertEqual(enabled_result.device, x.device) self.assertTrue(enabled_result.requires_grad) self.assertEqual(torch.is_grad_enabled(), initial_grad_enabled) 该用例在测试代码中显式调用: python torch.set_grad_enabled(False).clone() torch.set_grad_enabled(True).clone() 并直接验证: - 外层梯度开启时,clone 后的 mode=False 装饰器使 NPU 输出 requires_grad=False; - 外层 torch.no_grad() 时,clone 后的 mode=True 装饰器使 NPU 输出 requires_grad=True; - 输出 Tensor 仍位于输入 NPU 设备; - 测试结束后线程 grad mode 恢复。 ## 3. 导入清理 继续保持移除冗余的: python import torch_npu # noqa: F401 当前通过: python from torch_npu.testing.testcase import TestCase, run_tests 使用项目测试基类和测试入口,不使用 noqa 掩盖未使用导入。 本次不涉及: - PyTorch API 功能实现; - Torch-NPU C++ 适配; - NPU Kernel; - test_upstream patch; - 跨代码仓接口变更。 # 【社区用例检索与新增必要性】 在 origin/v2.7.1(bacce7d835e779a6417047f18547f58fc0e37739)中执行: bash git grep -n -E \ 'set_grad_enabled.*clone|clone.*set_grad_enabled|test_.*set_grad_enabled.*clone' \ -- test 直接 clone 测试匹配数: text 0 相关基础测试包括: - test/test_autograd.py::test_set_grad_enabled - test/test_autograd.py::test_set_grad_enabled_wraps - test/npu/test_locally_disabling_gradient_omputation.py::test_set_grad_enabled 这些用例覆盖基础上下文管理器或通用装饰器行为,但没有直接检查 clone 后对象的 身份、类型和 mode,没有验证测试前后线程 grad mode 保持,也没有使用 clone 后对象作为装饰器对 NPU Tensor 输出进行断言。因此需要在现有 Torch-NPU NPU 测试文件中新增本用例,不能直接以社区基础用例替代。 # 【资料变更】 涉及。 torch.autograd.grad_mode.set_grad_enabled.clone 为 PyTorch 对外公开的 set_grad_enabled 子方法。经资料补齐要求复核,当前 Torch-NPU Native API 资料仅登记父 API,缺少 clone() 子方法,因此本任务另行提交资料补齐 PR。 资料补齐信息: text 目标分支:master 源分支:docs/set-grad-enabled-clone 基线提交:462f4e18a8303698aca3997edfcc5dd3b1707968 资料提交:fcc55fd51dc6e4ba5a4068cb9805d15a59021bc3 提交标题:docs: add support status for set_grad_enabled.clone 资料 PR:[PR #44139](https://gitcode.com/Ascend/pytorch/pull/44139) 资料修改文件: text docs/zh/api/native_api/pytorch_2-7-1/torch.md docs/zh/api/native_api/pytorch_2-11-0/torch.md docs/zh/api/native_api/pytorch_2-12-0/torch.md docs/zh/api/native_api/pytorch_2-13-0/torch.md 资料中将 clone() 作为 torch.autograd.grad_mode.set_grad_enabled 的子方法登记,支持状态与父 API 保持一致: - Atlas A2 训练系列产品:支持; - Atlas A3 训练系列产品:支持; - Ascend 950DT:暂不支持。 该 API 为非计算类上下文对象复制方法,与 Tensor 数据类型无关,因此资料中不 增加 fp16、fp32、bf16 等 dtype 限制说明。 资料分支已完成本地检查并成功推送,diff --check、四版本条目覆盖及远端 SHA 验证均通过。 # 【接口变更】 不涉及。 本次不修改函数实现、接口签名、返回类型或其他组件交互。 # 【功能验证】 ## 环境 text 目标分支:v2.7.1 torch:2.7.1+cpu torch-npu:2.7.1.post2 NPU available:True NPU device count:1 ## 命令 bash python test/npu/test_locally_disabling_gradient_omputation.py -v 隔离验证还分别从初始 grad mode 为 False 和 True 的状态执行两个 clone 测试。 ## 测试场景 text test_enable_grad test_no_grad test_set_grad_enabled test_set_grad_enabled_clone test_set_grad_enabled_clone_decorator 隔离验证场景: text initial=False → before=False → after=False initial=True → before=True → after=True ## 完整原始输出 text ================================================== TARGET_BRANCH=v2.7.1 SOURCE_BRANCH=pr/set-grad-enabled-clone-v2.7.1 COMMIT=1da804b44681ace1c8ff9fd7b06e9ccf3d05b31c PYTHON=envs/torch_npu_2.7.1/bin/python TEST_FILE=/tmp/set_grad_enabled_clone_final_tests_590/v2.7.1/test/npu/test_locally_disabling_gradient_omputation.py TEST_FILE_SHA256=642c2b526d025de467b3b1ef728526b64977e22485ceafb0e8c60a58f25b1120 ================================================== ===== ENVIRONMENT PROBE ===== python_executable=/workspace/user_data/torch_npu_api_check/check_close_args/envs/torch_npu_2.7.1/bin/python python_version=3.11.15 platform=Linux-5.10.0-216.0.0.115.oe2203sp4.aarch64-aarch64-with-glibc2.35 torch_version=2.7.1+cpu torch_npu_version=2.7.1.post2 torch_file=/workspace/user_data/torch_npu_api_check/check_close_args/envs/torch_npu_2.7.1/lib/python3.11/site-packages/torch/__init__.py torch_npu_file=/workspace/user_data/torch_npu_api_check/check_close_args/envs/torch_npu_2.7.1/lib/python3.11/site-packages/torch_npu/__init__.py npu_available=True npu_device_count=1 initial_grad_enabled=True ENVIRONMENT_PROBE_EXIT_CODE=0 ===== FULL TEST FILE ===== COMMAND=env -u PYTHONPATH PYTHONNOUSERSITE=1 envs/torch_npu_2.7.1/bin/python /tmp/set_grad_enabled_clone_final_tests_590/v2.7.1/test/npu/test_locally_disabling_gradient_omputation.py -v test_enable_grad (__main__.TestLDGComputation.test_enable_grad) ... ok test_no_grad (__main__.TestLDGComputation.test_no_grad) ... ok test_set_grad_enabled (__main__.TestLDGComputation.test_set_grad_enabled) ... ok test_set_grad_enabled_clone (__main__.TestLDGComputation.test_set_grad_enabled_clone) ... ok test_set_grad_enabled_clone_decorator (__main__.TestLDGComputation.test_set_grad_enabled_clone_decorator) ... ok ---------------------------------------------------------------------- Ran 5 tests in 0.361s OK FULL_TEST_EXIT_CODE=0 ===== GRAD MODE ISOLATION PROBE ===== test_set_grad_enabled_clone (set_grad_enabled_clone_test_module.TestLDGComputation.test_set_grad_enabled_clone) ... ok test_set_grad_enabled_clone_decorator (set_grad_enabled_clone_test_module.TestLDGComputation.test_set_grad_enabled_clone_decorator) ... ok ---------------------------------------------------------------------- Ran 2 tests in 0.211s OK test_set_grad_enabled_clone (set_grad_enabled_clone_test_module.TestLDGComputation.test_set_grad_enabled_clone) ... ok test_set_grad_enabled_clone_decorator (set_grad_enabled_clone_test_module.TestLDGComputation.test_set_grad_enabled_clone_decorator) ... ok ---------------------------------------------------------------------- Ran 2 tests in 0.002s OK PROCESS_ORIGINAL_GRAD_MODE=True ISOLATION_RESULT=initial:False,before:False,after:False,tests_run:2,successful:True ISOLATION_RESULT=initial:True,before:True,after:True,tests_run:2,successful:True PROCESS_FINAL_GRAD_MODE=True GRAD_MODE_ISOLATION_PROBE=PASS GRAD_MODE_ISOLATION_EXIT_CODE=0 RESULT=PASS v2.7.1_TEST_COLLECTOR_EXIT_CODE=0 v2.7.1_WORKTREE_REMOVE_EXIT_CODE=0 该版本执行结果: text Ran 5 tests in 0.361s OK FULL_TEST_EXIT_CODE=0 ISOLATION_RESULT=initial:False,before:False,after:False,tests_run:2,successful:True ISOLATION_RESULT=initial:True,before:True,after:True,tests_run:2,successful:True GRAD_MODE_ISOLATION_PROBE=PASS GRAD_MODE_ISOLATION_EXIT_CODE=0 # 【test_upstream patch】 不涉及。 本 PR 只修改 Torch-NPU 自定义 NPU 测试,不修改 PyTorch 官方测试逻辑或断言, 无需新增或修改 test_upstream patch。 # 【CheckList】 - [x] 代码注释和格式符合规范(本次未新增业务日志) - [x] 文件包含规范 copyright 和 API 覆盖说明 - [x] 测试代码显式调用目标 clone() - [x] 测试结束后恢复线程 grad mode - [x] False/True 初始 grad mode 隔离验证通过 - [x] 使用 NP See merge request: Ascend/pytorch!42460 | 7 天前 | |
| 2 年前 | ||
AI assist developer for python dt third batch for 2.7.1 Co-authored-by: deepSeekya<chenzhihan6@huawei.com> # message auto-generated for no-merge-commit merge: !26518 merge v2.7.1 into v2.7.1 AI assist developer for python dt third batch for 2.7.1 Created-by: deepSeekya Commit-by: deepSeekya Merged-by: ascend-robot Description: 【合入说明】 AI辅助研发python dt测试用例生成。 【合入来源】 AI辅助研发需求 dt测试文件覆盖率提升。 See merge request: Ascend/pytorch!26518 | 8 个月前 | |
【feat】mstx support push and pop Co-authored-by: mei-feiyao<meifeiyao@h-partners.com> # message auto-generated for no-merge-commit merge: !36207 merge range7 into v2.7.1 【feat】mstx support push and pop Created-by: mei-feiyao Commit-by: mei-feiyao Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\https://gitcode.com/Ascend/pytorch/issues/2033 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 对齐社区nvtx模块,补全接口,包括如下: 1、range_push、range_pop:线程粒度的打range点接口,内部走mstx库实现打点,用户可通过torch_npu.profiler接口配置mstx=True或者msproftx=True(待废弃)的方式采集tx打点数据; 2、annotate类:用户可通过with torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")的方式或者@torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")装饰器的方式对目标代码段或者目标函数进行打点,内部会在开始和结束的阶段分别调用range_push和range_pop # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 是。涉及新增接口,已联系资料同学补充资料 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 本需求只涉及新增接口,不涉及已有接口变更 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 1、UT测试验证新增接口; 2、模型代码增加调用新增的打点接口,并通过profiler采集打点数据,观察打点数据正常 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36207 | 2 个月前 | |
| 2 年前 | ||
lazy query events Co-authored-by: lby<liubuyu1@huawei.com> # message auto-generated for no-merge-commit merge: !30998 merge v2.7.1 into v2.7.1 lazy query events Created-by: liubuyu1 Commit-by: lby Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 内存申请流程中,将原来的每次申请即查询event,修改为event数量达到上限后再查询,降低查询次数,提升host性能。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 文档中新增环境变量 PYTORCH_NPU_ALLOC_CONF=multi_stream_lazy_reclaim:True说明。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 新增环境变量export PYTORCH_NPU_ALLOC_CONF=multi_stream_lazy_reclaim:True,控制event延迟查询功能开启。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增测试用例,使用profiling功能对比功能开启前后event查询次数  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!30998 | 5 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 | |
[feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 2.7.1 Co-authored-by: yurongkun<yurongkun@huawei.com> # message auto-generated for no-merge-commit merge: !35179 merge no_cache_2.7 into v2.7.1 [feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 2.7.1 Created-by: yurongkun Commit-by: yurongkun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > aclgraph支持PYTORCH_NO_NPU_MEMORY_CACHING 1)裸调capture时,打开PYTORCH_NO_NPU_MEMORY_CACHING不会报错,正常运行。 2)如果当前内存池无其他图持有且图内对象无依赖内存池时,释放该内存池给驱动 # 【资料变更】 > 不涉及 # 【接口变更】 > 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增UT看护,并运行多种场景用例。无运行报错 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35179 | 3 个月前 | |
Align NPU mixed-dtype async host-device copy behavior with CUDA Co-authored-by: zzhongmin<zhongmin23@huawei.com> # message auto-generated for no-merge-commit merge: !39577 merge v2.7.1_d2h into v2.7.1 Align NPU mixed-dtype async host-device copy behavior with CUDA Created-by: zzhongmin Commit-by: zzhongmin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. 对齐 CUDA Copy.cu 的 mixed-dtype 异步 Host/Device 拷贝策略,调整 NPU OpApi 路径。 当 non_blocking=True 且 Host/Device dtype 不一致时,将可由 aclnnCast 支持的 dtype 转换前移到 NPU Device 侧完成,避免因 CPU 侧 dtype cast 产生非 pinned 临时 Tensor,导致 H2D/D2H 退化为同步拷贝。non_blocking=False 与同 dtype fast path 保持原有逻辑。 - torch_npu/csrc/aten/ops/op_api/CopyKernelOpApi.cpp - H2D:先申请源 dtype 的 NPU temporary,将 pinned/已注册 CPU 数据按源 dtype 执行同 dtype H2D 拷贝,再通过 aclnnCast 转为目标 dtype 并写回目标 Tensor。 - D2H:先在 NPU 侧通过 custom_ops::_npu_dtype_cast 转为目标 dtype,再执行同 dtype D2H 拷贝到 CPU 目标。 - D2H cast 前补充 NpuUtils::check_match(&src) 判断;当 NPU 源 Tensor 是非连续 view 或 metadata 不满足 OpApi 要求时,先通过 NpuUtils::format_contiguous(src) 规范化输入,避免 aclnnCast 直接处理不匹配的 view。 - 新增 cast_dtype_out_baseformat_opapi,封装 aclnnCast out 路径,用于 H2D mixed-dtype async 路径中将 NPU temporary 转换并写入目标 Tensor。 - 新增 should_fallback_to_cpu_cast:在 A2 及之后产品上,对 aclnnCast 不支持的 dtype 组合保留原 CPU cast 路径,避免 unsupported dtype 走设备侧 cast 失败。 2. 补充 Tensor.copy_ mixed-dtype 功能、异步行为与 fallback 测试。 - test/test_copy_.py - 覆盖 pinned CPU → NPU、NPU → pinned CPU 的 mixed-dtype copy_(non_blocking=True)。 - 覆盖 int32 -> float32、int64 -> float32、float16 -> float32、float32 -> float16、complex64 <-> complex128 等基础转换组合。 - 扩展同步/异步结果一致性用例,覆盖 bool、int8、int16、uint16、int64、float16、bfloat16、float32、complex dtype,并包含负数、边界值、小数和复数数据。 - 通过 gate_stream 上的矩阵乘任务阻塞 copy_stream,再使用 done_event.query() 验证 copy_ 返回时没有同步等待异步拷贝完成。 - 补充非连续 NPU 目标、非连续 CPU pinned 目标、非连续 NPU 源、broadcast 源、带 storage offset 的 pinned CPU slice,以及连续 mixed-dtype 异步拷贝下 temporary 生命周期测试。 - 非连续 NPU 源用例覆盖 D2H mixed-dtype 场景,验证 _npu_dtype_cast 前的 format_contiguous 保护逻辑。 - 补充 float8_e5m2、float8_e4m3fn、complex32 等 aclnnCast unsupported dtype 的 CPU cast fallback 正确性测试。 - 保留 non_blocking=False 的 H2D/D2H mixed-dtype 结果正确性回归测试。 - mixed-dtype 相关用例限定在 Ascend910B、Ascend910_93、Ascend950 上执行。 3. 补充 Tensor.to mixed-dtype 跨设备测试。 - test/npu/test_npu.py - 新增 test_to_non_blocking_different_dtype,覆盖 CPU ↔ NPU、non_blocking=True/False 的跨设备 dtype 转换。 - 验证 int32 -> float32 转换结果正确性。 - 验证 D2H 且 non_blocking=True 时输出 Tensor 保持 pinned-memory 属性。 - 用例限定在 Ascend910B、Ascend910_93、Ascend950 上执行。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39577 | 1 个月前 | |
[feat] npu_format_cast supports nz2nd Co-authored-by: yuanshuai000<yuanshuai70@huawei.com> # message auto-generated for no-merge-commit merge: !34633 merge v2.7.1 into v2.7.1 [feat] npu_format_cast supports nz2nd Created-by: yuanshuai000 Commit-by: yuanshuai000 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. 4-bit场景支持ND的格式变化 2. 补充NZ_C0_X的Infer_Shape函数 3. 补充npu_format_cast接口的 nd2nz 和 nz2nd 测试用例 # 【资料变更】 新增npuFormatCast支持nz2nd的数据流:https://gitcode.com/cann/ops-math/blob/master/conversion/npu_format_cast/docs/aclnnNpuFormatCast.md # 【接口变更】 不涉及 # 【功能验证】 1. ACLNNFUZZ框架测试pta通路,覆盖4-bit, 8-bit, 16-bit. 32-bit的数据类型,维度覆盖2-6维,nz2nd功能均符合预期。 2. 新增ut测试看护TORCH API用例,ut通过 测试方法: cd test && python3 ./npu/test_npu_format.py 测试用例: float32类型ND -> NZ 以及 NZ -> ND ut测试结果: Ran 6 tests in 13.258s OK # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34633 | 3 个月前 | |
add torch.npu._sleep Co-authored-by: nomiz<1606135114@qq.com> # message auto-generated for no-merge-commit merge: !42710 merge v2.7.1 into v2.7.1 add torch.npu._sleep Created-by: nomiz Commit-by: nomiz Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/3339 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 新增torch.npu._sleep接口,功能对齐 torch.cuda._sleep,用于在当前 NPU Stream 上插入一个指定周期的忙等待(spin-wait)操作。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 ut用例验证通过截图  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42710 | 22 天前 | |
feat: Add ACLGraph update plans Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !36821 merge Pynative_refactor_aclgraph_update_20260519_2.7.1 into v2.7.1 feat: Add ACLGraph update plans Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2338 (https://gitcode.com/Ascend/pytorch/issues/2338) - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 新增 torch_npu._inductor.aclgraph_update_plan 模块,在 Inductor codegen 阶段生成 ACLGraph update plan,并在运行期根据 callable 属性解析 new_inputs 到 FA 类算子 actual sequence 参数的映射。 2. 在 NPU Python wrapper、MLIR/DVM wrapper、graph partition 子图 wrapper 中挂载 plan,支持 graph partition 开关下分别写入 call 或 partition_x 函数属性。 3. 在 _graph_tree record/replay 路径消费 update plan,record 后校验 plan 与真实 capture record 的顺序、算子名和可更新 key,replay 前解析为 CPU update input。 4. 将 IFA/IFA v2/FA3 等 npugraph handler 的 actual sequence 更新点改为 UPDATE_SPECS 声明式描述,并由 base handler 统一更新 args/kwargs。 5. 补充 plan 构建、plan 解析、handler 注册、wrapper emit、npugraphify callable 属性保持等单元测试,替换旧的集中测试文件。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及对外资料变更。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见 API 变更;新增 torch_npu._inductor.aclgraph_update_plan 为内部编译与 ACLGraph 运行期协同模块。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已补充并验证以下单测: 1. test/npu/test_aclgraph_update_plan.py 覆盖 plan 构建、输入映射、常量解析、非法 plan 校验。 2. test/npu/test_npugraph_handler.py 覆盖 IFA/IFA v2 handler 的 UPDATE_SPECS 注册。 3. test/_inductor/test_aclgraph_update_plan_compile.py 覆盖 wrapper/graph partition emit、MLIR/DVM wrapper、npugraphify callable 属性保持等非设备单测。 4. 多版本迁移后已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 分支通过静态检查和不涉及设备的单测验证。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36821 | 2 个月前 | |
support torch.npu.npurt Co-authored-by: bellatan<tanmei2@huawei.com> # message auto-generated for no-merge-commit merge: !39455 merge v2.7.1_torch_npurt into v2.7.1 support torch.npu.npurt Created-by: bellatan Commit-by: bellatan 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/2504 # 【资料变更】 新增接口 torch.npu.npurt() # 【接口变更】 新增接口 torch.npu.npurt() # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39455 | 1 个月前 | |
| 2 年前 | ||
test: add NPU coverage for Optimizer.zero_grad Co-authored-by: JfanLiu<1300083451@qq.com> # message auto-generated for no-merge-commit merge: !43537 merge test-optimizer-zero-grad-v271 into v2.7.1 test: add NPU coverage for Optimizer.zero_grad Created-by: JfanLiu Commit-by: JfanLiu Merged-by: ascend-robot Description: ## Related issue https://gitcode.com/Ascend/pytorch/issues/2739 ## Change summary - Add test/npu/test_optimizer_zero_grad.py. - Cover default behavior, boolean values, truthy/falsy int and list values, and invalid call signatures on NPU. ## Local validation - Target branch: v2.7.1 - Command: python /workspace/user_data/tasks/optimizer-zero-grad/pytorch-v271/test/npu/test_optimizer_zero_grad.py -v - Result: 4 tests passed on Ascend NPU. ## Notes - This change does not modify implementation code. - Previous PR: none. See merge request: Ascend/pytorch!43537 | 4 天前 | |
test update ut Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com> # message auto-generated for no-merge-commit merge: !39948 merge 2.7aclj1 into v2.7.1 test update ut Created-by: huangyunlong2022 Commit-by: huangyunlong2022 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能力等内容) 修复测试用例中python3.9语法兼容问题,python3.9 'staticmethod' object is not callable # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39948 | 1 个月前 | |
| 2 年前 | ||
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
| 1 年前 | ||
feat: support DVM MM template fusion Co-authored-by: huangchengnuo<huangchengnuo1@huawei.com> # message auto-generated for no-merge-commit merge: !42499 merge dvm-mm-template-fusion-v271-20260723 into v2.7.1 feat: support DVM MM template fusion Created-by: SorryNaCN Commit-by: huangchengnuo Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [x] 重构优化 - [ ] 资料更新 关联图模式 Issue:https://gitcode.com/Ascend/pytorch/issues/1978 移植来源:https://gitcode.com/Ascend/pytorch/merge_requests/40027 # 【修改方案】 1. 在 torch_npu._inductor.dvm.config 中增加 enable_matmul_fusion。该开关默认关闭,仅在设置 INDUCTOR_DVM_ENABLE_MATMUL_FUSION=1 时注册 DVM matmul template lowering,未启用时保持原有 DVM/Inductor 路径不变。 2. 为 aten.mm、aten.bmm、aten.addmm 与 aten.baddbmm 注册 DVM template lowering,并新增 DvmTemplateBuffer 保存 matmul template FX 图及逻辑 placeholder 到实际 IR 输入的绑定关系。生成 wrapper 调用前恢复真实参数;不满足 DVM shape/type 规则的场景继续走原有 fallback。 3. 保留 addmm 的原始算子形态以进入 template lowering,补齐 baddbmm 的转置标注、图构建参数透传和 DVM codegen;保持 addmm/baddbmm 的 alpha、beta 语义。K=1 的 mm、bmm 下沉为逐元素 mul,K=1 的 addmm 下沉为 mul 与 add 组合。 4. 在 NpuDvmScheduling 的 template codegen 中复用 NpuMetaScheduling 的 traced-graph 构图与回退能力。DVM matmul template 仅支持合法 pointwise epilogue 的纵向融合;prologue、horizontal fusion、reduction、template-to-template、group/numel 不一致及不支持的 broadcast 场景均不融合。 5. 移除 _is_view_only_graph 对纯 view、reshape、_unsafe_view epilogue 的额外拒绝逻辑,统一由既有 pointwise、shape、依赖和广播合法性检查决定是否进入 DVM template 融合路径。 6. 补充 mm、bmm、addmm、baddbmm 的 template fusion 回归覆盖,并覆盖 K=1、multi-user 输出、view/view+pointwise epilogue、view 输入及同一 buffer 多 view 场景。 # 【资料变更】 不涉及。 # 【接口变更】 不涉及客户可见接口变更。 # 【功能验证】 - 对全部变更 Python 文件执行 python3 -m py_compile,通过。 - 执行 git diff --check,通过。 - 完整 NPU 定向用例由 CI 执行。 ## 性能收益 该优化将 matmul 与下游 pointwise/view 融合为单个 DVM mix kernel,减少中间张量读写和 kernel launch。以下为 v2.9.0 同功能实测(端到端统计已排除首次编译与 warm-up): | 网络 / 指标(每 step) | Template OFF | Template ON | 时延收益 | |---|---:|---:|---:| | GLM-4-9B Chat LoRA BF16(batch 1、seq 512,稳态端到端) | 279.752 ms | 255.837 ms | **8.55%** | | Qwen2-VL-2B-Instruct LoRA BF16(batch 1、max length 512,step 11-51) | 773.792 ms | 747.664 ms | **3.38%** | | BERT_pytorch BF16(稳态端到端) | 23.3781 ms | 21.8458 ms | **6.55%** | | GLM-4-9B LoRA BF16(batch 1、seq 128,稳态端到端) | 219.3782 ms | 204.9709 ms | **6.57%** | | Llama3-8B LoRA BF16(batch 1、seq 128,稳态端到端) | 409.4111 ms | 393.3233 ms | **3.93%** | GLM-4-9B Chat 对应吞吐约提升 **9.34%**。GPT-OSS-20B 的 device kernel duration 为 -0.62%,当前不作为性能收益结论。 详细测试配置与完整数据见:https://gitcode.com/Ascend/pytorch/merge_requests/40027 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42499 | 25 天前 | |
test(npu): skip test_quantized_view_flatten_ravel due to x86 CI failure. Co-authored-by: Margaret_wangrui<wangrui178@huawei.com> # message auto-generated for no-merge-commit merge: !36856 merge v2.7.1_view_0524 into v2.7.1 test(npu): skip test_quantized_view_flatten_ravel due to x86 CI failure. Created-by: Margaret_wangrui Commit-by: Margaret_wangrui Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2123 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 用例上库时,门禁没跑到x86机器,未看护到,后续在x86上跑失败。 先skip掉处理,定位解决后再加上用例。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 不涉及。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36856 | 2 个月前 | |
| 2 年前 | ||
[feat] Add disable_tensor_unsafe_check option to restart_device Co-authored-by: LiNuohang<linuohang@huawei.com> # message auto-generated for no-merge-commit merge: !36163 merge bz-7 into v2.7.1 [feat] Add disable_tensor_unsafe_check option to restart_device Created-by: LiNuohang Commit-by: LiNuohang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 需求背景: 推理场景,不需要更新权重数据,因此发生uce故障时,存在只做流恢复,不需要做数据标脏和恢复的场景。当前快恢流恢复和数据标脏通过同一个配置项rebuild_all_resources控制,导致该场景无法使用,需要为数据标脏单独增加配置项。 当前现状: 当前快恢流恢复和数据标脏通过同一个配置项rebuild_all_resources控制 具体设计方案: 描述:restart_device接口增加disable_tensor_unsafe_check开关,用于单独控制是否对数据做标脏处理 为保证兼容性,默认为False,且仅在rebuild_all_resource为True时生效,即: rebuild_all_resources = True, disable_tensor_unsafe_check = True, 不做数据标脏 rebuild_all_resources = True, disable_tensor_unsafe_check= False, 做数据标脏 rebuild_all_resources = False, disable_tensor_unsafe_check= True, 不做数据标脏 rebuild_all_resources = False, disable_tensor_unsafe_check= False, 不做数据标脏 # 【资料变更】 restart_device接口增加disable_tensor_unsafe_check开关 # 【接口变更】 restart_device接口增加disable_tensor_unsafe_check开关 # 【功能验证】 已新增UT # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36163 | 2 个月前 | |
| 2 年前 | ||
round_size pad 32 byte Co-authored-by: zhaoyu<nanzhaogang@qq.com> # message auto-generated for no-merge-commit merge: !28328 merge v2.7.1 into v2.7.1 round_size pad 32 byte Created-by: zhaoyu65 Commit-by: zhaoyu 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 **What does this PR do / why do we need it**: round_size增加32byte,避免aclnn算子内存问题 **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!28328 | 7 个月前 | |
add record_stream sanitizer Co-authored-by: bellatan<tanmei2@huawei.com> Co-authored-by: hb_hubin<hubin79@huawei.com> # message auto-generated for no-merge-commit merge: !35835 merge v2.7.1_record_stream_sanitizer into v2.7.1 add record_stream sanitizer Created-by: bellatan Commit-by: bellatan;hb_hubin 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能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 本地验证 1. test/npu/test_sanitizer.py  2. test/npu/test_sanitizer_record_stream.py  3. test/test_npu_sanitizer.py  4. test/test_sanitizer_pluggable_allocator.py  5. ci结果 ·UT_ARM_A2_Part_01:test/test_npu_sanitizer.py,pass  ·UT_ARM_A2_Part_02:test/npu/test_sanitizer.py,pass;test/test_sanitizer_pluggable_allocator.py pass  ·UT_ARM_A2_Part_03:test/npu/test_sanitizer_record_stream.py,pass  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35835 | 2 个月前 | |
add record_stream sanitizer Co-authored-by: bellatan<tanmei2@huawei.com> Co-authored-by: hb_hubin<hubin79@huawei.com> # message auto-generated for no-merge-commit merge: !35835 merge v2.7.1_record_stream_sanitizer into v2.7.1 add record_stream sanitizer Created-by: bellatan Commit-by: bellatan;hb_hubin 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能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 本地验证 1. test/npu/test_sanitizer.py  2. test/npu/test_sanitizer_record_stream.py  3. test/test_npu_sanitizer.py  4. test/test_sanitizer_pluggable_allocator.py  5. ci结果 ·UT_ARM_A2_Part_01:test/test_npu_sanitizer.py,pass  ·UT_ARM_A2_Part_02:test/npu/test_sanitizer.py,pass;test/test_sanitizer_pluggable_allocator.py pass  ·UT_ARM_A2_Part_03:test/npu/test_sanitizer_record_stream.py,pass  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35835 | 2 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35871 merge v2.7.1_lintrunner into v2.7.1 fix: lintrunner --all-files --take NEWLINE -a 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/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35871 | 3 个月前 | |
fix d2h pinned memeory bug Co-authored-by: zzhongmin<zhongmin23@huawei.com> # message auto-generated for no-merge-commit merge: !31778 merge v2.7.1_fix_pinned into v2.7.1 fix d2h pinned memeory bug Created-by: zzhongmin Commit-by: zzhongmin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 --问题背景:在 NPU 序列化场景下,test_use_pinned_memory_for_d2h 期望 write_record 收到的是 pinned host storage 现有流程里,_reduce_ex_阶段在进入 _npu_save 前已把 storage 变成 CPU,导致原来的仅非 CPU storage 才走 pinned D2H 逻辑覆盖不到。 --解决方案:仅调整 NPU 保存路径,在 _npu_save 中保留原有 storage.device != cpu 的 pinned D2H 分支,新增 CPU fallback 当 use_pinned_memory_for_d2h=True 且当前 accelerator 为 npu 时,如果 storage 已是 CPU,也在写盘前转换为 pinned CPU storage,再 write_record。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 test_serialization.py -v -k test_use_pinned_memory_for_d2h用例通过 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!31778 | 4 个月前 | |
fix: route internal-format copy_ to native path and guard NPUStorageDesc access Co-authored-by: wuyouqi1<wuyouqi1@h-partners.com> # message auto-generated for no-merge-commit merge: !44450 merge personal/ci-revert-d2h-protection into v2.7.1 fix: route internal-format copy_ to native path and guard NPUStorageDesc access Created-by: wuyouqi1 Commit-by: wuyouqi1 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联 issue:https://gitcode.com/Ascend/pytorch/issues/2629 # 【修改方案】 前置pr为:https://gitcode.com/Ascend/pytorch/pull/40289 实现了修改点中的第一点。 本pr为以下修改点的第二点和第三点: ## 一、Ascend950 NZ 序列化 / D2H / 打印支持 - copy_ 增加 internal_format_opapi: True,内部格式 tensor 进入 op_api 路径; - aclnn 格式转换归一化:NZ_C0 变体归一化为 FRACTAL_NZ,≥4 字节类型补 FLOAT16 additionalDtype; - 序列化 FORMAT_INFO 增加 NZ_C0 格式名,支持 C0 变体文件兼容加载; - 私有格式 tensor 的 __repr__ 补丁:先 .cpu() 触发 d2h + 格式转换再打印。 ## 二、copy_ 内部格式路由修复 aclnnInplaceCopy 按 base format 布局写入,会损坏内部格式存储,在 copy_ 入口按平台分流: - **A2/A3**:任一输入为内部格式时回退原生 copy_(原生路径自行处理格式转换),base format 保持 aclnn 路径; - **Ascend950**:仅支持 device-to-host —— d2h 先 NZ→ND 转换再走 aclnn,h2d/d2d 遇内部格式报错。 实现细节:入口使用 IsOpInputBaseFormat 判断(legacy 加载的 from_blob tensor 视作 base format、不读 desc,legacy load 恢复可用);d2h 分支保留 IsBaseFormatType(legacy 保存命中第三部分拦截并抛异常)。 ## 三、GetNpuStorageImplDesc 异常值拦截 legacy 序列化的 _write_file/_set_from_file 使用 at::from_blob 产生 plain c10::StorageImpl tensor,读取 desc 越界("unknown format type:<垃圾值>")。GetNpuStorageImplDesc 增加动态类型检查(typeid == NPUStorageImpl),不满足时抛清晰异常:legacy 序列化保存 NPU tensor 不支持,请改用新版 zipfile 序列化。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 **新增用例**: - test/npu/test_serialization_format.py:TestCopyFormat(A2/A3:6 格式 × h2d/d2h + 6×6 d2d 全组合);TestCopyFormatAscend950(A5:base 对照、NZ d2h 遍历 fp16/bf16/i8/i32、NZ h2d/d2d 断言报错) **修复前 → 修复后**: | 场景 | 修复前 | 修复后 | |------|:---:|:---:| | A2/A3 内部格式 copy(ND→NZ / NZ→ND / NZ→NZ) | FAIL(静默损坏 / CANN 报错) | PASS(回退 native) | | A5 NZ d2h | PASS | PASS(NZ→ND cast 后走 aclnn) | | A5 NZ h2d / d2d | CANN 报错 | 清晰报错 "not supported on Ascend950" | **验证结果**: - A2A3 CI用例验证pass - A5运行CI用例结果如下: # python test_serialization_format.py s.[W814 10:14:44.341577560 OptionRegister.cpp:95] Warning: Current device only support allow_internal_format=False, the requested value True is invalid and has been reverted to False. (function operator()) ...stensor([[-0.1117, -0.4966, 0.1631, ..., -1.6592, -1.8770, 0.7373], [ 0.9258, 0.9248, 0.1825, ..., -0.5845, 0.9077, 0.4849], [-0.2632, -0.5435, -1.6406, ..., 2.1074, -0.9932, 1.4082], ..., [-1.2881, 1.3672, 0.1176, ..., 0.1048, -1.2842, 0.6128], [ 1.0059, -0.3564, 0.5537, ..., 1.5078, -1.5625, -0.9580], [-0.2183, -0.9858, -0.8320, ..., -0.8965, -2.1719, -0.2754]], dtype=torch.float16) tensor([[-0.4004, -2.3750, -0.2139, ..., 0.6875, -0.4141, -1.8359], [-0.2969, 1.0547, 0.0659, ..., 0.5430, -0.2002, 0.5039], [-0.3945, -0.4844, -1.0078, ..., 1.7266, 0.2930, -0.4062], ..., [-2.0625, 0.3613, -0.1099, ..., -0.2109, -0.5664, 0.9922], [ 1.1953, -0.7109, 1.3828, ..., 1.3125, -0.5039, 1.3359], [ 0.5430, 0.5625, -0.0708, ..., 1.0234, 0.5156, 0.2910]], dtype=torch.bfloat16) tensor([[ 1, -1, -1, ..., 0, 0, 0], [ 0, 1, 0, ..., 0, -1, -1], [ 0, 0, -1, ..., 0, 1, 0], ..., [ 1, 0, 0, ..., 1, 0, 0], [ 0, 0, 1, ..., 0, -1, 0], [ 0, 1, 0, ..., 0, -2, 0]], dtype=torch.int8) tensor([[ 0, 0, 0, ..., 0, 0, 0], [ 0, -1, -1, ..., 1, 0, -1], [ 0, 0, 1, ..., 0, 0, 1], ..., [-1, 1, -2, ..., -2, 0, 0], [ 1, 0, -1, ..., 0, 0, 0], [ 0, 0, 2, ..., -1, 0, 1]], dtype=torch.int32) .Warning: The current version of the file storing weights is old, and it is relanded due to internal bug of torch and compatibility issue. We will deprecate the loading support for this type of file in the future, please use newer torch to re-store the weight file. .Warning: The current version of the file storing weights is old, and it is relanded due to internal bug of torch and compatibility issue. We will deprecate the loading support for this type of file in the future, please use newer torch to re-store the weight file. . ---------------------------------------------------------------------- Ran 9 tests in 59.626s OK (skipped=2) # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!44450 | 2 天前 | |
[Task-47][v2.7.1] API Consistency: torch._C._set_warnAlways Co-authored-by: hongwei-2026<feizi_050920@qq.com> # message auto-generated for no-merge-commit merge: !41347 merge test-set_warnAlways-v2.7.1 into v2.7.1 [Task-47][v2.7.1] API Consistency: torch._C._set_warnAlways Created-by: hongwei-2026 Commit-by: hongwei-2026 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联Issue:https://gitcode.com/Ascend/pytorch/issues/2769 # 【修改方案】 本 PR 属于 Torch-NPU API 一致性对齐任务(任务 #47),面向 torch._C._set_warnAlways 完成 API 行为验证与测试用例补齐。 ## API 功能说明 torch._C._set_warnAlways 是 PyTorch 内部私有接口,用于设置是否始终输出警告信息。 **函数签名:** python torch._C._set_warnAlways(value: bool) -> None **参数:** - value (bool): 是否始终输出警告 ## 用例完整性说明 ### PyTorch 官方用例现状 torch._C._set_warnAlways 属于 PyTorch 内部私有接口,官方测试用例已有覆盖。该接口继承自 PyTorch 的 _C 模块,属于基础内部功能。 ### NPU 适配方案 **适配场景**:场景二(PyTorch 官方有用例,无需 NPU 适配修改) torch._C._set_warnAlways 接口仅设置内部警告状态,不涉及任何 NPU 计算操作,在 NPU 环境下直接继承自 PyTorch 原生实现。 ## 具体修改内容 本 PR 仅新增 1 个测试文件: test/npu/test_set_warnAlways.py # 【资料变更】 不涉及。 torch._C._set_warnAlways 属于 **PyTorch 私有内部接口**,按照社区规范无需补充对外公开文档。 # 【接口变更】 不涉及。 本 PR 仅新增测试文件,不修改产品源码中的函数签名、参数列表、返回值或跨仓调用关系,不产生客户面可见接口变化。 # 【功能验证】 ## 验证环境 | 组件 | 版本 | |------|------| | torch | 2.7.1+cpu | | torch_npu | 2.7.1.post6 | | CANN | 9.0.0 | ## 测试场景覆盖 python # 测试功能可用性 import torch torch._C._set_warnAlways(True) print("✓ torch._C._set_warnAlways(True) executed successfully") torch._C._set_warnAlways(False) print("✓ torch._C._set_warnAlways(False) executed successfully") # NPU环境验证 import torch_npu x = torch.randn(3, 4).npu() torch._C._set_warnAlways(True) torch._C._set_warnAlways(False) print("✓ torch._C._set_warnAlways works correctly in NPU environment") ## CPU/NPU 一致性验证 python import torch import torch_npu # CPU环境 torch._C._set_warnAlways(True) torch._C._set_warnAlways(False) print("✓ CPU: torch._C._set_warnAlways works") # NPU环境 x = torch.randn(3, 4).npu() torch._C._set_warnAlways(True) torch._C._set_warnAlways(False) print("✓ NPU: torch._C._set_warnAlways works") # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 --- ## 结论 torch._C._set_warnAlways API 在 v2.7.1 版本 NPU 环境下**无需代码改动**,功能与 PyTorch 官方 CPU 行为完全一致。 ## 资料补齐说明 torch._C._set_warnAlways 属于**PyTorch私有内部接口**,按照社区规范无需补充对外公开文档。 ## Checklist - [x] API功能验证完成 - [x] CPU/NPU一致性验证 - [x] Issue关联:#2769 - [x] 资料核查完成(私有接口无需补充文档) --- ## 测试截图  See merge request: Ascend/pytorch!41347 | 14 天前 | |
test: add test cases for torch.set_warn_always.The current test cases for torch.set_warn_always fail to cover all essential scenarios and must be completed. Co-authored-by: xin_heyun<919112805@qq.com> # message auto-generated for no-merge-commit merge: !43575 merge test_set_warn_always_v2.7.1 into v2.7.1 test: add test cases for torch.set_warn_always.The current test cases for torch.set_warn_always fail to cover all essential scenarios and must be completed. Created-by: xin_heyun Commit-by: xin_heyun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> issue分析报告:https://gitcode.com/Ascend/pytorch/issues/3619 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) ### 1. 新增测试用例 新增 test/npu/test_set_warn_always.py,在 TestSetWarnAlways 中提供 4 个测试方法: | 测试方法 | 可核验行号 | 验证场景 | |---|---:|---| | test_state_switching_and_return_value | 39 | 依次开启、关闭全量告警,检查返回值为 None,并通过查询接口确认状态。 | | test_warn_always_emits_repeated_warnings | 48 | 开启全量告警后连续触发同一 TORCH_WARN_ONCE 来源,确认两次警告均被记录。 | | test_warn_once_behavior_when_disabled | 64 | 在独立子进程中关闭全量告警,连续触发同一警告来源并确认只记录一次。 | | test_invalid_inputs_preserve_state | 95 | 覆盖非布尔值、关键字参数、缺少参数和多余参数,确认抛出异常且原有开启状态不被破坏。 | setUp 保存原始全局状态并注册清理函数,保证每个测试结束后恢复环境。重复告警场景使用只读 NumPy 数组转换作为稳定的 TORCH_WARN_ONCE 来源;该触发源不依赖 NPU 计算,符合目标 API 本身设备无关的语义。 **测试内容:** 测试直接调用 torch.set_warn_always,覆盖布尔状态切换、None 返回值、查询接口一致性、开启时重复发出警告、关闭时单次告警,以及非法调用不改变既有状态。测试文件在 torch-npu 环境中验证公共 C10 告警控制路径未受 NPU 扩展影响。 **新增原因及必要性:** 现有社区测试只在 Autograd 用例中通过上下文辅助函数间接启用全量告警,缺少对目标 API 独立契约和异常路径的直接覆盖。新增测试补齐 NPU 环境下的公共告警状态管理与 TORCH_WARN_ONCE 行为验证,可防止状态切换、参数校验或警告次数发生回归。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 结论:不涉及。 torch.set_warn_always 是公开的非计算类 API,现有 NPU 原生 API 资料已记录其原生文档链接、支持状态和设备限制,且未错误声明数据类型支持;完整变更范围仅新增测试文件,不需要更新对外资料。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 结论:不涉及。 完整变更范围仅新增 test/npu/test_set_warn_always.py,未修改目标 API 的实现、声明、注册、跨仓依赖或客户可见行为。 # 【功能验证】 ### master 执行命令: bash python test/npu/test_set_warn_always.py -v 结果: text test_invalid_inputs_preserve_state (__main__.TestSetWarnAlways.test_invalid_inputs_preserve_state) ... ok test_state_switching_and_return_value (__main__.TestSetWarnAlways.test_state_switching_and_return_value) ... ok test_warn_always_emits_repeated_warnings (__main__.TestSetWarnAlways.test_warn_always_emits_repeated_warnings) ... ok test_warn_once_behavior_when_disabled (__main__.TestSetWarnAlways.test_warn_once_behavior_when_disabled) ... ok ---------------------------------------------------------------------- Ran 4 tests in 7.480s OK ### v2.7.1 执行命令: bash python test/npu/test_set_warn_always.py -v 结果: text test_invalid_inputs_preserve_state (__main__.TestSetWarnAlways.test_invalid_inputs_preserve_state) ... ok test_state_switching_and_return_value (__main__.TestSetWarnAlways.test_state_switching_and_return_value) ... ok test_warn_always_emits_repeated_warnings (__main__.TestSetWarnAlways.test_warn_always_emits_repeated_warnings) ... ok test_warn_once_behavior_when_disabled (__main__.TestSetWarnAlways.test_warn_once_behavior_when_disabled) ... ok ---------------------------------------------------------------------- Ran 4 tests in 7.172s OK ### v2.11.0 执行命令: bash python test/npu/test_set_warn_always.py -v 结果: text test_invalid_inputs_preserve_state (__main__.TestSetWarnAlways.test_invalid_inputs_preserve_state) ... ok test_state_switching_and_return_value (__main__.TestSetWarnAlways.test_state_switching_and_return_value) ... ok test_warn_always_emits_repeated_warnings (__main__.TestSetWarnAlways.test_warn_always_emits_repeated_warnings) ... ok test_warn_once_behavior_when_disabled (__main__.TestSetWarnAlways.test_warn_once_behavior_when_disabled) ... ok ---------------------------------------------------------------------- Ran 4 tests in 7.220s OK ### v2.12.0 执行命令: bash python test/npu/test_set_warn_always.py -v 结果: text test_invalid_inputs_preserve_state (__main__.TestSetWarnAlways.test_invalid_inputs_preserve_state) ... ok test_state_switching_and_return_value (__main__.TestSetWarnAlways.test_state_switching_and_return_value) ... ok test_warn_always_emits_repeated_warnings (__main__.TestSetWarnAlways.test_warn_always_emits_repeated_warnings) ... ok test_warn_once_behavior_when_disabled (__main__.TestSetWarnAlways.test_warn_once_behavior_when_disabled) ... ok ---------------------------------------------------------------------- Ran 4 tests in 7.511s OK # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!43575 | 8 天前 | |
| 2 年前 | ||
[fix] revert #34662:restore double type conversion for Ascend950 Co-authored-by: wanlinan<wanlinan@huawei.com> # message auto-generated for no-merge-commit merge: !36057 merge v2.7.1 into v2.7.1 [fix] revert #34662:restore double type conversion for Ascend950 Created-by: wanlinan Commit-by: wanlinan Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 [[Bug]: A5机型Tensor.to去掉double强制转float逻辑后,下游算子报错](https://gitcode.com/Ascend/pytorch/issues/2018) - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 回退Ascend950机型to类型转换算子float转double,所有机型都恢复之前的逻辑,打印告警然后转成float32 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36057 | 2 个月前 | |
perf: defer dynamo/inductor import for v2.7.1 (#2788) Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !43391 merge v2.7.1_import into v2.7.1 perf: defer dynamo/inductor import for v2.7.1 (#2788) Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: # 【合入来源】 > 关联社区 issue:https://gitcode.com/Ascend/pytorch/issues/2788 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 ## 1. 背景与目标 原有 import torch_npu 会间接加载 torch._dynamo、torch._inductor 及大量子模块,增加导入耗时、内存占用和编译器初始化副作用。 本 PR 将图模式初始化从普通 import 阶段移出,同时保持公开接口的原有调用方式: - import torch_npu 不加载 torch._dynamo、torch._inductor、torch_npu._inductor。 - Dynamo、Inductor、TorchAir、NPUGraph 等能力在实际使用时初始化。 - torch.compile 的非 Inductor backend 不加载完整 NPU Inductor。 - Export、ONNX、FSDP、NPUGraph 等公开入口仍在使用前完成所需初始化。 ## 2. 拆分 Dynamo 与 Inductor 初始化 - _lazy_dynamo_setup() 负责 NPU DeviceInterface、Dynamo Variable/Stream/Event/autocast 补丁、trace rules 和 backend 注册。 - _lazy_inductor_setup() 仅在 inductor、npugraphs backend 使用时加载 torch_npu._inductor、NPU Inductor config 和 NPUGraph tree。 - 初始化使用带并发保护的 run_once,成功步骤单独记录;后续步骤失败时,已成功步骤不重复执行,失败初始化允许重试。 - torch.compile(options={"npu_backend": ...}) 在加载 NPU Inductor 前解析本次 options、全局 config 和环境变量,避免先按 default 初始化再切换 backend。 ## 3. 使用统一 Dynamo post-import 触发器 不再包装 torch.compile、torch.export.export、export_for_training、torch.onnx.export 等公开函数,避免改变公开函数对象、签名、装饰器语义,以及提前绑定接口绕过 wrapper。 import torch_npu 只安装 torch._dynamo post-import finder: - 首次导入 torch._dynamo 完成后,统一执行 _lazy_dynamo_setup()。 - 如果用户在 torch_npu 前已经导入 Dynamo,则在 import torch_npu 时补充 NPU 初始化。 - finder 委托其余 sys.meta_path finder 查找真实模块,不绕过其他自定义导入器。 - Export、ONNX Dynamo Export、compile 和提前绑定的公开入口都通过同一个 Dynamo 导入时机完成初始化。 torch.compiler.list_backends() 本身会导入 torch._dynamo,因此也会完成 NPU Dynamo 集成;该路径不会加载 NPU Inductor 或初始化 NPU 设备。三个 NPU backend 同时通过 torch_dynamo_backends entry point 暴露,首次 compile 前即可枚举: - npu - npugraph_ex - npugraphs ## 4. 公开接口和场景兼容处理 | 公开接口或场景 | 原始风险 | 当前处理 | |---|---|---| | torch.compiler.list_backends() | 首次 compile 前看不到 NPU backend | 通过 entry point 保持三个 backend 可见;调用时初始化 Dynamo,但不加载 NPU Inductor | | torch.compiler.npugraph_mark_step_begin() | 首次 compile 前接口不存在,或调用时过度加载编译器 | import 阶段暴露轻量无参接口;共享独立 step 状态,调用时不加载 Dynamo/Inductor | | torch_npu.distributed.tensor | import 阶段加载 DTensor experimental,继而传递导入 Dynamo/Inductor | tensor 子模块改为首次显式访问时导入;显式使用时继续执行原有 strategy 注册实现,不复制或修改 PyTorch register_sharding | | torch.export.export / export_for_training / export_for_inference | NPU Stream、Event、autocast 等捕获支持未初始化;提前绑定可能绕过 wrapper | 不包装公开函数,由统一 Dynamo post-import 触发;四种入口和绑定顺序均使用真实 NPU Export 验证 | | torch.onnx.export(..., dynamo=True) / torch.onnx.dynamo_export | ONNX 路径可能绕过 Export wrapper | 依赖统一 Dynamo post-import 触发;模块调用和两种提前绑定入口覆盖初始化链路 | | torch.compile(..., backend="eager"/custom/"npu") | 无条件加载完整 NPU Inductor | 只初始化 Dynamo,不加载 torch_npu._inductor | | torch.compile(..., backend="inductor"/"npugraphs") | NPU Inductor 尚未注册 | backend lookup 前完成 Dynamo 初始化,确定为 Inductor 类 backend 后再加载 NPU Inductor | | NPU DeviceInterface | 延迟导入后可能报 No interface for device npu | Dynamo 初始化时注册 npu 和 npu:0~31,Stream 接口回归通过 | | FSDP patch | import 阶段导入 FSDP 会间接加载 Dynamo | 使用 FSDP post-import patch,覆盖 torch_npu 前后两种导入顺序 | | torch_npu.npu.npugraph_ex | import torch_npu.npu 时提前加载图模式模块 | 使用模块 __getattr__ 按需导入,公开属性访问方式不变 | ## 5. DTensor 延迟导入与 NPUGraph step 状态拆分 - 不在 torch_npu 中复制 PyTorch 的 register_sharding 实现,也不改动 NPU DTensor 算子文件。普通 import torch_npu 不再主动导入 torch_npu.distributed.tensor;用户显式访问该子模块时,沿用 v2.7.1 原有初始化和 strategy 注册路径。 - MarkStepBox 和 mark_step_begin() 拆到轻量状态模块,公共 mark-step API 与完整 Graph Tree 共享计数状态,但不需要为一次标记加载完整编译器实现。 ## 6. 保留非编译器 import-time 行为 - 将不依赖 Inductor 的 RNG prim 和 decomposition patch 拆到 torch_npu/utils/_rng_prims_patch.py,普通 registry 继续执行这些基础 patch。 - torch_npu.utils._inductor 保留兼容重导出,不再承担完整 NPU Inductor 初始化。 - transfer_to_npu 在自身初始化入口显式导入实际需要修改的模块,不依赖 import torch_npu 的编译器隐式导入。 ## 7. 测试看护 新增或扩展的测试覆盖: - 普通 import torch_npu 不加载 Dynamo/Inductor,并保持公开函数对象不变。 - Dynamo 在 torch_npu 前后两种导入顺序。 - backend lookup 前完成初始化,list_backends() 可见三个 NPU backend。 - eager、自定义、npu、inductor、npugraphs backend 初始化边界。 - Export 四种公开入口/提前绑定顺序及六类 NPU 捕获语义:record_stream、Stream/Event、autocast、current device、device properties、is_available。 - ONNX 三种入口:模块 export、提前绑定 export、提前绑定旧 dynamo_export。 - FSDP 两种导入顺序。 - NPUGraph mark-step 接口签名、计数及无 compiler import。 - NPU DeviceInterface、初始化快照和既有 Stream/Event 捕获行为。 DTensor 的原有算子文件和 register_sharding 实现未修改,本 PR 不新增其实现副本或专项矩阵用例。 # 【资料变更】 不涉及。 # 【接口变更】 不涉及客户可见接口签名变更。torch.compile、Export/ONNX 公开函数不再被 torch_npu 包装;torch_npu.distributed.tensor 的公开访问方式不变,仅从 import 阶段加载调整为首次显式访问时加载。 # 【功能验证】 在 torch-npu-build-2.7.1-py311 环境使用真实 NPU 验证: - test/dynamo/test_compile_trigger.py 覆盖 import、Dynamo 触发、compile backend、Export、ONNX、FSDP、NPUGraph 和 DeviceInterface 路径。 - test/test_torch_npu_init.py:13/13 通过。 - test/npu/test_stream.py:10/10 通过。 - test/dynamo/test_trace_stream_event.py:1/1 通过。 - 显式访问 torch_npu.distributed.tensor 后,原有 NPU strategy 注册正常。 - py_compile、git diff --check 通过。 - 验证所需临时依赖和 Conda 文件均已恢复。 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!43391 | 7 天前 | |
AI assist developer for python dt third batch for 2.7.1 Co-authored-by: deepSeekya<chenzhihan6@huawei.com> # message auto-generated for no-merge-commit merge: !26518 merge v2.7.1 into v2.7.1 AI assist developer for python dt third batch for 2.7.1 Created-by: deepSeekya Commit-by: deepSeekya Merged-by: ascend-robot Description: 【合入说明】 AI辅助研发python dt测试用例生成。 【合入来源】 AI辅助研发需求 dt测试文件覆盖率提升。 See merge request: Ascend/pytorch!26518 | 8 个月前 | |
[fix]add empty_with_swapped_memory ut Co-authored-by: liangsongwei<liangsongwei@huawei.com> # message auto-generated for no-merge-commit merge: !30887 merge v2.7.1 into v2.7.1 [fix]add empty_with_swapped_memory ut Created-by: liangsongwei Commit-by: liangsongwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/1406 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 补充empty_with_swapped_memory接口预期计算值比对 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!30887 | 4 个月前 | |
test: add TensorMeta API validation Co-authored-by: zhaoziyi<zhaoziyi@isrc.iscas.ac.cn> # message auto-generated for no-merge-commit merge: !41434 merge intern/tensor-meta-v2-7-1 into v2.7.1 test: add TensorMeta API validation Created-by: zhaoziyi-2026 Commit-by: zhaoziyi Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联 issue: - 任务 issue:https://gitcode.com/Ascend/pytorch/issues/2773 # 【修改方案】 本 PR 在已有 Tensor 测试文件 test/npu/test_tensor.py 中补充 torch._C._TensorMeta 的 API 一致性验证用例。 torch._C._TensorMeta 是 PyTorch torch._C 内部元类,负责管理 torch.Tensor、torch.nn.Parameter 以及 torch.Tensor 子类等 Tensor 类对象的元类行为。经检查,PyTorch 上游仅在 JIT 报错路径中出现 _TensorMeta 字符串,不是目标 API 的直接专项测试;torch-npu 当前 test 目录中也未发现该 API 的专项测试。因此本 PR 按指导规范在已有 Tensor 测试文件中补充自写测试。 任务 API 功能、上游社区用例情况与本 PR 处理方式如下: | API | 功能说明 | 上游社区用例 / 覆盖情况 | 本 PR 处理 | | --- | --- | --- | --- | | torch._C._TensorMeta | PyTorch C 扩展内部元类,type(torch.Tensor) 对应 _TensorMeta。 | PyTorch 上游 test/test_jit.py 中存在错误信息包含 _TensorMeta 的间接覆盖,但不是目标 API 的直接专项测试。 | 在 test/npu/test_tensor.py 中补充专项测试,验证 Tensor 类元信息、NPU Tensor 实例关系、自定义 Tensor 子类和非法直接构造路径。 | 主要开发思路: 1. 先确认 torch._C._TensorMeta 在当前 torch-npu 环境中存在。 2. 复查 PyTorch 官方测试和 torch-npu 当前测试,未发现目标 _TensorMeta 的直接专项测试。 3. 该 API 属于 Tensor 类元信息相关能力,当前仓库已有 test/npu/test_tensor.py 覆盖 Tensor 基础行为,因此本 PR 将新增用例放入该文件。 4. 测试覆盖 _TensorMeta 与 torch.Tensor、torch.nn.Parameter、NPU Tensor 实例、自定义 Tensor 子类之间的关系,并验证 _TensorBase base 直接构造的异常路径。 5. 本 PR 仅补充测试,不修改 API 实现,不改变现有接口行为。 修改测试文件: 同步清理该文件中未使用的 import itertools。 ext test/npu/test_tensor.py 新增测试方法: text test_tensor_meta_matches_tensor_classes test_tensor_meta_with_npu_tensor_instance test_tensor_meta_subclass_and_direct_construction ` 各测试核心验证点如下: | 测试方法 | 核心验证点 | | --- | --- | | test_tensor_meta_matches_tensor_classes | 验证 _TensorMeta 是 torch.Tensor 的元类,并验证 torch.Tensor、torch.nn.Parameter 的类对象关系。 | | test_tensor_meta_with_npu_tensor_instance | 验证 NPU Tensor 实例仍是 torch.Tensor 实例,但不是 _TensorMeta 实例,同时其类对象由 _TensorMeta 管理。 | | test_tensor_meta_subclass_and_direct_construction | 验证自定义 torch.Tensor 子类使用 _TensorMeta,并验证以 torch._C._TensorBase 作为 base 直接调用 _TensorMeta(...) 会抛出预期异常。 | # 【资料变更】 不涉及资料 PR。 已检查 PyTorch 官方公开文档与 Ascend native API 文档,未发现 torch._C._TensorMeta 独立条目。该 API 属于 torch._C 私有接口,按指导文档不需要补充资料,因此不新增 docs.md,不提交资料 PR。 # 【接口变更】 不涉及。 本 PR 不修改 API 实现,不改变现有接口行为,不新增 torch-npu 对外接口。 # 【功能验证】 运行环境: text 操作系统:Ubuntu 22.04 昇腾硬件信息:910B CANN软件版本:9.0.0 安装的软件版本:torch 2.7.1,torch-npu 2.7.1 执行命令: bash cd /root python /root/pytorch/test/npu/test_tensor.py -k tensor_meta -v 执行结果: text test_tensor_meta_matches_tensor_classes (__main__.TestTensor) ... ok test_tensor_meta_subclass_and_direct_construction (__main__.TestTensor) ... ok test_tensor_meta_with_npu_tensor_instance (__main__.TestTensor) ... ok ---------------------------------------------------------------------- Ran 3 tests in 0.826s OK 最终验证结论: 1. 本 PR 补充 3 个 API 一致性测试,覆盖 torch._C._TensorMeta 的 Tensor 类元信息、NPU Tensor 实例关系、自定义 Tensor 子类和异常路径。 2. 补充测试不仅验证 API 可导入和可访问,也验证 _TensorMeta 与 torch.Tensor、torch.nn.Parameter`、NPU Tensor 实例之间的类型关系。 3. 补充测试涉及 Tensor 的部分已在当前 accelerator 上执行。 4. 补充测试已在 2.7.1 环境验证通过。 5. 目标 API 当前行为符合预期,未发现需要 API 功能补齐的问题。 6. 本 PR 不修改 API 实现,不涉及接口变更。 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41434 | 16 天前 | |
[Task-99][v2.7.1] API Consistency: Tensor.ndim Co-authored-by: hongwei-2026<feizi_050920@qq.com> # message auto-generated for no-merge-commit merge: !41340 merge test-ndim-v2.7.1 into v2.7.1 [Task-99][v2.7.1] API Consistency: Tensor.ndim Created-by: hongwei-2026 Commit-by: hongwei-2026 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联Issue:https://gitcode.com/Ascend/pytorch/issues/2724 资料核查结论参见:https://gitcode.com/Ascend/pytorch/issues/2834 # 【修改方案】 本 PR 属于 Torch-NPU API 一致性对齐任务,面向 Tensor.ndim 完成 v2.7.1 版本的 API 行为验证与测试用例补齐。 ## API 功能说明 Tensor.ndim 是只读属性,返回张量的维度数量,与 Tensor.dim() 和 Tensor.ndimension() 等价。 ## 用例完整性说明 ### PyTorch 官方用例现状 经检索 PyTorch 官方仓库(v2.7.1–v2.12.0),对 torch/、test/ 目录执行了以下检索: - grep -rn "\.ndim" test/ --include="*.py" — 未命中对该接口的独立直接测试 - grep -rn "ndim" torch/ --include="*.py" — 仅在 Tensor 类中存在属性/方法定义 **检索结论**:Tensor.ndim 在 PyTorch 核心测试中被 dim() 等关联 API 间接覆盖,但未发现针对该接口的独立聚焦测试用例,所有目标版本行为一致。 ### 新增用例原因 由于上游无独立聚焦用例,无法对 Tensor.ndim 的跨版本行为进行定向回归看护。按照任务文档场景三规范,自主编写完整测试用例,提交至 test/npu/ 目录。 ### NPU 适配方案 Tensor.ndim 仅读取张量元数据的维度信息,不涉及任何设备端计算或算子调度。在 NPU 环境下直接继承自 PyTorch 原生实现,无需代码适配。 ## 具体修改内容 本 PR 仅新增 1 个测试文件: test/npu/test_tensor_ndim.py **测试命令:** bash python test/npu/test_tensor_ndim.py **测试用例覆盖:** 1. test_ndim_0d_tensor — 0D 标量张量维度验证 2. test_ndim_1d_tensor — 1D 张量维度验证 3. test_ndim_2d_tensor — 2D 张量维度验证 4. test_ndim_3d_tensor — 3D 张量维度验证 5. test_ndim_4d_tensor — 4D 张量维度验证 6. test_ndim_cpu_npu_consistency — CPU/NPU 多形状维度一致性校验 7. test_ndim_after_operations — 张量运算后维度校验(加法、sum) 所有测试方法均使用 @SupportedDevices(['Ascend910A', 'Ascend910B', 'Ascend910_93', 'Ascend950']) 装饰器进行 NPU 可用性检查,未检测到 NPU 设备时自动跳过。使用 self.assert* 系列方法完成结果比对,张量通过 .npu() 迁移至 NPU 设备。 # 【资料变更】 不涉及。 经核查,Tensor.ndim 在 v2.7.1–v2.12.0、master 全版本 docs/zh/native_apis/pytorch_2-X-Y/torch-Tensor.md 表格中均已收录,无需补充文档。 # 【接口变更】 不涉及。 本 PR 仅新增测试文件,不修改产品源码中的函数签名、参数列表、返回值或跨仓调用关系,不产生客户面可见接口变化。 # 【功能验证】 ## 验证环境 | 组件 | 版本 | |------|------| | torch | 2.7.1+cpu | | torch_npu | 2.7.1.post6 | | CANN | 9.0.0 | ## 测试覆盖场景 python # 0D张量 x = torch.tensor(5).npu() assert x.ndim == 0 # 1D张量 x = torch.randn(5).npu() assert x.ndim == 1 # 2D张量 x = torch.randn(3, 4).npu() assert x.ndim == 2 # 3D张量 x = torch.randn(2, 3, 4).npu() assert x.ndim == 3 # 4D张量 x = torch.randn(2, 3, 4, 5).npu() assert x.ndim == 4 ## CPU/NPU 一致性验证 python cpu_tensor = torch.randn(3, 4, 5) npu_tensor = cpu_tensor.npu() assert cpu_tensor.ndim == npu_tensor.ndim # \u2705 一致 ## UT 验证 bash python test/npu/test_tensor_ndim.py -v 结果: test_ndim_0d_tensor (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_1d_tensor (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_2d_tensor (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_3d_tensor (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_4d_tensor (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_cpu_npu_consistency (test.npu.test_tensor_ndim.TestTensorNdim) ... ok test_ndim_after_operations (test.npu.test_tensor_ndim.TestTensorNdim) ... ok ---------------------------------------------------------------------- Ran 7 tests in 1.210s OK # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 --- ## 结论 Tensor.ndim API 在 v2.7.1 版本 NPU 环境下**无需代码改动**,功能与 PyTorch 官方 CPU 行为完全一致。 --- ## 测试截图  See merge request: Ascend/pytorch!41340 | 14 天前 | |
[Task-100][v2.7.1] API Consistency: Tensor.ndimension Co-authored-by: hongwei-2026<feizi_050920@qq.com> # message auto-generated for no-merge-commit merge: !41290 merge test-ndimension-v2.7.1 into v2.7.1 [Task-100][v2.7.1] API Consistency: Tensor.ndimension Created-by: hongwei-2026 Commit-by: hongwei-2026 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联Issue:https://gitcode.com/Ascend/pytorch/issues/2726 资料核查结论参见:https://gitcode.com/Ascend/pytorch/issues/2834 # 【修改方案】 本 PR 属于 Torch-NPU API 一致性对齐任务,面向 Tensor.ndimension 完成 v2.7.1 版本的 API 行为验证与测试用例补齐。 ## API 功能说明 Tensor.ndimension() -> int 返回张量的维度数量,是 Tensor.dim() 的别名,与 Tensor.ndim 属性等价。 ## 用例完整性说明 ### PyTorch 官方用例现状 经检索 PyTorch 官方仓库(v2.7.1–v2.12.0),对 torch/、test/ 目录执行了以下检索: - grep -rn "\.ndimension()" test/ --include="*.py" — 未命中对该接口的独立直接测试 - grep -rn "ndimension()" torch/ --include="*.py" — 仅在 Tensor 类中存在属性/方法定义 **检索结论**:Tensor.ndimension 在 PyTorch 核心测试中被 dim() 等关联 API 间接覆盖,但未发现针对该接口的独立聚焦测试用例,所有目标版本行为一致。 ### 新增用例原因 由于上游无独立聚焦用例,无法对 Tensor.ndimension 的跨版本行为进行定向回归看护。按照任务文档场景三规范,自主编写完整测试用例,提交至 test/npu/ 目录。 ### NPU 适配方案 Tensor.ndimension 仅读取张量元数据的维度信息,不涉及任何设备端计算或算子调度。在 NPU 环境下直接继承自 PyTorch 原生实现,无需代码适配。 ## 具体修改内容 本 PR 仅新增 1 个测试文件: test/npu/test_tensor_ndimension.py **测试命令:** bash python test/npu/test_tensor_ndimension.py **测试用例覆盖:** 1. test_ndimension_0d_tensor — 0D 标量张量维度验证 2. test_ndimension_1d_tensor — 1D 张量维度验证 3. test_ndimension_2d_tensor — 2D 张量维度验证 4. test_ndimension_3d_tensor — 3D 张量维度验证 5. test_ndimension_4d_tensor — 4D 张量维度验证 6. test_ndimension_cpu_npu_consistency — CPU/NPU 多形状维度一致性校验 7. test_ndimension_after_operations — 张量运算后维度校验(加法、sum) 8. test_ndimension_equals_ndim — ndimension() 与 ndim 属性等价性校验 所有测试方法均使用 @SupportedDevices(['Ascend910A', 'Ascend910B', 'Ascend910_93', 'Ascend950']) 装饰器进行 NPU 可用性检查,未检测到 NPU 设备时自动跳过。使用 self.assert* 系列方法完成结果比对,张量通过 .npu() 迁移至 NPU 设备。 # 【资料变更】 不涉及。 经核查,Tensor.ndimension 在 v2.7.1–v2.12.0、master 全版本 docs/zh/native_apis/pytorch_2-X-Y/torch-Tensor.md 表格中均已收录,无需补充文档。 # 【接口变更】 不涉及。 本 PR 仅新增测试文件,不修改产品源码中的函数签名、参数列表、返回值或跨仓调用关系,不产生客户面可见接口变化。 # 【功能验证】 ## 验证环境 | 组件 | 版本 | |------|------| | torch | 2.7.1+cpu | | torch_npu | 2.7.1.post6 | | CANN | 9.0.0 | ## 测试覆盖场景 python # 0D张量 x = torch.tensor(5).npu() assert x.ndimension() == 0 # 1D张量 x = torch.randn(5).npu() assert x.ndimension() == 1 # 2D张量 x = torch.randn(3, 4).npu() assert x.ndimension() == 2 # 3D张量 x = torch.randn(2, 3, 4).npu() assert x.ndimension() == 3 # 4D张量 x = torch.randn(2, 3, 4, 5).npu() assert x.ndimension() == 4 ## CPU/NPU 一致性验证 python cpu_tensor = torch.randn(3, 4, 5) npu_tensor = cpu_tensor.npu() assert cpu_tensor.ndimension() == npu_tensor.ndimension() # \u2705 一致 ## UT 验证 bash python test/npu/test_tensor_ndimension.py -v 结果: test_ndimension_0d_tensor (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_1d_tensor (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_2d_tensor (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_3d_tensor (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_4d_tensor (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_cpu_npu_consistency ... test_ndimension_after_operations (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok test_ndimension_equals_ndim (test.npu.test_tensor_ndimension.TestTensorNdimension) ... ok ---------------------------------------------------------------------- Ran 8 tests in 1.134s OK # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 --- ## 结论 Tensor.ndimension API 在 v2.7.1 版本 NPU 环境下**无需代码改动**,功能与 PyTorch 官方 CPU 行为完全一致。 --- ## 测试截图  See merge request: Ascend/pytorch!41290 | 14 天前 | |
del 910_95 Co-authored-by: MrMC-<shiqunze@h-partners.com> # message auto-generated for no-merge-commit merge: !30831 merge 2.7.1del-91095 into v2.7.1 del 910_95 Created-by: MrMC- Commit-by: MrMC- Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > A5改名需求 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 删除910_95 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!30831 | 4 个月前 | |
| 2 年前 | ||
test: add math SDP fp16 bf16 reduction API validation Co-authored-by: zhaoziyi<zhaoziyi@isrc.iscas.ac.cn> # message auto-generated for no-merge-commit merge: !41428 merge intern/math-sdp-fp16-bf16-reduction-v2-7-1 into v2.7.1 test: add math SDP fp16 bf16 reduction API validation Created-by: zhaoziyi-2026 Commit-by: zhaoziyi Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联 issue: - 任务 issue:https://gitcode.com/Ascend/pytorch/issues/2767 # 【修改方案】 本 PR 在已有 backend 测试文件 test/npu/test_torch_backends.py 中补充 torch._C._set_math_sdp_allow_fp16_bf16_reduction 的 API 一致性验证用例。 torch._C._set_math_sdp_allow_fp16_bf16_reduction 是 PyTorch torch._C 内部状态 setter,用于设置 math SDP 是否允许 fp16 / bf16 reduction。经检查,PyTorch 官方未提供该 API 的直接专项测试,torch-npu 当前 test 目录中也未发现该 API 的专项测试。因此本 PR 按指导规范在 torch-npu test 目录补充自写测试。 任务 API 功能、上游社区用例情况与本 PR 处理方式如下: | API | 功能说明 | 上游社区用例 / 覆盖情况 | 本 PR 处理 | | --- | --- | --- | --- | | torch._C._set_math_sdp_allow_fp16_bf16_reduction | PyTorch torch._C 内部状态 setter,用于设置 math SDP 是否允许 fp16 / bf16 reduction。 | 未检索到 PyTorch 官方直接专项测试;2.7.1 现有 test_upstream/test/test_transformers.py.patch 中涉及上层 wrapper torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp,但不是目标 _C setter 的直接专项测试。 | 在已有 backend 测试文件 test/npu/test_torch_backends.py 中补充用例,验证底层 setter / getter 状态切换、上层 backend wrapper 联动和异常输入路径。 | 主要开发思路: 1. 先确认 torch._C._set_math_sdp_allow_fp16_bf16_reduction 和配套 getter torch._C._get_math_sdp_allow_fp16_bf16_reduction 在当前 torch-npu 环境中均存在。 2. 复查 PyTorch 官方测试和 torch-npu 当前测试,未发现目标 _C setter 的直接专项测试。 3. 复查 2.7.1 现有 test_upstream/test/test_transformers.py.patch,其中覆盖的是上层 wrapper 调用和 SDPA 输出行为,不是本任务目标 API 的直接验证。 4. 该 API 不涉及 Tensor 输入,不存在需要迁移 Tensor 到 NPU 的适配点,因此不需要 test_upstream patch。 5. 该 API 属于 math SDP 全局状态控制接口,当前仓库已有 test/npu/test_torch_backends.py 覆盖 flash_sdp、mem_efficient_sdp、math_sdp 等 backend 开关,因此本 PR 将新增用例放入该文件。 6. 本 PR 仅补充测试,不修改 API 实现,不改变现有接口行为。 修改测试文件: text test/npu/test_torch_backends.py 新增测试方法: text test_math_sdp_allow_fp16_bf16_reduction_setter test_math_sdp_allow_fp16_bf16_reduction_backend_wrapper test_math_sdp_allow_fp16_bf16_reduction_invalid_value 各测试核心验证点如下: | 测试方法 | 核心验证点 | | --- | --- | | test_math_sdp_allow_fp16_bf16_reduction_setter | 验证 torch._C._set_math_sdp_allow_fp16_bf16_reduction(True / False) 可正确更新 torch._C._get_math_sdp_allow_fp16_bf16_reduction() 返回值。 | | test_math_sdp_allow_fp16_bf16_reduction_backend_wrapper | 验证上层 wrapper torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp(True / False) 控制的是同一个底层状态,不依赖 wrapper 返回值。 | | test_math_sdp_allow_fp16_bf16_reduction_invalid_value | 验证传入非 bool 值时会抛出异常,且当前 math SDP flag 不被错误输入改变。 | # 【资料变更】 不涉及资料 PR。 已检查 PyTorch 官方公开文档与 Ascend native API 文档,未发现 torch._C._set_math_sdp_allow_fp16_bf16_reduction 独立条目。该 API 属于 torch._C 私有接口,按指导文档不需要补充资料,因此不新增 docs.md,不提交资料 PR。 # 【接口变更】 不涉及。 本 PR 不修改 API 实现,不改变现有接口行为,不新增 torch-npu 对外接口。 # 【功能验证】 运行环境: text 操作系统:Ubuntu 22.04 昇腾硬件信息:910B CANN软件版本:9.0.0 安装的软件版本:torch 2.7.1,torch-npu 2.7.1 执行命令: bash cd /root python /root/pytorch/test/npu/test_torch_backends.py -k math_sdp_allow_fp16_bf16_reduction -v 执行结果: text test_math_sdp_allow_fp16_bf16_reduction_backend_wrapper (__main__.TorchBackendsApiTestCase) ... ok test_math_sdp_allow_fp16_bf16_reduction_invalid_value (__main__.TorchBackendsApiTestCase) ... ok test_math_sdp_allow_fp16_bf16_reduction_setter (__main__.TorchBackendsApiTestCase) ... ok ---------------------------------------------------------------------- Ran 3 tests in 0.823s OK 最终验证结论: 1. 本 PR 补充 3 个 API 一致性测试,覆盖 torch._C._set_math_sdp_allow_fp16_bf16_reduction 的正常状态切换、backend wrapper 联动和异常输入路径。 2. 补充测试不仅验证 API 可调用,也验证 setter / getter 状态一致性、wrapper 对同一底层 flag 的控制能力,以及错误输入不会污染全局状态。 3. 该 API 不涉及 Tensor 输入,不需要 NPU Tensor 迁移适配。 4. 补充测试已在 2.7.1 环境验证通过。 5. 目标 API 当前行为符合预期,未发现需要 API 功能补齐的问题。 6. 本 PR 不修改 API 实现,不涉及接口变更。 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41428 | 26 天前 | |
| 2 年前 | ||
| 1 年前 | ||
use torch_npu._C instead of option Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com> # message auto-generated for no-merge-commit merge: !43704 merge 2.7fille into v2.7.1 use torch_npu._C instead of option Created-by: huangyunlong2022 Commit-by: huangyunlong2022 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 使用torch_npu.\_C接口替换option接口 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!43704 | 15 天前 | |
support torch.npu.npurt Co-authored-by: bellatan<tanmei2@huawei.com> # message auto-generated for no-merge-commit merge: !39455 merge v2.7.1_torch_npurt into v2.7.1 support torch.npu.npurt Created-by: bellatan Commit-by: bellatan 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/2504 # 【资料变更】 新增接口 torch.npu.npurt() # 【接口变更】 新增接口 torch.npu.npurt() # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39455 | 1 个月前 | |
| 2 年前 | ||
pta supports to create nested tensor Co-authored-by: chenshuai<chenshuai81@huawei.com> # message auto-generated for no-merge-commit merge: !30194 merge cherry-pick-mr-30193-1769658913214-auto into v2.7.1 pta supports to create nested tensor Created-by: culechan Commit-by: chenshuai 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!30194 | 6 个月前 | |
| 2 年前 | ||
add UTs Co-authored-by: xieyouwang<xieyouwang@huawei.com> # message auto-generated for no-merge-commit merge: !33104 merge v2.7.1 into v2.7.1 add UTs Created-by: qq_52711437 Commit-by: xieyouwang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [x] 问题单 # 【修改方案】 使用用例生成skill为21个API生成UT。 torch._running_with_deploy torch.utils._python_dispatch.is_traceable_wrapper_subclass torch._dynamo.comptime.comptime.print torch._dynamo.config torch._dynamo.config.skip_fsdp_hooks torch._C.DispatchKey.Functionalize torch._C.DispatchKeySet torch._C._ExcludeDispatchKeyGuard torch._from_functional_tensor torch.__future__.get_swap_module_params_on_conversion torch._C._get_accelerator torch._dynamo.disable torch._foreach_copy_ torch.as_strided torch.autograd.profiler.record_function torch.autograd.Variable._execution_engine.queue_callback torch.empty_like torch.nn.Parameter.grad torch.nn.Parameter.device torch._prims_common.make_contiguous_strides_for torch.fx.node.has_side_effect # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 | 序号 | API | 仓库内路径 | 用例数 | 覆盖范围 | |------|-----|-----------|--------|----------| | 1 | torch._running_with_deploy | test/npu/test__running_with_deploy.py | 3 | 返回值类型校验、布尔值验证、非法参数异常 | | 2 | torch.utils._python_dispatch.is_traceable_wrapper_subclass | test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py | 4 | 普通 Tensor、NPU Tensor、非 Tensor 类型、None 输入 | | 3 | torch._dynamo.comptime.comptime.print | test/npu/test__dynamo_comptime_comptime_print.py | 13 | 多种数据类型(string/int/float/bool/list/dict/None/tensor)、空字符串、空 tensor、单元素 tensor、缺参/多参异常 | | 4 | torch._dynamo.config | test/npu/test__dynamo_config.py | 5 | 模块类型校验、verbose/cache_size_limit/suppress_errors/dynamic_shapes 属性可访问性 | | 5 | torch._dynamo.config.skip_fsdp_hooks | test/npu/test__dynamo_config_skip_fsdp_hooks.py | 2 | 属性布尔类型校验、读写一致性 | | 6 | torch._C.DispatchKey.Functionalize | test/npu/test__C_DispatchKey_Functionalize.py | 3 | 枚举值整数类型、非负性、name 属性 | | 7 | torch._C.DispatchKeySet | test/npu/test__C_DispatchKeySet.py | 5 | 创建、has/add/remove 操作、非法类型异常 | | 8 | torch._C._ExcludeDispatchKeyGuard | test/npu/test__C__ExcludeDispatchKeyGuard.py | 4 | 上下文管理器创建、单 key/多 key 排除、非法类型异常 | | 9 | torch._from_functional_tensor | test/npu/test__from_functional_tensor.py | 6 | CPU/NPU tensor、float16 dtype、空 tensor、标量 tensor 下均抛出 RuntimeError、非法类型 TypeError | | 10 | torch.__future__.get_swap_module_params_on_conversion | test/nn/test___future__get_swap_module_params_on_conversion.py | 2 | 返回值布尔类型、非法参数 TypeError | | 11 | torch._C._get_accelerator | test/npu/test__C__get_accelerator.py | 4 | 无参调用、check=True/False 返回值、非法类型 TypeError | | 12 | torch._dynamo.disable | test/dynamo/test__dynamo_disable.py | 3 | 装饰器基本功能、recursive=False 模式、非法目标 AssertionError | | 13 | torch._foreach_copy_ | test/npu/test__foreach_copy_.py | 6 | NPU 基本拷贝、float16 dtype、空 tensor、混合设备拷贝数据验证、非法单 tensor TypeError、CPU 基线对比 | | 14 | torch.as_strided | test/npu/test_as_strided.py | 7 | NPU 视图数据正确性(确定性数据验证)、storage_offset、空 tensor、标量 tensor、dtype 保持、stride/size 不匹配异常、CPU 基线对比 | | 15 | torch.autograd.profiler.record_function | test/profiler/test_autograd_profiler_record_function.py | 5 | 上下文管理器、带参数调用、装饰器模式、空字符串名称、缺参异常 | | 16 | torch.autograd.Variable._execution_engine.queue_callback | test/test_autograd_Variable__execution_engine_queue_callback.py | 3 | backward 中回调执行验证(含 assertTrue 断言回调是否被调用)、lambda 回调、backward 外调用 RuntimeError | | 17 | torch.empty_like | test/npu/test_empty_like.py | 6 | NPU 基本创建、指定 dtype、memory_format、标量 tensor、空 tensor、CPU 基线对比 | | 18 | torch.nn.Parameter.grad | test/npu/test_nn_Parameter_grad.py | 15 | 初始 None、backward 后赋值、requires_grad=False、梯度累积、梯度清零、多种 dtype(float16 dtype 兼容 float32 提升)、空/标量/1D/3D tensor、优化器场景、detach 场景、复杂计算图、连续性 | | 19 | torch.nn.Parameter.device | test/npu/test_nn_Parameter_device.py | 4 | NPU 设备、CPU 设备、多种 dtype 变体、标量 tensor | | 20 | torch._prims_common.make_contiguous_strides_for | test/npu/test__prims_common_make_contiguous_strides_for.py | 6 | row-major stride 值验证 (12,4,1)、row_major=False stride 值验证 (12,1,3)、空 shape、1D shape、list 输入、非法类型 TypeError | | 21 | torch.fx.node.has_side_effect | test/test_fx_node_has_side_effect.py | 3 | 装饰器基本功能、lambda 函数、非 callable 透传行为(附注释说明为实现细节) | **测试命令** bash # test/npu/ 目录下的用例 python test/npu/test__running_with_deploy.py python test/npu/test_utils__python_dispatch_is_traceable_wrapper_subclass.py python test/npu/test__dynamo_comptime_comptime_print.py python test/npu/test__dynamo_config.py python test/npu/test__dynamo_config_skip_fsdp_hooks.py python test/npu/test__C_DispatchKey_Functionalize.py python test/npu/test__C_DispatchKeySet.py python test/npu/test__C__ExcludeDispatchKeyGuard.py python test/npu/test__from_functional_tensor.py python test/npu/test__C__get_accelerator.py python test/npu/test__foreach_copy_.py python test/npu/test_as_strided.py python test/npu/test_empty_like.py python test/npu/test_nn_Parameter_grad.py python test/npu/test_nn_Parameter_device.py python test/npu/test__prims_common_make_contiguous_strides_for.py # 其他目录下的用例 python test/dynamo/test__dynamo_disable.py python test/nn/test___future__get_swap_module_params_on_conversion.py python test/profiler/test_autograd_profiler_record_function.py python test/test_autograd_Variable__execution_engine_queue_callback.py python test/test_fx_node_has_side_effect.py **验证结果** 本地 NPU 环境下,21 个测试文件共 103 条用例全部通过(OK)。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33104 | 4 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 2 个月前 | ||
| 5 个月前 | ||
| 4 个月前 | ||
| 2 个月前 | ||
| 5 个月前 | ||
| 14 天前 | ||
| 2 个月前 | ||
| 28 天前 | ||
| 1 年前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 8 个月前 | ||
| 4 个月前 | ||
| 10 个月前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 9 个月前 | ||
| 6 个月前 | ||
| 2 年前 | ||
| 6 个月前 | ||
| 8 天前 | ||
| 4 个月前 | ||
| 27 天前 | ||
| 2 年前 | ||
| 3 个月前 | ||
| 29 天前 | ||
| 4 个月前 | ||
| 2 年前 | ||
| 8 天前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 30 天前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 7 天前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 5 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 3 个月前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 22 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 2 年前 | ||
| 4 天前 | ||
| 1 个月前 | ||
| 2 年前 | ||
| 3 个月前 | ||
| 1 年前 | ||
| 25 天前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 7 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 4 个月前 | ||
| 2 天前 | ||
| 14 天前 | ||
| 8 天前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 7 天前 | ||
| 8 个月前 | ||
| 4 个月前 | ||
| 16 天前 | ||
| 14 天前 | ||
| 14 天前 | ||
| 4 个月前 | ||
| 2 年前 | ||
| 26 天前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 15 天前 | ||
| 1 个月前 | ||
| 2 年前 | ||
| 6 个月前 | ||
| 2 年前 | ||
| 4 个月前 |