已合并
move_npu_patch_meta_to_module_level #39681
cuiduo创建于 6月30日
move_npu_patch_meta_to_module_level #39681
已合并
cuiduo创建于 6月30日
2 个文件变更+3-4
@@ -1,7 +1,6 @@
1import torch1import torch
2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
3from testutils import TestUtils3from testutils import TestUtils
4-import torch_npu
5 4 
6 5 
7class TestLog(TestUtils):6class TestLog(TestUtils):
@@ -16,6 +16,9 @@ from .utils import patch_has_triton, patch_has_triton_tma, patch_is_gpu, get_cur
16# All backends need npu/cpu/mps device_op_overrides.16# All backends need npu/cpu/mps device_op_overrides.
17from .codegen.common import register_device_op_overrides_npu, patch_cache_base_get_system17from .codegen.common import register_device_op_overrides_npu, patch_cache_base_get_system
18from .shape_handling import NPUShapeHandling, patch_shape_handling18from .shape_handling import NPUShapeHandling, patch_shape_handling
19+from ._npu_meta_registration import npu_patch_meta
20+ 
21+npu_patch_meta()
19register_device_op_overrides_npu()22register_device_op_overrides_npu()
20patch_has_triton()23patch_has_triton()
21patch_is_gpu()24patch_is_gpu()
@@ -137,9 +140,6 @@ def _load_triton_backend():
137 from .graph import patch_count_bytes, patch_run_node140 from .graph import patch_count_bytes, patch_run_node
138 from .autotune_process import patch_tuning_process, patch_tuning_process_pool141 from .autotune_process import patch_tuning_process, patch_tuning_process_pool
139 flex_attention._validate_device = _validate_device142 flex_attention._validate_device = _validate_device
140- from ._npu_meta_registration import npu_patch_meta
141- 
142- npu_patch_meta()
143 143 
144 def _inductor_register_backend_for_device():144 def _inductor_register_backend_for_device():
145 from .codegen.cpp_wrapper import CppWrapperNpu145 from .codegen.cpp_wrapper import CppWrapperNpu