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
10 changes: 4 additions & 6 deletions backends/arm/test/misc/test_multiple_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,21 @@ def _test_ethosu_BI_pipeline(
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)

@pytest.mark.corstone_fvp
def test_u85_BI(self):
def test_u55_BI(self):
module = self.MultipleOutputsModule()
test_data = module.get_inputs()
self._test_ethosu_BI_pipeline(
module,
test_data,
common.get_u85_compile_spec(),
common.get_u55_compile_spec(),
)

@pytest.mark.corstone_fvp
@conftest.expectedFailureOnFVP
# TODO MLETORCH-598
def test_u55_BI(self):
def test_u85_BI(self):
module = self.MultipleOutputsModule()
test_data = module.get_inputs()
self._test_ethosu_BI_pipeline(
module,
test_data,
common.get_u55_compile_spec(),
common.get_u85_compile_spec(),
)
7 changes: 4 additions & 3 deletions backends/arm/test/ops/test_bmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ def test_bmm_single_input_tosa_BI(self, test_data_generator: Callable[[], Tuple]
test_data = test_data_generator()
self._test_bmm_tosa_BI_pipeline(self.BMMSingleInput(), test_data)

# Expected to fail on FVP as TOSA.MATMUL is not supported on U55
@parameterized.expand(BMM.test_data_generators)
@pytest.mark.corstone_fvp
@unittest.expectedFailure
@conftest.expectedFailureOnFVP
def test_bmm_u55_BI_xfails(self, test_data_generator: Callable[[], Tuple]):
test_data = test_data_generator()
self._test_bmm_ethosu_BI_pipeline(
Expand All @@ -167,10 +168,10 @@ def test_bmm_u85_BI(self, test_data_generator: Callable[[], Tuple]):
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
# Expected to fail on FVP as TOSA.MATMUL is not supported on U55
@parameterized.expand(BMMSingleInput.test_data_generators)
@pytest.mark.corstone_fvp
@unittest.expectedFailure
@conftest.expectedFailureOnFVP
def test_bmm_single_input_u55_BI_xfails(
self, test_data_generator: Callable[[], Tuple]
):
Expand Down
33 changes: 2 additions & 31 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(
self.LayerNorm(*model_params), (test_data,)
)

@parameterized.expand(test_data_suite[4:])
@parameterized.expand(test_data_suite)
@pytest.mark.corstone_fvp
def test_layer_norm_u55_BI(
self,
Expand All @@ -170,36 +170,7 @@ def test_layer_norm_u55_BI(
self.LayerNorm(*model_params), common.get_u55_compile_spec(), (test_data,)
)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
# Skip tests that require transposes.
@parameterized.expand(test_data_suite[:4])
@pytest.mark.corstone_fvp
@conftest.expectedFailureOnFVP
def test_layer_norm_u55_BI_xfails(
self,
test_name: str,
test_data: torch.Tensor,
model_params,
):
self._test_layernorm_ethosu_BI_pipeline(
self.LayerNorm(*model_params), common.get_u55_compile_spec(), (test_data,)
)

# Numerical issues on FVP likely due to mul op, MLETORCH-521
@parameterized.expand(test_data_suite[:-2])
@pytest.mark.corstone_fvp
@conftest.expectedFailureOnFVP
def test_layer_norm_u85_BI_xfails(
self,
test_name: str,
test_data: torch.Tensor,
model_params,
):
self._test_layernorm_ethosu_BI_pipeline(
self.LayerNorm(*model_params), common.get_u85_compile_spec(), (test_data,)
)

@parameterized.expand(test_data_suite[-2:])
@parameterized.expand(test_data_suite)
@pytest.mark.corstone_fvp
def test_layer_norm_u85_BI(
self,
Expand Down
46 changes: 18 additions & 28 deletions backends/arm/test/ops/test_logsoftmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pytest

import torch
from executorch.backends.arm.test import common
from executorch.backends.arm.test import common, conftest
from executorch.backends.arm.test.tester.arm_tester import ArmTester
from executorch.exir.backend.compile_spec_schema import CompileSpec
from parameterized import parameterized
Expand All @@ -28,16 +28,17 @@
lambda: ("randn", torch.randn(10, 10, 10, 10), 3),
lambda: ("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]
test_data_generators_u55 = [

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


Expand Down Expand Up @@ -99,7 +100,7 @@ def _test_logsoftmax_tosa_ethos_BI_pipeline(
module: torch.nn.Module,
test_data: Tuple[torch.tensor],
):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -114,21 +115,10 @@ def _test_logsoftmax_tosa_ethos_BI_pipeline(
.check_not(["executorch_exir_dialects_edge__ops_aten__logsoftmax_default"])
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.serialize()
)

def _test_logsoftmax_tosa_u55_BI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
):
self._test_logsoftmax_tosa_ethos_BI_pipeline(
common.get_u55_compile_spec(), module, test_data
)

def _test_logsoftmax_tosa_u85_BI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
):
self._test_logsoftmax_tosa_ethos_BI_pipeline(
common.get_u85_compile_spec(), module, test_data
)
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(inputs=test_data, qtol=1)

@parameterized.expand(test_data_generators)
def test_logsoftmax_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
Expand All @@ -141,18 +131,18 @@ def test_logsoftmax_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_logsoftmax_tosa_BI_pipeline(self.LogSoftmax(dim=dim), (test_data,))

@parameterized.expand(test_data_generators_u55)
@parameterized.expand(test_data_generators_FVP)
@pytest.mark.flaky # TODO: MLETORCH-460 - Numerically stabler (log)softmax implementation
def test_logsoftmax_tosa_u55_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_logsoftmax_tosa_u55_BI_pipeline(
self.LogSoftmax(dim=dim), (test_data,)
self._test_logsoftmax_tosa_ethos_BI_pipeline(
common.get_u55_compile_spec(), self.LogSoftmax(dim=dim), (test_data,)
)

@parameterized.expand(test_data_generators)
@parameterized.expand(test_data_generators_FVP)
@pytest.mark.flaky # TODO: MLETORCH-460 - Numerically stabler (log)softmax implementation
def test_logsoftmax_tosa_u85_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_logsoftmax_tosa_u85_BI_pipeline(
self.LogSoftmax(dim=dim), (test_data,)
self._test_logsoftmax_tosa_ethos_BI_pipeline(
common.get_u85_compile_spec(), self.LogSoftmax(dim=dim), (test_data,)
)
12 changes: 9 additions & 3 deletions backends/arm/test/ops/test_mean_dim.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import Tuple

import torch
from executorch.backends.arm.test import common
from executorch.backends.arm.test import common, conftest
from executorch.backends.arm.test.tester.arm_tester import ArmTester
from executorch.exir.backend.backend_details import CompileSpec
from parameterized import parameterized
Expand Down Expand Up @@ -121,7 +121,7 @@ def _test_adaptive_avg_pool2d_tosa_ethosu_BI_pipeline(
compile_spec: CompileSpec,
test_data: Tuple[torch.tensor],
):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -141,7 +141,10 @@ def _test_adaptive_avg_pool2d_tosa_ethosu_BI_pipeline(
)
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.serialize()
)
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(inputs=test_data)

def _test_meandim_tosa_MI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
Expand Down Expand Up @@ -188,7 +191,7 @@ def _test_meandim_tosa_ethosu_BI_pipeline(
compile_spec: CompileSpec,
test_data: Tuple[torch.tensor],
):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -207,7 +210,10 @@ def _test_meandim_tosa_ethosu_BI_pipeline(
)
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.serialize()
)
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(inputs=test_data, qtol=1)

@parameterized.expand(AdaptiveAveragePool2d.test_data_suite)
def test_adaptive_avg_pool2d_tosa_MI(
Expand Down
6 changes: 2 additions & 4 deletions backends/arm/test/ops/test_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,16 @@ def test_mm_single_input_tosa_BI(self, test_data_generator: Callable[[], Tuple])
test_data = test_data_generator()
self._test_mm_tosa_BI_pipeline(self.MMSingleInput(), test_data)

# Expected to fail with error: CPU performance estimation for "MatMul" not implemented
# TODO: Enable numerical testing
@parameterized.expand(MM.test_data_generators)
@unittest.expectedFailure
def test_mm_u55_BI(self, test_data_generator: Callable[[], Tuple]):
test_data = test_data_generator()
self._test_mm_ethosu_BI_pipeline(
common.get_u55_compile_spec(), self.MM(), test_data
)

# Expected to fail with error: Warning, unsupported fusing of TOSA Rescale previous operator is of type: Memcpy
# TODO: Enable numerical testing
@parameterized.expand(MMSingleInput.test_data_generators)
@unittest.expectedFailure
def test_mm_single_input_u55_BI(self, test_data_generator: Callable[[], Tuple]):
test_data = test_data_generator()
self._test_mm_ethosu_BI_pipeline(
Expand Down
53 changes: 23 additions & 30 deletions backends/arm/test/ops/test_softmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import pytest

import torch
from executorch.backends.arm.test import common
from executorch.backends.arm.test import common, conftest
from executorch.backends.arm.test.tester.arm_tester import ArmTester
from executorch.exir.backend.compile_spec_schema import CompileSpec
from parameterized import parameterized
Expand All @@ -30,16 +30,16 @@
lambda: ("randn_neg_dim", torch.randn(10, 5, 8, 7), -3),
]

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


Expand Down Expand Up @@ -95,13 +95,13 @@ def _test_softmax_tosa_BI_pipeline(
.run_method_and_compare_outputs(inputs=test_data)
)

def _test_softmax_tosa_ethos_BI_pipeline(
def _test_softmax_ethosu_BI_pipeline(
self,
compile_spec: list[CompileSpec],
module: torch.nn.Module,
test_data: Tuple[torch.tensor],
):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -116,21 +116,10 @@ def _test_softmax_tosa_ethos_BI_pipeline(
.check_not(["executorch_exir_dialects_edge__ops_aten__softmax_default"])
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.serialize()
)

def _test_softmax_tosa_u55_BI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
):
self._test_softmax_tosa_ethos_BI_pipeline(
common.get_u55_compile_spec(), module, test_data
)

def _test_softmax_tosa_u85_BI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
):
self._test_softmax_tosa_ethos_BI_pipeline(
common.get_u85_compile_spec(), module, test_data
)
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(inputs=test_data, qtol=1)

@parameterized.expand(test_data_generators)
def test_softmax_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
Expand All @@ -143,14 +132,18 @@ def test_softmax_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_softmax_tosa_BI_pipeline(self.Softmax(dim=dim), (test_data,))

@parameterized.expand(test_data_generators_u55)
@parameterized.expand(test_data_generators_FVP)
@pytest.mark.flaky # TODO: MLETORCH-460 - Numerically stabler (log)softmax implementation
def test_softmax_tosa_u55_BI(self, test_data_generator: Callable[[], Tuple]):
def test_softmax_u55_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_softmax_tosa_u55_BI_pipeline(self.Softmax(dim=dim), (test_data,))
self._test_softmax_ethosu_BI_pipeline(
common.get_u55_compile_spec(), self.Softmax(dim=dim), (test_data,)
)

@parameterized.expand(test_data_generators)
@parameterized.expand(test_data_generators_FVP)
@pytest.mark.flaky # TODO: MLETORCH-460 - Numerically stabler (log)softmax implementation
def test_softmax_tosa_u85_BI(self, test_data_generator: Callable[[], Tuple]):
def test_softmax_u85_BI(self, test_data_generator: Callable[[], Tuple]):
test_name, test_data, dim = test_data_generator()
self._test_softmax_tosa_u85_BI_pipeline(self.Softmax(dim=dim), (test_data,))
self._test_softmax_ethosu_BI_pipeline(
common.get_u85_compile_spec(), self.Softmax(dim=dim), (test_data,)
)
Loading
Loading