Skip to content

Commit 7c934db

Browse files
zingofreddan80
authored andcommitted
Arm Backend: Update Ethos-U compiler Vela to 4.1.0
This fix a code generation problem. Some Ethos-U85 tests starts working and some Ethos-U55 tests are disabled due to more stricts testing added to vela compiler. Signed-off-by: Zingo Andersen <[email protected]> Change-Id: I53a10a1675cea34e105e04f864dfa3cb4cc626fa
1 parent d243ffe commit 7c934db

13 files changed

+201
-55
lines changed

backends/arm/test/ops/test_bmm.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class TestBMM(unittest.TestCase):
2222

2323
class BMM(torch.nn.Module):
2424
test_parameters = [
25-
(torch.rand(5, 3, 5), torch.rand(5, 5, 2)),
2625
(torch.rand(2, 1, 1), torch.rand(2, 1, 1)),
26+
(torch.rand(5, 3, 5), torch.rand(5, 5, 2)),
2727
(torch.ones(1, 55, 3), torch.ones(1, 3, 44)),
2828
(10000 * torch.randn(10, 1, 10), torch.randn(10, 10, 5)),
2929
(-10 * torch.randn(2, 32, 64), 5 + 5 * torch.randn(2, 64, 32)),
@@ -147,32 +147,37 @@ def test_bmm_single_input_tosa_BI(self, operand1: torch.Tensor):
147147

148148
@parameterized.expand(BMM.test_parameters)
149149
@unittest.expectedFailure
150-
def test_bmm_u55_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
150+
def test_bmm_u55_BI_xfails(self, operand1: torch.Tensor, operand2: torch.Tensor):
151151
test_data = (operand1, operand2)
152152
self._test_bmm_ethosu_BI_pipeline(
153153
self.BMM(), common.get_u55_compile_spec(), test_data
154154
)
155155

156-
@parameterized.expand(BMM.test_parameters)
157-
@common.expectedFailureOnFVP
156+
@parameterized.expand(BMM.test_parameters[:1])
158157
def test_bmm_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
159158
test_data = (operand1, operand2)
160159
self._test_bmm_ethosu_BI_pipeline(
161160
self.BMM(), common.get_u85_compile_spec(), test_data
162161
)
163162

163+
@parameterized.expand(BMM.test_parameters[1:])
164+
@unittest.expectedFailure
165+
def test_bmm_u85_BI_xfails(self, operand1: torch.Tensor, operand2: torch.Tensor):
166+
test_data = (operand1, operand2)
167+
self._test_bmm_ethosu_BI_pipeline(
168+
self.BMM(), common.get_u85_compile_spec(), test_data
169+
)
170+
164171
# Expected to fail with error: Warning, unsupported fusing of TOSA Rescale previous operator is of type: Memcpy
165172
@parameterized.expand(BMMSingleInput.test_parameters)
166173
@unittest.expectedFailure
167-
def test_bmm_single_input_u55_BI(self, operand1: torch.Tensor):
174+
def test_bmm_single_input_u55_BI_xfails(self, operand1: torch.Tensor):
168175
test_data = (operand1,)
169176
self._test_bmm_ethosu_BI_pipeline(
170177
self.BMMSingleInput(), common.get_u55_compile_spec(), test_data
171178
)
172179

173-
# Numerical issues on FVP, MLETORCH 534
174180
@parameterized.expand(BMMSingleInput.test_parameters)
175-
@common.expectedFailureOnFVP
176181
def test_bmm_single_input_u85_BI(self, operand1: torch.Tensor):
177182
test_data = (operand1,)
178183
self._test_bmm_ethosu_BI_pipeline(

backends/arm/test/ops/test_conv_combos.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ def test_conv_meandim_u55_BI(self):
275275
model.get_inputs(),
276276
)
277277

278-
# Numerical Issues on FVP, MLETORCH-520
279-
@common.expectedFailureOnFVP
280278
def test_conv_meandim_u85_BI(self):
281279
model = ComboConv2dMeandim()
282280
self._test_conv_combo_ethos_BI_pipeline(

backends/arm/test/ops/test_depthwise_conv.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@
156156
("two_dw_conv2d", two_dw_conv2d),
157157
]
158158

159+
testsuite_conv2d_u85 = [
160+
("2x2_1x6x4x4_gp6_st1", dw_conv2d_2x2_1x6x4x4_gp6_st1),
161+
("3x3_1x3x256x256_gp3_st1", dw_conv2d_3x3_1x3x256x256_gp3_st1),
162+
("3x3_1x4x256x256_gp4_st1", dw_conv2d_3x3_1x4x256x256_gp4_st1),
163+
("3x3_1x4x256x256_gp4_nobias", dw_conv2d_3x3_1x4x256x256_gp4_nobias),
164+
]
165+
166+
testsuite_conv2d_u85_xfails = [
167+
("3x3_2x8x198x198_gp8_st3", dw_conv2d_3x3_2x8x198x198_gp8_st3),
168+
("two_dw_conv2d", two_dw_conv2d),
169+
]
170+
171+
159172
testsuite_conv1d = [
160173
("2_1x6x4_gp6_st1", dw_conv1d_2_1x6x4_gp6_st1),
161174
("two_dw_conv1d", two_dw_conv1d),
@@ -274,10 +287,8 @@ def test_dw_conv1d_u55_BI(
274287
model.get_inputs(),
275288
)
276289

277-
# All test cases except 3x3_1x3x256x256_gp3_st1 have numerical issues on FVP. MLETORCH-520
278-
@parameterized.expand(testsuite_conv1d[:-2] + testsuite_conv2d)
279-
@common.expectedFailureOnFVP
280-
def test_dw_conv_u85_BI_xfails(
290+
@parameterized.expand(testsuite_conv1d + testsuite_conv2d_u85)
291+
def test_dw_conv_u85_BI(
281292
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = False
282293
):
283294
self._test_dw_conv_ethos_BI_pipeline(
@@ -288,8 +299,10 @@ def test_dw_conv_u85_BI_xfails(
288299
model.get_inputs(),
289300
)
290301

291-
@parameterized.expand(testsuite_conv1d[-2:])
292-
def test_dw_conv_u85_BI(
302+
# All test cases except 3x3_1x3x256x256_gp3_st1 have numerical issues on FVP. MLETORCH-520
303+
@parameterized.expand(testsuite_conv2d_u85_xfails)
304+
@common.expectedFailureOnFVP
305+
def test_dw_conv_u85_BI_xfails(
293306
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = False
294307
):
295308
self._test_dw_conv_ethos_BI_pipeline(

backends/arm/test/ops/test_div.py

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@
2626
torch.ones(5),
2727
None,
2828
),
29-
(
30-
"op_div_rank1_rand",
31-
torch.rand(5) * 5,
32-
torch.rand(5) * 5,
33-
None,
34-
),
3529
(
3630
"op_div_rank1_negative_ones",
3731
torch.ones(5) * (-1),
3832
torch.ones(5) * (-1),
3933
None,
4034
),
35+
(
36+
"op_div_rank1_rand",
37+
torch.rand(5) * 5,
38+
torch.rand(5) * 5,
39+
None,
40+
),
4141
(
4242
"op_div_rank4_ones",
4343
torch.ones(5, 10, 25, 20),
@@ -183,9 +183,7 @@ def test_div_tosa_BI(
183183
test_data = (input_, other_)
184184
self._test_div_tosa_BI_pipeline(self.Div(), test_data)
185185

186-
# Numerical issues on FVP likely due to mul op, MLETORCH-521
187-
@parameterized.expand(test_data_suite)
188-
@common.expectedFailureOnFVP
186+
@parameterized.expand(test_data_suite[:2])
189187
def test_div_u55_BI(
190188
self,
191189
test_name: str,
@@ -199,8 +197,21 @@ def test_div_u55_BI(
199197
)
200198

201199
# Numerical issues on FVP likely due to mul op, MLETORCH-521
202-
@parameterized.expand(test_data_suite)
200+
@parameterized.expand(test_data_suite[2:])
203201
@common.expectedFailureOnFVP
202+
def test_div_u55_BI_xfails(
203+
self,
204+
test_name: str,
205+
input_: Union[torch.Tensor, torch.types.Number],
206+
other_: Union[torch.Tensor, torch.types.Number],
207+
rounding_mode: Optional[str] = None,
208+
):
209+
test_data = (input_, other_)
210+
self._test_div_ethos_BI_pipeline(
211+
self.Div(), common.get_u55_compile_spec(), test_data
212+
)
213+
214+
@parameterized.expand(test_data_suite[:2])
204215
def test_div_u85_BI(
205216
self,
206217
test_name: str,
@@ -212,3 +223,18 @@ def test_div_u85_BI(
212223
self._test_div_ethos_BI_pipeline(
213224
self.Div(), common.get_u85_compile_spec(), test_data
214225
)
226+
227+
# Numerical issues on FVP likely due to mul op, MLETORCH-521
228+
@parameterized.expand(test_data_suite[2:])
229+
@common.expectedFailureOnFVP
230+
def test_div_u85_BI_xfails(
231+
self,
232+
test_name: str,
233+
input_: Union[torch.Tensor, torch.types.Number],
234+
other_: Union[torch.Tensor, torch.types.Number],
235+
rounding_mode: Optional[str] = None,
236+
):
237+
test_data = (input_, other_)
238+
self._test_div_ethos_BI_pipeline(
239+
self.Div(), common.get_u85_compile_spec(), test_data
240+
)

backends/arm/test/ops/test_layer_norm.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ def test_layer_norm_u55_BI(
170170
)
171171

172172
# Numerical issues on FVP likely due to mul op, MLETORCH-521
173-
@parameterized.expand(test_data_suite[:-1])
174-
@common.expectedFailureOnFVP
175-
def test_layer_norm_u85_BI_fvp_xfails(
173+
@parameterized.expand(test_data_suite[:-2])
174+
def test_layer_norm_u85_BI_fvp(
176175
self,
177176
test_name: str,
178177
test_data: torch.Tensor,
@@ -182,7 +181,7 @@ def test_layer_norm_u85_BI_fvp_xfails(
182181
self.LayerNorm(*model_params), common.get_u85_compile_spec(), (test_data,)
183182
)
184183

185-
@parameterized.expand(test_data_suite[-1:])
184+
@parameterized.expand(test_data_suite[-2:])
186185
@unittest.skip # Flaky
187186
def test_layer_norm_u85_BI(
188187
self,

backends/arm/test/ops/test_logsoftmax.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@
1717

1818
test_data_suite = [
1919
# (test_name, test_data, dim)
20-
("zeros", torch.zeros(10, 10, 10, 10), 0),
21-
("zeros_neg_dim", torch.zeros(10, 10, 10, 10), -4),
20+
("zeros", torch.zeros(10, 8, 5, 2), 0),
21+
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
2222
("ones", torch.ones(10, 10), 1),
23-
("rand_neg_dim", torch.rand(10, 10, 10), -1),
24-
("rand", torch.rand(10, 10, 10, 10), 2),
25-
("rand_neg_dim", torch.rand(10, 10, 2, 3), -2),
26-
("randn", torch.randn(10, 10, 5, 10), 3),
27-
("randn_neg_dim", torch.randn(1, 10, 10, 10), -3),
23+
("ones_neg_dim", torch.ones(10, 3, 4), -1),
24+
("rand", torch.rand(1, 2, 5, 8), 2),
25+
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
26+
("randn", torch.randn(10, 10, 10, 10), 3),
27+
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
28+
]
29+
test_data_suite_u55 = [
30+
# (test_name, test_data, dim)
31+
("ones", torch.ones(10, 10), 1),
32+
("ones_neg_dim", torch.ones(10, 3, 4), -1),
33+
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
34+
]
35+
36+
test_data_suite_u55_xfails = [
37+
# (test_name, test_data, dim)
38+
("zeros", torch.zeros(10, 8, 5, 2), 0),
39+
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
40+
("rand", torch.rand(1, 2, 5, 8), 2),
41+
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
42+
("randn", torch.randn(10, 10, 10, 10), 3),
2843
]
2944

3045

@@ -135,7 +150,7 @@ def test_logsoftmax_tosa_BI(
135150
):
136151
self._test_logsoftmax_tosa_BI_pipeline(self.LogSoftmax(dim=dim), (test_data,))
137152

138-
@parameterized.expand(test_data_suite)
153+
@parameterized.expand(test_data_suite_u55)
139154
def test_logsoftmax_tosa_u55_BI(
140155
self,
141156
test_name: str,
@@ -146,13 +161,26 @@ def test_logsoftmax_tosa_u55_BI(
146161
self.LogSoftmax(dim=dim), (test_data,)
147162
)
148163

164+
# Expected to fail as this is not supported on u55.
165+
@parameterized.expand(test_data_suite_u55_xfails)
166+
@unittest.expectedFailure
167+
def test_logsoftmax_tosa_u55_BI_xfails(
168+
self,
169+
test_name: str,
170+
test_data: torch.Tensor,
171+
dim: int,
172+
):
173+
self._test_logsoftmax_tosa_u55_BI_pipeline(
174+
self.LogSoftmax(dim=dim), (test_data,)
175+
)
176+
149177
@parameterized.expand(test_data_suite)
150178
def test_logsoftmax_tosa_u85_BI(
151179
self,
152180
test_name: str,
153181
test_data: torch.Tensor,
154182
dim: int,
155183
):
156-
self._test_logsoftmax_tosa_u55_BI_pipeline(
184+
self._test_logsoftmax_tosa_u85_BI_pipeline(
157185
self.LogSoftmax(dim=dim), (test_data,)
158186
)

backends/arm/test/ops/test_mean_dim.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ def test_meandim_tosa_BI(
269269
):
270270
self._test_meandim_tosa_BI_pipeline(self.MeanDim(dim, keepdim), (test_data,))
271271

272+
# Expected to fail as this is not supported on u55.
272273
@parameterized.expand(MeanDim.test_data_suite)
273-
def test_meandim_tosa_u55_BI(
274+
@unittest.expectedFailure
275+
def test_meandim_tosa_u55_BI_xfails(
274276
self,
275277
test_name: str,
276278
test_data: torch.Tensor,

backends/arm/test/ops/test_mul.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ def test_mul_tosa_BI(
152152
test_data = (input_, other_)
153153
self._test_mul_tosa_BI_pipeline(self.Mul(), test_data)
154154

155-
# Numerical issues on FVP, MLETORCH-521
156155
@parameterized.expand(test_data_sute)
157-
@common.expectedFailureOnFVP
158156
def test_mul_u55_BI(
159157
self,
160158
test_name: str,
@@ -166,10 +164,7 @@ def test_mul_u55_BI(
166164
common.get_u55_compile_spec(), self.Mul(), test_data
167165
)
168166

169-
# Numerical issues on FVP, MLETORCH-521
170-
# test_data_sute[0] works on U85
171-
@parameterized.expand(test_data_sute[1:])
172-
@common.expectedFailureOnFVP
167+
@parameterized.expand(test_data_sute)
173168
def test_mul_u85_BI(
174169
self,
175170
test_name: str,

backends/arm/test/ops/test_softmax.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@
2828
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
2929
]
3030

31+
test_data_suite_u55 = [
32+
# (test_name, test_data, dim)
33+
("ones", torch.ones(10, 10), 1),
34+
("ones_neg_dim", torch.ones(10, 3, 4), -1),
35+
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
36+
]
37+
38+
test_data_suite_u55_xfails = [
39+
# (test_name, test_data, dim)
40+
("zeros", torch.zeros(10, 8, 5, 2), 0),
41+
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
42+
("rand", torch.rand(1, 2, 5, 8), 2),
43+
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
44+
("randn", torch.randn(10, 10, 10, 10), 3),
45+
]
46+
3147

3248
class TestSoftmax(unittest.TestCase):
3349
"""Tests softmax."""
@@ -136,7 +152,7 @@ def test_softmax_tosa_BI(
136152
):
137153
self._test_softmax_tosa_BI_pipeline(self.Softmax(dim=dim), (test_data,))
138154

139-
@parameterized.expand(test_data_suite)
155+
@parameterized.expand(test_data_suite_u55)
140156
def test_softmax_tosa_u55_BI(
141157
self,
142158
test_name: str,
@@ -145,6 +161,17 @@ def test_softmax_tosa_u55_BI(
145161
):
146162
self._test_softmax_tosa_u55_BI_pipeline(self.Softmax(dim=dim), (test_data,))
147163

164+
# Expected to fail as this is not supported on u55.
165+
@parameterized.expand(test_data_suite_u55_xfails)
166+
@unittest.expectedFailure
167+
def test_softmax_tosa_u55_BI_xfails(
168+
self,
169+
test_name: str,
170+
test_data: torch.Tensor,
171+
dim: int,
172+
):
173+
self._test_softmax_tosa_u55_BI_pipeline(self.Softmax(dim=dim), (test_data,))
174+
148175
@parameterized.expand(test_data_suite)
149176
def test_softmax_tosa_u85_BI(
150177
self,

0 commit comments

Comments
 (0)