Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions backends/arm/test/ops/test_bmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class TestBMM(unittest.TestCase):

class BMM(torch.nn.Module):
test_parameters = [
(torch.rand(5, 3, 5), torch.rand(5, 5, 2)),
(torch.rand(2, 1, 1), torch.rand(2, 1, 1)),
(torch.rand(5, 3, 5), torch.rand(5, 5, 2)),
(torch.ones(1, 55, 3), torch.ones(1, 3, 44)),
(10000 * torch.randn(10, 1, 10), torch.randn(10, 10, 5)),
(-10 * torch.randn(2, 32, 64), 5 + 5 * torch.randn(2, 64, 32)),
Expand Down Expand Up @@ -147,32 +147,37 @@ def test_bmm_single_input_tosa_BI(self, operand1: torch.Tensor):

@parameterized.expand(BMM.test_parameters)
@unittest.expectedFailure
def test_bmm_u55_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
def test_bmm_u55_BI_xfails(self, operand1: torch.Tensor, operand2: torch.Tensor):
test_data = (operand1, operand2)
self._test_bmm_ethosu_BI_pipeline(
self.BMM(), common.get_u55_compile_spec(), test_data
)

@parameterized.expand(BMM.test_parameters)
@common.expectedFailureOnFVP
@parameterized.expand(BMM.test_parameters[:1])
def test_bmm_u85_BI(self, operand1: torch.Tensor, operand2: torch.Tensor):
test_data = (operand1, operand2)
self._test_bmm_ethosu_BI_pipeline(
self.BMM(), common.get_u85_compile_spec(), test_data
)

@parameterized.expand(BMM.test_parameters[1:])
@common.expectedFailureOnFVP
def test_bmm_u85_BI_xfails(self, operand1: torch.Tensor, operand2: torch.Tensor):
test_data = (operand1, operand2)
self._test_bmm_ethosu_BI_pipeline(
self.BMM(), common.get_u85_compile_spec(), test_data
)

# Expected to fail with error: Warning, unsupported fusing of TOSA Rescale previous operator is of type: Memcpy
@parameterized.expand(BMMSingleInput.test_parameters)
@unittest.expectedFailure
def test_bmm_single_input_u55_BI(self, operand1: torch.Tensor):
def test_bmm_single_input_u55_BI_xfails(self, operand1: torch.Tensor):
test_data = (operand1,)
self._test_bmm_ethosu_BI_pipeline(
self.BMMSingleInput(), common.get_u55_compile_spec(), test_data
)

# Numerical issues on FVP, MLETORCH 534
@parameterized.expand(BMMSingleInput.test_parameters)
@common.expectedFailureOnFVP
def test_bmm_single_input_u85_BI(self, operand1: torch.Tensor):
test_data = (operand1,)
self._test_bmm_ethosu_BI_pipeline(
Expand Down
2 changes: 0 additions & 2 deletions backends/arm/test/ops/test_conv_combos.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ def test_conv_meandim_u55_BI(self):
model.get_inputs(),
)

# Numerical Issues on FVP, MLETORCH-520
@common.expectedFailureOnFVP
def test_conv_meandim_u85_BI(self):
model = ComboConv2dMeandim()
self._test_conv_combo_ethos_BI_pipeline(
Expand Down
27 changes: 20 additions & 7 deletions backends/arm/test/ops/test_depthwise_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@
("two_dw_conv2d", two_dw_conv2d),
]

testsuite_conv2d_u85 = [
("2x2_1x6x4x4_gp6_st1", dw_conv2d_2x2_1x6x4x4_gp6_st1),
("3x3_1x3x256x256_gp3_st1", dw_conv2d_3x3_1x3x256x256_gp3_st1),
("3x3_1x4x256x256_gp4_st1", dw_conv2d_3x3_1x4x256x256_gp4_st1),
("3x3_1x4x256x256_gp4_nobias", dw_conv2d_3x3_1x4x256x256_gp4_nobias),
]

testsuite_conv2d_u85_xfails = [
("3x3_2x8x198x198_gp8_st3", dw_conv2d_3x3_2x8x198x198_gp8_st3),
("two_dw_conv2d", two_dw_conv2d),
]


testsuite_conv1d = [
("2_1x6x4_gp6_st1", dw_conv1d_2_1x6x4_gp6_st1),
("two_dw_conv1d", two_dw_conv1d),
Expand Down Expand Up @@ -247,7 +260,7 @@ def test_dw_conv_tosa_BI(self, test_name: str, model: torch.nn.Module):
) # Works

@parameterized.expand(testsuite_conv2d, skip_on_empty=True)
@common.expectedFailureOnFVP
@unittest.expectedFailure
def test_dw_conv2d_u55_BI(
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = False
):
Expand All @@ -274,10 +287,8 @@ def test_dw_conv1d_u55_BI(
model.get_inputs(),
)

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

@parameterized.expand(testsuite_conv1d[-2:])
def test_dw_conv_u85_BI(
# All test cases except 3x3_1x3x256x256_gp3_st1 have numerical issues on FVP. MLETORCH-520
@parameterized.expand(testsuite_conv2d_u85_xfails)
@common.expectedFailureOnFVP
def test_dw_conv_u85_BI_xfails(
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = False
):
self._test_dw_conv_ethos_BI_pipeline(
Expand Down
46 changes: 36 additions & 10 deletions backends/arm/test/ops/test_div.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
torch.ones(5),
None,
),
(
"op_div_rank1_rand",
torch.rand(5) * 5,
torch.rand(5) * 5,
None,
),
(
"op_div_rank1_negative_ones",
torch.ones(5) * (-1),
torch.ones(5) * (-1),
None,
),
(
"op_div_rank1_rand",
torch.rand(5) * 5,
torch.rand(5) * 5,
None,
),
(
"op_div_rank4_ones",
torch.ones(5, 10, 25, 20),
Expand Down Expand Up @@ -183,9 +183,7 @@ def test_div_tosa_BI(
test_data = (input_, other_)
self._test_div_tosa_BI_pipeline(self.Div(), test_data)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
@parameterized.expand(test_data_suite)
@common.expectedFailureOnFVP
@parameterized.expand(test_data_suite[:2])
def test_div_u55_BI(
self,
test_name: str,
Expand All @@ -199,8 +197,21 @@ def test_div_u55_BI(
)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
@parameterized.expand(test_data_suite)
@parameterized.expand(test_data_suite[2:])
@common.expectedFailureOnFVP
def test_div_u55_BI_xfails(
self,
test_name: str,
input_: Union[torch.Tensor, torch.types.Number],
other_: Union[torch.Tensor, torch.types.Number],
rounding_mode: Optional[str] = None,
):
test_data = (input_, other_)
self._test_div_ethos_BI_pipeline(
self.Div(), common.get_u55_compile_spec(), test_data
)

@parameterized.expand(test_data_suite[:2])
def test_div_u85_BI(
self,
test_name: str,
Expand All @@ -212,3 +223,18 @@ def test_div_u85_BI(
self._test_div_ethos_BI_pipeline(
self.Div(), common.get_u85_compile_spec(), test_data
)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
@parameterized.expand(test_data_suite[2:])
@common.expectedFailureOnFVP
def test_div_u85_BI_xfails(
self,
test_name: str,
input_: Union[torch.Tensor, torch.types.Number],
other_: Union[torch.Tensor, torch.types.Number],
rounding_mode: Optional[str] = None,
):
test_data = (input_, other_)
self._test_div_ethos_BI_pipeline(
self.Div(), common.get_u85_compile_spec(), test_data
)
9 changes: 4 additions & 5 deletions backends/arm/test/ops/test_layer_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_layer_norm_tosa_BI(
# Numerical issues on FVP likely due to mul op, MLETORCH-521
# Skip tests that require transposes.
@parameterized.expand(test_data_suite[:-2])
@common.expectedFailureOnFVP
@unittest.expectedFailure
def test_layer_norm_u55_BI(
self,
test_name: str,
Expand All @@ -170,9 +170,8 @@ def test_layer_norm_u55_BI(
)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
@parameterized.expand(test_data_suite[:-1])
@common.expectedFailureOnFVP
def test_layer_norm_u85_BI_fvp_xfails(
@parameterized.expand(test_data_suite[:-2])
def test_layer_norm_u85_BI_fvp(
self,
test_name: str,
test_data: torch.Tensor,
Expand All @@ -182,7 +181,7 @@ def test_layer_norm_u85_BI_fvp_xfails(
self.LayerNorm(*model_params), common.get_u85_compile_spec(), (test_data,)
)

@parameterized.expand(test_data_suite[-1:])
@parameterized.expand(test_data_suite[-2:])
@unittest.skip # Flaky
def test_layer_norm_u85_BI(
self,
Expand Down
46 changes: 37 additions & 9 deletions backends/arm/test/ops/test_logsoftmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,29 @@

test_data_suite = [
# (test_name, test_data, dim)
("zeros", torch.zeros(10, 10, 10, 10), 0),
("zeros_neg_dim", torch.zeros(10, 10, 10, 10), -4),
("zeros", torch.zeros(10, 8, 5, 2), 0),
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
("ones", torch.ones(10, 10), 1),
("rand_neg_dim", torch.rand(10, 10, 10), -1),
("rand", torch.rand(10, 10, 10, 10), 2),
("rand_neg_dim", torch.rand(10, 10, 2, 3), -2),
("randn", torch.randn(10, 10, 5, 10), 3),
("randn_neg_dim", torch.randn(1, 10, 10, 10), -3),
("ones_neg_dim", torch.ones(10, 3, 4), -1),
("rand", torch.rand(1, 2, 5, 8), 2),
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
("randn", torch.randn(10, 10, 10, 10), 3),
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]
test_data_suite_u55 = [
# (test_name, test_data, dim)
("ones", torch.ones(10, 10), 1),
("ones_neg_dim", torch.ones(10, 3, 4), -1),
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]

test_data_suite_u55_xfails = [
# (test_name, test_data, dim)
("zeros", torch.zeros(10, 8, 5, 2), 0),
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
("rand", torch.rand(1, 2, 5, 8), 2),
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
("randn", torch.randn(10, 10, 10, 10), 3),
]


Expand Down Expand Up @@ -135,7 +150,7 @@ def test_logsoftmax_tosa_BI(
):
self._test_logsoftmax_tosa_BI_pipeline(self.LogSoftmax(dim=dim), (test_data,))

@parameterized.expand(test_data_suite)
@parameterized.expand(test_data_suite_u55)
def test_logsoftmax_tosa_u55_BI(
self,
test_name: str,
Expand All @@ -146,13 +161,26 @@ def test_logsoftmax_tosa_u55_BI(
self.LogSoftmax(dim=dim), (test_data,)
)

# Expected to fail as this is not supported on u55.
@parameterized.expand(test_data_suite_u55_xfails)
@unittest.expectedFailure
def test_logsoftmax_tosa_u55_BI_xfails(
self,
test_name: str,
test_data: torch.Tensor,
dim: int,
):
self._test_logsoftmax_tosa_u55_BI_pipeline(
self.LogSoftmax(dim=dim), (test_data,)
)

@parameterized.expand(test_data_suite)
def test_logsoftmax_tosa_u85_BI(
self,
test_name: str,
test_data: torch.Tensor,
dim: int,
):
self._test_logsoftmax_tosa_u55_BI_pipeline(
self._test_logsoftmax_tosa_u85_BI_pipeline(
self.LogSoftmax(dim=dim), (test_data,)
)
4 changes: 3 additions & 1 deletion backends/arm/test/ops/test_mean_dim.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ def test_meandim_tosa_BI(
):
self._test_meandim_tosa_BI_pipeline(self.MeanDim(dim, keepdim), (test_data,))

# Expected to fail as this is not supported on u55.
@parameterized.expand(MeanDim.test_data_suite)
def test_meandim_tosa_u55_BI(
@unittest.expectedFailure
def test_meandim_tosa_u55_BI_xfails(
self,
test_name: str,
test_data: torch.Tensor,
Expand Down
7 changes: 1 addition & 6 deletions backends/arm/test/ops/test_mul.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ def test_mul_tosa_BI(
test_data = (input_, other_)
self._test_mul_tosa_BI_pipeline(self.Mul(), test_data)

# Numerical issues on FVP, MLETORCH-521
@parameterized.expand(test_data_sute)
@common.expectedFailureOnFVP
def test_mul_u55_BI(
self,
test_name: str,
Expand All @@ -166,10 +164,7 @@ def test_mul_u55_BI(
common.get_u55_compile_spec(), self.Mul(), test_data
)

# Numerical issues on FVP, MLETORCH-521
# test_data_sute[0] works on U85
@parameterized.expand(test_data_sute[1:])
@common.expectedFailureOnFVP
@parameterized.expand(test_data_sute)
def test_mul_u85_BI(
self,
test_name: str,
Expand Down
29 changes: 28 additions & 1 deletion backends/arm/test/ops/test_softmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]

test_data_suite_u55 = [
# (test_name, test_data, dim)
("ones", torch.ones(10, 10), 1),
("ones_neg_dim", torch.ones(10, 3, 4), -1),
("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]

test_data_suite_u55_xfails = [
# (test_name, test_data, dim)
("zeros", torch.zeros(10, 8, 5, 2), 0),
("zeros_neg_dim", torch.zeros(10, 7, 8, 9), -4),
("rand", torch.rand(1, 2, 5, 8), 2),
("rand_neg_dim", torch.rand(2, 10, 8, 10), -2),
("randn", torch.randn(10, 10, 10, 10), 3),
]


class TestSoftmax(unittest.TestCase):
"""Tests softmax."""
Expand Down Expand Up @@ -136,7 +152,7 @@ def test_softmax_tosa_BI(
):
self._test_softmax_tosa_BI_pipeline(self.Softmax(dim=dim), (test_data,))

@parameterized.expand(test_data_suite)
@parameterized.expand(test_data_suite_u55)
def test_softmax_tosa_u55_BI(
self,
test_name: str,
Expand All @@ -145,6 +161,17 @@ def test_softmax_tosa_u55_BI(
):
self._test_softmax_tosa_u55_BI_pipeline(self.Softmax(dim=dim), (test_data,))

# Expected to fail as this is not supported on u55.
@parameterized.expand(test_data_suite_u55_xfails)
@unittest.expectedFailure
def test_softmax_tosa_u55_BI_xfails(
self,
test_name: str,
test_data: torch.Tensor,
dim: int,
):
self._test_softmax_tosa_u55_BI_pipeline(self.Softmax(dim=dim), (test_data,))

@parameterized.expand(test_data_suite)
def test_softmax_tosa_u85_BI(
self,
Expand Down
Loading