已合并
【inductor】fix inductor ci bug #30175
kkjocker创建于 1月29日
【inductor】fix inductor ci bug #30175
已合并
kkjocker创建于 1月29日
9 个文件变更+9-19
@@ -1,11 +1,9 @@
1-import unittest
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
4from testutils import TestUtils3from testutils import TestUtils
5import torch_npu4import torch_npu
6 5 
7 6 
8-@unittest.skip("This test is not supported yet")
9class TestAttnCp(TestUtils):7class TestAttnCp(TestUtils):
10 shape = (8, 8, 256, 128)8 shape = (8, 8, 256, 128)
11 dim = -19 dim = -1
@@ -1,11 +1,9 @@
1-import unittest
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
4from testutils import TestUtils3from testutils import TestUtils
5import torch_npu4import torch_npu
6 5 
7 6 
8-@unittest.skip("This test is not supported yet")
9class TestNativeBatchNorm(TestUtils):7class TestNativeBatchNorm(TestUtils):
10 def op_calc(self, input_element):8 def op_calc(self, input_element):
11 # 创建权重和偏置张量9 # 创建权重和偏置张量
@@ -1,4 +1,3 @@
1-from unittest import skip
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests2from torch.testing._internal.common_utils import run_tests
4from testutils import TestUtils3from testutils import TestUtils
@@ -20,7 +19,6 @@ class Test_issue59(TestUtils):
20 mean_2 = rsqrt / torch.numel(rsqrt)19 mean_2 = rsqrt / torch.numel(rsqrt)
21 return mul, add, mean_220 return mul, add, mean_2
22 21 
23- @skip("skip ci error")
24 def test_issue59(self):22 def test_issue59(self):
25 device = 'npu'23 device = 'npu'
26 x = torch.randn((1, 1024), device=device, dtype=torch.float32)24 x = torch.randn((1, 1024), device=device, dtype=torch.float32)
@@ -1,4 +1,3 @@
1-import unittest
2import torch1import torch
3from torch_npu.npu import device_count2from torch_npu.npu import device_count
4from torch_npu.utils._dynamo_device import NpuInterface, current_device, set_device3from torch_npu.utils._dynamo_device import NpuInterface, current_device, set_device
@@ -8,7 +7,6 @@ from torch_npu._inductor.npu_device import NewNPUDeviceOpOverrides
8from torch_npu.testing.testcase import TestCase, run_tests7from torch_npu.testing.testcase import TestCase, run_tests
9 8 
10 9 
11-@unittest.skip("This test is not supported yet")
12class TestNpuDevice(TestCase):10class TestNpuDevice(TestCase):
13 def test_aoti_get_stream(self):11 def test_aoti_get_stream(self):
14 overrides = NewNPUDeviceOpOverrides()12 overrides = NewNPUDeviceOpOverrides()
@@ -1,11 +1,9 @@
1-import unittest
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
4from testutils import TestUtils3from testutils import TestUtils
5import torch_npu4import torch_npu
6 5 
7 6 
8-@unittest.skip("This test is not supported yet")
9class TestSumAdd(TestUtils):7class TestSumAdd(TestUtils):
10 def foo(self, a, b, dim, shape):8 def foo(self, a, b, dim, shape):
11 y = a + b9 y = a + b
@@ -1,11 +1,9 @@
1-import unittest
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
4from testutils import TestUtils3from testutils import TestUtils
5import torch_npu4import torch_npu
6 5 
7 6 
8-@unittest.skip("This test is not supported yet")
9class TestRenorm(TestUtils):7class TestRenorm(TestUtils):
10 def op_calc(self, input_element, dim):8 def op_calc(self, input_element, dim):
11 return torch.renorm(input_element, p=2, dim=dim, maxnorm=5)9 return torch.renorm(input_element, p=2, dim=dim, maxnorm=5)
@@ -1,4 +1,3 @@
1-from unittest import skip
2import torch1import torch
3from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests2from torch.testing._internal.common_utils import run_tests, parametrize, instantiate_parametrized_tests
4from testutils import TestUtils3from testutils import TestUtils
@@ -10,7 +9,6 @@ class TestVarMean(TestUtils):
10 return torch.var_mean(input_element, dim)9 return torch.var_mean(input_element, dim)
11 10 
12 # case:The shape must not be too large11 # case:The shape must not be too large
13- @skip("skip ci codegen error")
14 @parametrize('shape', [(8, 64, 128)])12 @parametrize('shape', [(8, 64, 128)])
15 @parametrize('dim', [0, 1, 2, (0, 2), (0, 1)])13 @parametrize('dim', [0, 1, 2, (0, 2), (0, 1)])
16 @parametrize('dtype', ['float32'])14 @parametrize('dtype', ['float32'])
@@ -166,12 +166,13 @@ def substituted_dims_in_indexing(self, indexing, kernel, range_tree_nodes_substi
166 return substituted166 return substituted
167 167 
168 168 
169-def generate_body_indexing(body, indices):169+def generate_body_indexing(body, indices, allow_same_symbol_in_index=False):
170 index = list(itertools.chain.from_iterable(indices))170 index = list(itertools.chain.from_iterable(indices))
171 if not (len(index) == len(body.var_ranges)):171 if not (len(index) == len(body.var_ranges)):
172 raise RuntimeError("assert len(index) == len(body.var_ranges), (index, body.var_ranges)")172 raise RuntimeError("assert len(index) == len(body.var_ranges), (index, body.var_ranges)")
173- if not (all(v not in body.var_ranges for v in index)):173+ if not allow_same_symbol_in_index:
174- raise RuntimeError("assert all(v not in body.var_ranges for v in index)")174+ if not (all(v not in body.var_ranges for v in index)):
175+ raise RuntimeError("assert all(v not in body.var_ranges for v in index)")
175 176 
176 replacements = dict(zip(body.var_ranges.keys(), index))177 replacements = dict(zip(body.var_ranges.keys(), index))
177 indexing_map = dict(zip(index, body.var_ranges.keys()))178 indexing_map = dict(zip(index, body.var_ranges.keys()))
@@ -193,7 +194,7 @@ def transform_dims_in_indexing(self, indices):
193# select tiling axis, recover missing dimensions,194# select tiling axis, recover missing dimensions,
194def loopbody__call__(self, *indices, allow_same_symbol_in_index=False):195def loopbody__call__(self, *indices, allow_same_symbol_in_index=False):
195 if self.indexing is None:196 if self.indexing is None:
196- generate_body_indexing(self, indices)197+ generate_body_indexing(self, indices, allow_same_symbol_in_index)
197 result = self.root_block()198 result = self.root_block()
198 self.indexing = None199 self.indexing = None
199 return result200 return result
@@ -1185,7 +1185,10 @@ class NPUIndexTritonKernel(TritonKernel):
1185 ) -> Union[CSEVariable, Tuple[CSEVariable, ...]]:1185 ) -> Union[CSEVariable, Tuple[CSEVariable, ...]]:
1186 if not self.inside_reduction:1186 if not self.inside_reduction:
1187 raise RuntimeError("assert self.inside_reduction")1187 raise RuntimeError("assert self.inside_reduction")
1188- masks = {f"{node.symbol()}_mask" for node in self.sorted_axis}1188+ if self.persistent_reduction and self.numof_reduction_axis() == 1:
1189+ masks = {f"{node.symbol()}_mask" for node in self.sorted_axis if node.name[0] != "r"}
1190+ else:
1191+ masks = {f"{node.symbol()}_mask" for node in self.sorted_axis}
1189 self.filter_masks(masks)1192 self.filter_masks(masks)
1190 masks = sorted(masks)1193 masks = sorted(masks)
1191 if self._load_mask:1194 if self._load_mask: