diff --git a/backends/arm/test/ops/test_bmm.py b/backends/arm/test/ops/test_bmm.py index d21b33cfec4..2ec9150625e 100644 --- a/backends/arm/test/ops/test_bmm.py +++ b/backends/arm/test/ops/test_bmm.py @@ -1,4 +1,4 @@ -# Copyright 2024-2025 Arm Limited and/or its affiliates. +# Copyright 2024-2026 Arm Limited and/or its affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. @@ -12,9 +12,11 @@ from executorch.backends.arm.test import common +from executorch.backends.arm.quantizer import get_symmetric_a16w8_quantization_config from executorch.backends.arm.test.tester.test_pipeline import ( EthosU55PipelineINT, EthosU85PipelineINT, + OpNotSupportedPipeline, TosaPipelineFP, TosaPipelineINT, VgfPipeline, @@ -23,9 +25,6 @@ aten_op_bmm = "torch.ops.aten.bmm.default" exir_op_bmm = "executorch_exir_dialects_edge__ops_aten_bmm_default" -aten_op_mm = "torch.ops.aten.matmul.default" -exir_op_mm = "executorch_exir_dialects_edge__ops_aten_matmul_default" - input_t1 = Tuple[torch.Tensor, torch.Tensor] # Input x @@ -191,3 +190,34 @@ def test_bmm_vgf_quant_single_input(test_data: input_t1): quantize=True, ) pipeline.run() + + +@common.parametrize("test_data", BMM.test_data_generators) +@common.XfailIfNoCorstone300 +def test_bmm_a16w8_u55_INT(test_data: input_t1): + """U55 does not support bmm with INT16 inputs. Verify bmm is rejected.""" + pipeline = OpNotSupportedPipeline[input_t1]( + BMM(), + test_data(), + non_delegated_ops={exir_op_bmm: 1}, + n_expected_delegates=0, + u55_subset=True, + quantize=True, + tosa_extensions=["int16"], + ) + pipeline.quantizer.set_global(get_symmetric_a16w8_quantization_config()) + pipeline.run() + + +@common.parametrize("test_data", BMM.test_data_generators) +@common.XfailIfNoCorstone320 +def test_bmm_a16w8_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( + BMM(), + test_data(), + aten_op_bmm, + exir_op_bmm, + a16w8_quantization=True, + symmetric_io_quantization=True, + ) + pipeline.run() diff --git a/backends/arm/test/ops/test_conv1d.py b/backends/arm/test/ops/test_conv1d.py index 486b6b3ce7c..0e75eab621f 100644 --- a/backends/arm/test/ops/test_conv1d.py +++ b/backends/arm/test/ops/test_conv1d.py @@ -399,3 +399,34 @@ def test_convolution_1d_vgf_quant_a8w4(test_data): get_symmetric_a8w4_quantization_config(is_per_channel=per_channel_quantization) ) pipeline.run() + + +@common.parametrize("test_data", test_data_INT) +@common.XfailIfNoCorstone300 +def test_conv1d_a16w8_u55_INT(test_data): + model, per_channel_quantization = test_data() + pipeline = EthosU55PipelineINT[input_t]( + model, + model.get_inputs(), + aten_op, + exir_op, + a16w8_quantization=True, + symmetric_io_quantization=True, + per_channel_quantization=per_channel_quantization, + ) + pipeline.run() + +@common.parametrize("test_data", test_data_INT) +@common.XfailIfNoCorstone320 +def test_conv1d_a16w8_u85_INT(test_data): + model, per_channel_quantization = test_data() + pipeline = EthosU85PipelineINT[input_t]( + model, + model.get_inputs(), + aten_op, + exir_op, + a16w8_quantization=True, + symmetric_io_quantization=True, + per_channel_quantization=per_channel_quantization, + ) + pipeline.run() diff --git a/backends/arm/test/ops/test_gelu.py b/backends/arm/test/ops/test_gelu.py index 82e3cb1e53e..84626c70b4d 100644 --- a/backends/arm/test/ops/test_gelu.py +++ b/backends/arm/test/ops/test_gelu.py @@ -6,6 +6,7 @@ from typing import Tuple import torch + from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( EthosU55PipelineINT, @@ -176,3 +177,37 @@ def test_gelu_vgf_quant(test_data: input_t1): quantize=True, ) pipeline.run() + + +@common.parametrize("test_data", Gelu.test_data) +@common.XfailIfNoCorstone300 +def test_gelu_a16w8_u55_INT(test_data: input_t1): + approximate, data = test_data() + pipeline = EthosU55PipelineINT[input_t1]( + Gelu(approximate), + (data,), + Gelu.aten_op, + Gelu.exir_op, + a16w8_quantization=True, + symmetric_io_quantization=True, + qtol=128, + epsilon=2**-16, + ) + pipeline.run() + + +@common.parametrize("test_data", Gelu.test_data) +@common.XfailIfNoCorstone320 +def test_gelu_a16w8_u85_INT(test_data: input_t1): + approximate, data = test_data() + pipeline = EthosU85PipelineINT[input_t1]( + Gelu(approximate), + (data,), + Gelu.aten_op, + Gelu.exir_op, + a16w8_quantization=True, + symmetric_io_quantization=True, + qtol=128, + epsilon=2**-16, + ) + pipeline.run() diff --git a/backends/arm/test/ops/test_var.py b/backends/arm/test/ops/test_var.py index a7943bfc19b..c65f4991ca3 100644 --- a/backends/arm/test/ops/test_var.py +++ b/backends/arm/test/ops/test_var.py @@ -224,6 +224,36 @@ def test_var_dim_vgf_quant_no_dim(test_data: Tuple): pipeline.run() +@common.parametrize("test_data", Var.test_parameters) +@common.XfailIfNoCorstone300 +def test_var_a16w8_u55_INT(test_data: Tuple): + test_data, keepdim, correction = test_data() + pipeline = EthosU55PipelineINT[input_t1]( + Var(keepdim, correction), + (test_data,), + aten_ops=[], + exir_ops=[], + a16w8_quantization=True, + symmetric_io_quantization=True, + ) + pipeline.run() + + +@common.parametrize("test_data", Var.test_parameters) +@common.XfailIfNoCorstone320 +def test_var_a16w8_u85_INT(test_data: Tuple): + test_data, keepdim, correction = test_data() + pipeline = EthosU85PipelineINT[input_t1]( + Var(keepdim, correction), + (test_data,), + aten_ops=[], + exir_ops=[], + a16w8_quantization=True, + symmetric_io_quantization=True, + ) + pipeline.run() + + ############# ## VarDim ### ############# diff --git a/backends/arm/test/targets.bzl b/backends/arm/test/targets.bzl index b8030ae7ba8..20e122055d9 100644 --- a/backends/arm/test/targets.bzl +++ b/backends/arm/test/targets.bzl @@ -39,6 +39,10 @@ def define_arm_tests(): "ops/test_exp.py", "ops/test_reciprocal.py", "ops/test_mean_dim.py", + "ops/test_var.py", + "ops/test_conv1d.py", + "ops/test_gelu.py", + "ops/test_bmm.py", ] # Quantization