From 104c31b167801bb1645a41a0c105a72c2353ffb7 Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Tue, 24 Jun 2025 14:48:41 +0100 Subject: [PATCH 1/6] Arm backend: Remove TOSA 0.80 from operator node visitors Change-Id: Ie3442b53184ecf0fbf817b581b780d2456670c4f --- backends/arm/operators/node_visitor.py | 11 +- backends/arm/operators/op_abs.py | 105 ----------- backends/arm/operators/op_add.py | 116 ------------ backends/arm/operators/op_amax.py | 51 +----- backends/arm/operators/op_amin.py | 51 +----- backends/arm/operators/op_any.py | 39 +--- backends/arm/operators/op_avg_pool2d.py | 145 --------------- backends/arm/operators/op_bmm.py | 78 +------- backends/arm/operators/op_cat.py | 39 +--- backends/arm/operators/op_clamp.py | 142 --------------- backends/arm/operators/op_constant_pad_nd.py | 75 -------- backends/arm/operators/op_conv2d.py | 170 +----------------- backends/arm/operators/op_eq.py | 52 ------ backends/arm/operators/op_erf.py | 32 ---- backends/arm/operators/op_exp.py | 31 ---- backends/arm/operators/op_ge.py | 51 ------ backends/arm/operators/op_gt.py | 51 ------ backends/arm/operators/op_index_select.py | 89 +-------- backends/arm/operators/op_index_tensor.py | 131 +------------- backends/arm/operators/op_le.py | 51 ------ backends/arm/operators/op_log.py | 28 --- backends/arm/operators/op_lt.py | 51 ------ backends/arm/operators/op_max_pool2d.py | 100 ----------- backends/arm/operators/op_maximum.py | 68 ------- backends/arm/operators/op_minimum.py | 68 ------- backends/arm/operators/op_mul.py | 130 -------------- backends/arm/operators/op_neg.py | 49 +---- backends/arm/operators/op_permute.py | 48 +---- backends/arm/operators/op_pow.py | 40 ----- backends/arm/operators/op_reciprocal.py | 30 ---- backends/arm/operators/op_repeat.py | 38 +--- backends/arm/operators/op_rescale.py | 58 ------ backends/arm/operators/op_rshift_tensor.py | 42 +---- backends/arm/operators/op_rsqrt.py | 28 --- backends/arm/operators/op_sigmoid.py | 28 --- backends/arm/operators/op_slice.py | 71 +------- backends/arm/operators/op_sub.py | 108 ----------- backends/arm/operators/op_sum.py | 101 ----------- backends/arm/operators/op_table.py | 39 ---- backends/arm/operators/op_tanh.py | 28 --- backends/arm/operators/op_to_copy.py | 31 +--- .../arm/operators/op_to_dim_order_copy.py | 31 +--- backends/arm/operators/op_transpose.py | 41 +---- .../arm/operators/op_upsample_bilinear2d.py | 102 +---------- .../arm/operators/op_upsample_nearest2d.py | 66 +------ backends/arm/operators/op_view.py | 38 +--- backends/arm/operators/op_where.py | 86 --------- .../operators/operator_validation_utils.py | 6 +- backends/arm/operators/ops_binary.py | 64 +------ backends/arm/operators/ops_identity.py | 37 +--- backends/arm/operators/ops_unary.py | 46 +---- 51 files changed, 28 insertions(+), 3183 deletions(-) diff --git a/backends/arm/operators/node_visitor.py b/backends/arm/operators/node_visitor.py index 5056c5f7f54..afc80bbb849 100644 --- a/backends/arm/operators/node_visitor.py +++ b/backends/arm/operators/node_visitor.py @@ -24,18 +24,11 @@ class NodeVisitor: # a specific TOSA version. # When all node_visitors has been refactored to target a specific # version, this list should be removed. - tosa_specs_1_00 = [ + tosa_specs = [ TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] - tosa_specs_0_80 = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - tosa_specs = tosa_specs_0_80 + tosa_specs_1_00 - def __init__(self, exported_program: ExportedProgram, tosa_spec: TosaSpecification): self._exported_program = exported_program self.tosa_spec = tosa_spec @@ -52,8 +45,6 @@ def define_node( # container for all node visitors _node_visitor_dicts: Dict[TosaSpecification, Dict] = { - TosaSpecification.create_from_string("TOSA-0.80+BI"): {}, - TosaSpecification.create_from_string("TOSA-0.80+MI"): {}, TosaSpecification.create_from_string("TOSA-1.0+INT"): {}, TosaSpecification.create_from_string("TOSA-1.0+FP"): {}, } diff --git a/backends/arm/operators/op_abs.py b/backends/arm/operators/op_abs.py index 65933c8012a..3000af50ed7 100644 --- a/backends/arm/operators/op_abs.py +++ b/backends/arm/operators/op_abs.py @@ -23,111 +23,6 @@ from torch.fx import Node -@register_node_visitor -class AbsVisitor_080_BI(NodeVisitor): - target = "aten.abs.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - # Handle int8 (quantized) and int32 - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32], - output.tosa_spec, - ) - - if inputs[0].dtype == ts.DType.INT8: - rescaled_inputs, scale_back = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) # type: ignore[possibly-undefined] - else: - # input[0].dtype == ts.DType.INT32 - # Non quantized input, natively support by TOSA.abs - rescaled_inputs = inputs - - if output.dtype == ts.DType.INT8: - broadcasted_shape = tutils.tosa_shape(output.shape, output.dim_order) - abs_output = tosa_graph.addIntermediate(broadcasted_shape, ts.DType.INT32) - else: - # output.dtype == ts.DType.INT32 - abs_output = output - - # Do the INT32 Abs - tosa_graph.addOperator( - ts.TosaOp.Op().ABS, - [ - rescaled_inputs[0].name, - ], - [abs_output.name], - None, - ) - - if output.dtype == ts.DType.INT8: - # Scale output back to 8 bit - # pyre-ignore - tqutils.insert_rescale_op_to_int8(tosa_graph, abs_output, scale_back, node) # type: ignore[possibly-undefined] - - -@register_node_visitor -class AbsVisitor_080_MI(AbsVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - - if inputs[0].dtype in [ts.DType.INT8, ts.DType.INT32]: - # Call the inherited define_node for handling integers - super().define_node(node, tosa_graph, inputs, output) - else: - # FP32 Abs lowering - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - # MI lowering - tosa_graph.addOperator( - ts.TosaOp.Op().ABS, - [inputs[0].name], - [output.name], - None, - ) - - @register_node_visitor class AbsVisitor_INT(NodeVisitor): target = "aten.abs.default" diff --git a/backends/arm/operators/op_add.py b/backends/arm/operators/op_add.py index 7851fecf53d..7a022b54395 100644 --- a/backends/arm/operators/op_add.py +++ b/backends/arm/operators/op_add.py @@ -24,122 +24,6 @@ from torch.fx import Node -@register_node_visitor -class AddVisitor_080_BI(NodeVisitor): - target = "aten.add.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32], - output.tosa_spec, - ) - - dim_order = ( - inputs[0].dim_order - if len(inputs[0].shape) > len(inputs[1].shape) - else inputs[1].dim_order - ) - scale_back = 1.0 - if inputs[0].dtype == ts.DType.INT8: - rescaled_inputs, scale_back = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - else: - # input[0].dtype == ts.DType.INT32 - # Non quantized input, natively support by TOSA.ADD - rescaled_inputs = inputs - - if output.dtype == ts.DType.INT8: - broadcasted_shape = tutils.tosa_shape(output.shape, output.dim_order) - add_output = tosa_graph.addIntermediate(broadcasted_shape, ts.DType.INT32) - else: - # output.dtype == ts.DType.INT32 - add_output = output - - input1, input2 = tutils.reshape_for_broadcast( - tosa_graph, rescaled_inputs, dim_order - ) - - # Do the INT32 Add - tosa_graph.addOperator( - ts.TosaOp.Op().ADD, - [input1.name, input2.name], - [add_output.name], - None, - ) - - if output.dtype == ts.DType.INT8: - # Scale output back to 8 bit - # pyre-ignore - tqutils.insert_rescale_op_to_int8( - tosa_graph, add_output, scale_back, node - ) # type: ignore[possibly-undefined] - - -@register_node_visitor -class AddVisitor_080_MI(AddVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - - if inputs[0].dtype in [ts.DType.INT8, ts.DType.INT32]: - # Call the inherited define_node for handling integers - super().define_node(node, tosa_graph, inputs, output) - else: - # FP32 Add lowering - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - input1, input2 = inputs - - # MI lowering - tosa_graph.addOperator( - ts.TosaOp.Op().ADD, - [input1.name, input2.name], - [output.name], - None, - ) - - @register_node_visitor class AddVisitor_INT(NodeVisitor): target = "aten.add.Tensor" diff --git a/backends/arm/operators/op_amax.py b/backends/arm/operators/op_amax.py index 3c4c0b1e5cc..526d6ff35ec 100644 --- a/backends/arm/operators/op_amax.py +++ b/backends/arm/operators/op_amax.py @@ -18,60 +18,11 @@ from torch.fx import Node -@register_node_visitor -class MaxVisitor_0_80(NodeVisitor): - target = "aten.amax.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT16, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - input = inputs[0] - dim = inputs[1].number - - if dim < 0: - tensor = get_first_fake_tensor(node) - rank = len(tensor.size()) - dim = rank + dim - - keep_dims = inputs[2].number - if not keep_dims: - raise RuntimeError( - "TOSA only supports keepdims == True; Did you run the convert_minmax pass?" - ) - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(input.dim_order.index(dim)) - - tosa_graph.addOperator( - ts.TosaOp.Op().REDUCE_MAX, [input.name], [output.name], attr - ) - - @register_node_visitor class MaxVisitor(NodeVisitor): target = "aten.amax.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_amin.py b/backends/arm/operators/op_amin.py index f19520f04e8..85b0b757c85 100644 --- a/backends/arm/operators/op_amin.py +++ b/backends/arm/operators/op_amin.py @@ -18,60 +18,11 @@ from torch.fx import Node -@register_node_visitor -class MinVisitor_0_80(NodeVisitor): - target = "aten.amin.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT16, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - input = inputs[0] - dim = inputs[1].number - - if dim < 0: - tensor = get_first_fake_tensor(node) - rank = len(tensor.size()) - dim = rank + dim - - keep_dims = inputs[2].number - if not keep_dims: - raise RuntimeError( - "TOSA only supports keepdims == True; Did you run the convert_minmax pass?" - ) - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(input.dim_order.index(dim)) - - tosa_graph.addOperator( - ts.TosaOp.Op().REDUCE_MIN, [input.name], [output.name], attr - ) - - @register_node_visitor class MinVisitor(NodeVisitor): target = "aten.amin.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_any.py b/backends/arm/operators/op_any.py index e90b51302d5..0ac307aedd4 100644 --- a/backends/arm/operators/op_any.py +++ b/backends/arm/operators/op_any.py @@ -20,48 +20,11 @@ from torch.fx import Node -@register_node_visitor -class AnyVisitor_0_80(NodeVisitor): - target = "aten.any.dim" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, [inputs[0], output], ts.DType.BOOL, output.tosa_spec - ) - - input_shape = list(inputs[0].shape) - dim = cast(int, inputs[1].number) % len( - input_shape - ) # process the negative index - keep_dim = cast(bool, inputs[2].number if len(inputs) > 2 else False) - if not keep_dim: - raise ValueError("This case should be handled by ConvertAnyDimDimsPass") - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(inputs[0].dim_order.index(dim)) - - tosa_graph.addOperator( - ts.TosaOp.Op().REDUCE_ANY, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class AnyVisitor(NodeVisitor): target = "aten.any.dim" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/op_avg_pool2d.py b/backends/arm/operators/op_avg_pool2d.py index f839ca380ec..9faf8272473 100644 --- a/backends/arm/operators/op_avg_pool2d.py +++ b/backends/arm/operators/op_avg_pool2d.py @@ -26,151 +26,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class AvgPool2dVisitor_0_80_BI(NodeVisitor): - target = "aten.avg_pool2d.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def _build_generic_avgpool2d( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - input_zp: int, - output_zp: int, - accumulator_type: Any, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - input_tensor = inputs[0] - kernel_size_list = inputs[1].special - stride_size_list = inputs[2].special - - if len(inputs) > 4: - ceil_mode = bool(inputs[4].number) - else: - ceil_mode = False - - try: - pad_size_list = inputs[3].special - pad_size_list = [ - pad_size_list[0], - pad_size_list[0], - pad_size_list[1], - pad_size_list[1], - ] - except IndexError: - pad_size_list = [0, 0, 0, 0] - - # Adjust the padding as necessary - pad_size_list[1] = adjust_pooling_pad_if_needed( - input_tensor.shape[2], - kernel_size_list[0], - stride_size_list[0], - pad_size_list[1], - ceil_mode, - ) - pad_size_list[3] = adjust_pooling_pad_if_needed( - input_tensor.shape[3], - kernel_size_list[1], - stride_size_list[1], - pad_size_list[3], - ceil_mode, - ) - - attr = ts.TosaSerializerAttribute() - attr.PoolAttribute( - kernel=kernel_size_list, - stride=stride_size_list, - pad=pad_size_list, - input_zp=input_zp, - output_zp=output_zp, - accum_dtype=accumulator_type, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().AVG_POOL2D, - [input_tensor.name], - [output.name], - attr, - ) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [3, 4, 5, 6, 7]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, [inputs[0], output], ts.DType.INT8, output.tosa_spec - ) - - accumulator_type = ts.DType.INT32 - - input_qargs = get_input_qparams(node) - input_zp = input_qargs[0].get_zp_per_tensor() - - output_qargs = get_output_qparams(node) - output_zp = output_qargs[0].get_zp_per_tensor() - - self._build_generic_avgpool2d( - node, tosa_graph, inputs, output, input_zp, output_zp, accumulator_type - ) - - -@register_node_visitor -class AvgPool2dVisitor_0_80_MI(AvgPool2dVisitor_0_80_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [3, 4, 5, 6, 7]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.FP32], - output.tosa_spec, - ) - - if inputs[0].dtype == ts.DType.INT8: - super().define_node(node, tosa_graph, inputs, output) - - if inputs[0].dtype == ts.DType.FP32: - accumulator_type = ts.DType.FP32 - # Initilize zero point to zero. - input_zp = 0 - output_zp = 0 - - self._build_generic_avgpool2d( - node, tosa_graph, inputs, output, input_zp, output_zp, accumulator_type - ) - - @register_node_visitor class AvgPool2dVisitor(NodeVisitor): target = "aten.avg_pool2d.default" diff --git a/backends/arm/operators/op_bmm.py b/backends/arm/operators/op_bmm.py index 68b5b363703..c9bb0b003ee 100644 --- a/backends/arm/operators/op_bmm.py +++ b/backends/arm/operators/op_bmm.py @@ -23,87 +23,11 @@ validate_valid_dtype, ) from executorch.backends.arm.tosa_mapping import TosaArg -from executorch.backends.arm.tosa_quant_utils import build_rescale, build_rescale_v0_80 +from executorch.backends.arm.tosa_quant_utils import build_rescale from executorch.backends.arm.tosa_specification import TosaSpecification from tosa.RoundingMode import RoundingMode # type: ignore -@register_node_visitor -class BMMVisitor_0_80(NodeVisitor): - target = "aten.bmm.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.FP32], - output.tosa_spec, - ) - - # aten.bmm maps directly to MATMUL - - # For INT8, we need to get the zero points and add an intermediate tensor - # for a later rescale. - if inputs[0].dtype == ts.DType.INT8: - input_qparams = get_input_qparams(node) - input0_zp = input_qparams[0].get_zp_per_tensor() - input1_zp = input_qparams[1].get_zp_per_tensor() - bmm_result = tosa_graph.addIntermediate(output.shape, ts.DType.INT32) - bmm_output_name = bmm_result.name - else: - bmm_output_name = output.name - input0_zp, input1_zp = 0, 0 - - # Add the MATMUL to the TOSA graph. - attr = ts.TosaSerializerAttribute() - attr.MatMulAttribute(A_zp=input0_zp, B_zp=input1_zp) - - tosa_graph.addOperator( - ts.TosaOp.Op().MATMUL, - [inputs[0].name, inputs[1].name], - [bmm_output_name], - attr, - ) - - # As INT8 accumulates into INT32, we need to rescale it back to INT8 - if output.dtype == ts.DType.INT8: - output_qparams = get_output_qparams(node)[0] - final_output_scale = ( - input_qparams[0].get_scale_per_tensor() * input_qparams[1].get_scale_per_tensor() # type: ignore[possibly-undefined] # pyre-ignore[61] - ) / output_qparams.get_scale_per_tensor() - - build_rescale_v0_80( - tosa_fb=tosa_graph, - scale=[final_output_scale], - # pyre-ignore[61]: Uninitialized local [61]: Local variable `bmm_result` is undefined, or not always defined. - input_node=bmm_result, # type: ignore[possibly-undefined] - output_name=output.name, - output_type=ts.DType.INT8, - input_zp=[0], - output_zp=[output_qparams.get_zp_per_tensor()], - is_double_round=False, - ) - - @register_node_visitor class BMMVisitor(NodeVisitor): target = "aten.bmm.default" diff --git a/backends/arm/operators/op_cat.py b/backends/arm/operators/op_cat.py index c7bad9e4429..884bfb22a40 100644 --- a/backends/arm/operators/op_cat.py +++ b/backends/arm/operators/op_cat.py @@ -18,48 +18,11 @@ from torch.fx import Node -@register_node_visitor -class CatVisitor_0_80(NodeVisitor): - target = "aten.cat.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [1, 2]) - - tensors = inputs[0].special - dim = 0 if len(inputs) < 2 else inputs[1].number - rank = len(output.shape) - dim = (dim + rank) % rank - dim = output.dim_order.index(dim) - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(dim) - - tosa_graph.addOperator( - ts.TosaOp.Op().CONCAT, - [tensor.name for tensor in tensors], - [output.name], - attr, - ) - - @register_node_visitor class CatVisitor(NodeVisitor): target = "aten.cat.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_clamp.py b/backends/arm/operators/op_clamp.py index 778f9559be9..2bdeb89a713 100644 --- a/backends/arm/operators/op_clamp.py +++ b/backends/arm/operators/op_clamp.py @@ -26,148 +26,6 @@ from torch.fx import Node -@register_node_visitor -class ClampVisitor_080_BI(NodeVisitor): - target = "aten.clamp.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def _create_clamp_node( - self, - tosa_graph: Any, - input_name: str, - output_name: str, - min_int: int, - max_int: int, - min_fp32: float, - max_fp32: float, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - attr = ts.TosaSerializerAttribute() - attr.ClampAttribute( - tosa_graph.builder, - min_int, - max_int, - min_fp32, - max_fp32, - ) - tosa_graph.addOperator(ts.TosaOp.Op().CLAMP, [input_name], [output_name], attr) - - def _get_min_max_arguments( - self, node: Node, dtype_min: int | float, dtype_max: int | float - ) -> Tuple[int | float, int | float]: - - def cast_type(value: Any) -> int | float: - if isinstance(value, int): - return value - else: - # Attempt to cast to float - return float(value) - - min_arg = dtype_min - max_arg = dtype_max - - if node.args[1] is not None: - min_arg = cast_type(node.args[1]) - - if len(node.args) > 2: - if node.args[2] is not None: - max_arg = cast_type(node.args[2]) - - return min_arg, max_arg - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, [2, 3]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8], - output.tosa_spec, - ) - - min_int8, max_int8 = self._get_min_max_arguments( - node, - torch.iinfo(torch.int8).min, - torch.iinfo(torch.int8).max, - ) - - # NOTE: Quantization of the min/max arguments is handled by QuantizeOperatorArguments - self._create_clamp_node( - tosa_graph, - inputs[0].name, - output.name, - int(min_int8), - int(max_int8), - 0, - 0, - ) - - -@register_node_visitor -class ClampVisitor_080_MI(ClampVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [2, 3]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.FP16, ts.DType.FP32], - output.tosa_spec, - ) - - if inputs[0].dtype == ts.DType.INT8: - # Call the inherited define_node for handling integers - super().define_node(node, tosa_graph, inputs, output) - else: - min_fp32, max_fp32 = self._get_min_max_arguments( - node, - torch.finfo(torch.float32).min, - torch.finfo(torch.float32).max, - ) - - self._create_clamp_node( - tosa_graph, - inputs[0].name, - output.name, - 0, - 0, - min_fp32, - max_fp32, - ) - - @register_node_visitor class ClampVisitor_INT(NodeVisitor): target = "aten.clamp.default" diff --git a/backends/arm/operators/op_constant_pad_nd.py b/backends/arm/operators/op_constant_pad_nd.py index b8f28acb3c3..147a1544ce9 100644 --- a/backends/arm/operators/op_constant_pad_nd.py +++ b/backends/arm/operators/op_constant_pad_nd.py @@ -25,81 +25,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class ConstantPadNDVisitor_0_80(NodeVisitor): - - target = "aten.constant_pad_nd.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ - ts.DType.INT8, - ts.DType.INT32, - ts.DType.FP32, - ts.DType.BOOL, - ], - output.tosa_spec, - ) - - if inputs[0].dtype == ts.DType.INT8: - input_qparams = get_input_qparams(node) - qargs = input_qparams[0] - pad_const_qs = qargs.quantize_value(inputs[2].number).item() - pad_const_fp = 0.0 - else: - pad_const_fp = inputs[2].number - pad_const_qs = 0 - - rank = len(output.shape) - # Each dim needs 2 padding values. For example, to pad the last dimension, the pad has the form - # (padding_left, padding_right); to pad the last two dimensions, the pad has the form - # (padding_left, padding_right, padding_top, padding_bottom), and so on. For PyTorch NCHW format, the padding - # values are in the reverse order. So, firstly we need to reverse the input padding parameters. - input_pad = sum( - [ - [inputs[1].special[i], inputs[1].special[i + 1]] - for i in range(0, len(inputs[1].special), 2) - ][::-1], - [], - ) - # Then, add dummy zeros to make sure that both input_pad and output_pad has the same size. - input_pad = [0] * (rank * 2 - len(inputs[1].special)) + input_pad - # For PyTorch NCHW format, dim order is [0,...,rank-1] - input_dim_order = list(range(rank)) - output_pad = [0] * rank * 2 - - # Map input padding parameters into output padding parameters. TOSA is NHWC format. - for input_dim_idx, input_dim in enumerate(input_dim_order): - output_dim_idx = output.dim_order.index(input_dim) - output_pad[output_dim_idx * 2 : (output_dim_idx + 1) * 2] = input_pad[ - input_dim_idx * 2 : (input_dim_idx + 1) * 2 - ] - - attr = ts.TosaSerializerAttribute() - attr.PadAttribute(tosa_graph.builder, output_pad, pad_const_qs, pad_const_fp) - - tosa_graph.addOperator( - ts.TosaOp.Op().PAD, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class ConstantPadNDVisitor(NodeVisitor): diff --git a/backends/arm/operators/op_conv2d.py b/backends/arm/operators/op_conv2d.py index 3c73e7b32c0..0bbe67c4beb 100644 --- a/backends/arm/operators/op_conv2d.py +++ b/backends/arm/operators/op_conv2d.py @@ -21,175 +21,9 @@ validate_num_inputs, ) from executorch.backends.arm.tosa_mapping import TosaArg -from executorch.backends.arm.tosa_quant_utils import build_rescale, build_rescale_v0_80 +from executorch.backends.arm.tosa_quant_utils import build_rescale from executorch.backends.arm.tosa_specification import TosaSpecification -from executorch.backends.arm.tosa_utils import build_reshape, tosa_shape - - -@register_node_visitor -class Conv2dVisitor_0_80(NodeVisitor): - target = "aten.convolution.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - # torch.nn.Conv2d does not require the result of - # `(input + 2 * pad - dilation * (weight - 1) - 1) / stride` - # must be an integer, but tosa currently strictly require this property. - # This function adjusts the pad value to meet the requirement. - def adjust_pad_if_needed( - self, input_size: int, input_weight: int, stride: int, pad: int, dilation: int - ) -> int: - mod_remainder = ( - input_size + 2 * pad - dilation * (input_weight - 1) - 1 - ) % stride - - # No need to adjust - if mod_remainder == 0: - return pad - - if mod_remainder > pad: - raise RuntimeError( - "This case should be handled by the SizeAdjustConv2d pass, is it enabled?" - ) - return pad - mod_remainder - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - input, weight, bias, stride, pad, dilation, _, _, group = inputs - validate_num_inputs(self.target, inputs, 9) - - # Get the attributes of convolution. - attr = ts.TosaSerializerAttribute() - pad_attr = [val for val in pad.special for _ in (0, 1)] - stride_attr = stride.special - dilation_attr = dilation.special - - # Adjust the pad value if needed to meet the strict convolution output shape calculation. - pad_attr[1] = self.adjust_pad_if_needed( - input.shape[2], - weight.shape[2], - stride_attr[0], - pad_attr[1], - dilation_attr[0], - ) - pad_attr[3] = self.adjust_pad_if_needed( - input.shape[3], - weight.shape[3], - stride_attr[1], - pad_attr[3], - dilation_attr[1], - ) - - input_zp = 0 - if inputs[0].dtype == ts.DType.INT8: - # int8 input requires quantization information - input_qparams = get_input_qparams(node) - input_zp = input_qparams[0].get_zp_per_tensor() - - attr.ConvAttribute( - pad=pad_attr, - stride=stride_attr, - dilation=dilation_attr, - input_zp=input_zp, - weight_zp=0, - local_bound=False, - ) - - # The output type is int32 when input type is int8. - conv2d_output_name = output.name - if output.dtype == ts.DType.INT8: - conv2d_res = tosa_graph.addIntermediate( - tosa_shape(output.shape, output.dim_order), ts.DType.INT32 - ) - conv2d_output_name = conv2d_res.name - - # Given input.shape is (N, Ci, H, W), and weight.shape is (Co, Ci/G, H, W) - in_channels = input.shape[1] - out_channels = weight.shape[0] - if (in_channels == group.number) and (out_channels % in_channels) == 0: - """Depthwise convolution case""" - # Reshape torch shape format of weight tensor to tosa required format. - # https://www.mlplatform.org/tosa/tosa_spec.html#_depthwise_conv2d - m_length = int(out_channels / in_channels) - weight_post_shape = ( - weight.shape[2], - weight.shape[3], - in_channels, - m_length, - ) - - weight_reshaped = tosa_graph.addIntermediate( - weight_post_shape, - weight.dtype, - ) - build_reshape( - tosa_graph, weight.name, weight_post_shape, weight_reshaped.name - ) - tosa_op = ts.TosaOp.Op().DEPTHWISE_CONV2D - weight_name = weight_reshaped.name - else: - """Regular convolution case""" - tosa_op = ts.TosaOp.Op().CONV2D - weight_name = weight.name - - tosa_graph.addOperator( - tosa_op, - [ - input.name, - weight_name, - bias.name, - ], - [conv2d_output_name], - attr, - ) - - # For quantized convolution, rescale the output value back to the same - # integer value domain of the next op. Otherwise return float32 output. - if inputs[0].dtype == ts.DType.INT8: - # Get scale_factor from input, weight, and output. - input_scale = input_qparams[0].get_scale_per_tensor() # type: ignore[possibly-undefined] # pyre-ignore [61] - - per_channel_quant = input_qparams[1].per_channel # pyre-ignore [61] - if per_channel_quant: - weight_scale = input_qparams[1].get_scale_per_channel() - else: - weight_scale = [ - input_qparams[1].get_scale_per_tensor() - ] # pyre-ignore [61] - output_qargs = get_output_qparams(node) - post_conv2d_scale = [ - (inp * w) / out - for inp, w, out in zip( - itertools.cycle([input_scale]), - weight_scale, - itertools.cycle([output_qargs[0].get_scale_per_tensor()]), - ) - ] - - build_rescale_v0_80( - tosa_fb=tosa_graph, - scale=post_conv2d_scale, - input_node=conv2d_res, # type: ignore[possibly-undefined] - output_name=output.name, - output_type=output.dtype, - input_zp=[0], - output_zp=[output_qargs[0].get_zp_per_tensor()], - per_channel=per_channel_quant, - ) # type: ignore[call-arg] +from executorch.backends.arm.tosa_utils import tosa_shape @register_node_visitor diff --git a/backends/arm/operators/op_eq.py b/backends/arm/operators/op_eq.py index c4b60d37036..eb5b3000d6c 100644 --- a/backends/arm/operators/op_eq.py +++ b/backends/arm/operators/op_eq.py @@ -24,58 +24,6 @@ from torch.fx import Node -@register_node_visitor -class EqualVisitor_0_80(NodeVisitor): - target = "aten.eq.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, inputs, ts) - validate_valid_dtype( - self.target, - inputs, - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - validate_valid_dtype(self.target, output, ts.DType.BOOL, output.tosa_spec) - - input_nodes = inputs - # Handle quantization - if inputs[0].dtype == ts.DType.INT8: - # Rescale inputs to 32 bit - rescaled_inputs, _ = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - # Update IO - input_nodes = rescaled_inputs - - # Do the equal comparison - tosa_graph.addOperator( - ts.TosaOp.Op().EQUAL, - [input_nodes[0].name, input_nodes[1].name], - output.name, - None, - ) - - @register_node_visitor class EqualVisitor(NodeVisitor): target = "aten.eq.Tensor" diff --git a/backends/arm/operators/op_erf.py b/backends/arm/operators/op_erf.py index f828cae9c8d..e238c4fd80a 100644 --- a/backends/arm/operators/op_erf.py +++ b/backends/arm/operators/op_erf.py @@ -19,38 +19,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class ERFVisitor_080_MI(NodeVisitor): - target = "aten.erf.default" - - # BI case handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - ts.DType.FP32, - output.tosa_spec, - ) - - # MI lowering - tosa_graph.addOperator(ts.TosaOp.Op().ERF, [inputs[0].name], [output.name]) - - @register_node_visitor class ERFVisitor(NodeVisitor): target = "aten.erf.default" diff --git a/backends/arm/operators/op_exp.py b/backends/arm/operators/op_exp.py index 2dcf2c2f250..96c077c838b 100644 --- a/backends/arm/operators/op_exp.py +++ b/backends/arm/operators/op_exp.py @@ -20,37 +20,6 @@ from torch.fx import Node -@register_node_visitor -class ExpVisitor_0_80_MI(NodeVisitor): - target = "aten.exp.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - ts.DType.FP32, - output.tosa_spec, - ) - - tosa_graph.addOperator(ts.TosaOp.Op().EXP, [inputs[0].name], [output.name]) - - @register_node_visitor class ExpVisitor(NodeVisitor): target = "aten.exp.default" diff --git a/backends/arm/operators/op_ge.py b/backends/arm/operators/op_ge.py index 02815dde489..723706702f0 100644 --- a/backends/arm/operators/op_ge.py +++ b/backends/arm/operators/op_ge.py @@ -24,57 +24,6 @@ from torch.fx import Node -@register_node_visitor -class GreaterEqualVisitor_0_80(NodeVisitor): - target = "aten.ge.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, inputs, ts) - validate_valid_dtype( - self.target, - inputs, - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - validate_valid_dtype(self.target, output, ts.DType.BOOL, output.tosa_spec) - - input_nodes = inputs - # Handle quantization - if inputs[0].dtype == ts.DType.INT8: - # Rescale inputs to 32 bit - rescaled_inputs, _ = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - # Update IO - input_nodes = rescaled_inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().GREATER_EQUAL, - [input_nodes[0].name, input_nodes[1].name], - [output.name], - None, - ) - - @register_node_visitor class GreaterEqualVisitor(NodeVisitor): target = "aten.ge.Tensor" diff --git a/backends/arm/operators/op_gt.py b/backends/arm/operators/op_gt.py index fb2d3fa100c..e79ed009e24 100644 --- a/backends/arm/operators/op_gt.py +++ b/backends/arm/operators/op_gt.py @@ -24,57 +24,6 @@ from torch.fx import Node -@register_node_visitor -class GreaterThanVisitor_0_80(NodeVisitor): - target = "aten.gt.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, inputs, ts) - validate_valid_dtype( - self.target, - inputs, - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - validate_valid_dtype(self.target, output, ts.DType.BOOL, output.tosa_spec) - - input_nodes = inputs - # Handle quantization - if inputs[0].dtype == ts.DType.INT8: - # Rescale inputs to 32 bit - rescaled_inputs, _ = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - # Update IO - input_nodes = rescaled_inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().GREATER, - [input_nodes[0].name, input_nodes[1].name], - [output.name], - None, - ) - - @register_node_visitor class GreaterThanVisitor(NodeVisitor): target = "aten.gt.Tensor" diff --git a/backends/arm/operators/op_index_select.py b/backends/arm/operators/op_index_select.py index 7f8f582d0f9..a42f85abc4c 100644 --- a/backends/arm/operators/op_index_select.py +++ b/backends/arm/operators/op_index_select.py @@ -15,7 +15,7 @@ ) from executorch.backends.arm.tosa_mapping import TosaArg -from executorch.backends.arm.tosa_utils import build_reshape, build_reshape_tosa_1_0 +from executorch.backends.arm.tosa_utils import build_reshape_tosa_1_0 from torch.fx import Node @@ -34,7 +34,7 @@ class IndexSelectVisitor(NodeVisitor): """ target = "aten.index_select.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) @@ -98,88 +98,3 @@ def define_node( build_reshape_tosa_1_0( tosa_graph, output_name, output_real_shape, output.name ) - - -@register_node_visitor -class IndexSelectVisitor_0_80(NodeVisitor): - """ - Simple example: - o = index_select(weights, index, indices) - Becomes: - i = view_copy(i) # reshape flattened indicies, i.e. [I] => [1, I] - o = index_select(w, index, i) - - Additional steps in case weights (w) are rank 2: - - before: insert view_copy to make rank 3, [x,y] => [1, x, y] - - after: insert view_copy to squeeze back output dims, [1, x, y] = [x,y] - """ - - target = "aten.index_select.default" - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts_v0_80 # type: ignore - - # Specification (0.80) states that input and output types - # should all be the same - if inputs[0].dtype != output.dtype: - raise ValueError( - f"Input and output type not same: {inputs[0].dtype} != {output.dtype:}" - ) - - if len(inputs) != 3: - raise ValueError(f"Number of inputs are not 3: {len(inputs)}") - - weights, index, indices = inputs - - if len(weights.shape) == 2: - weights_new_shape = [1, weights.shape[0], weights.shape[1]] - weights_reshaped = tosa_graph.addIntermediate( - weights_new_shape, - weights.dtype, - ) - build_reshape( - tosa_graph, weights.name, weights_new_shape, weights_reshaped.name - ) - - output_new_shape = [1, output.shape[0], output.shape[1]] - output_reshaped = tosa_graph.addIntermediate( - output_new_shape, - output.dtype, - ) - - else: - weights_reshaped = weights - output_reshaped = output - - output_name = output_reshaped.name - - # Reshape flattened indicies, i.e. [I] => [1, I] - indices_new_shape = [1, indices.shape[0]] - indices_reshaped = tosa_graph.addIntermediate( - indices_new_shape, - indices.dtype, - ) - build_reshape( - tosa_graph, indices.name, indices_new_shape, indices_reshaped.name - ) - - tosa_graph.addOperator( - ts_v0_80.TosaOp.Op().GATHER, - [weights_reshaped.name, indices_reshaped.name], - [output_name], - None, - ) - - if len(weights.shape) == 2: - output_real_shape = [output.shape[0], output.shape[1]] - build_reshape(tosa_graph, output_name, output_real_shape, output.name) diff --git a/backends/arm/operators/op_index_tensor.py b/backends/arm/operators/op_index_tensor.py index 36d0b37e090..7afd7fe6612 100644 --- a/backends/arm/operators/op_index_tensor.py +++ b/backends/arm/operators/op_index_tensor.py @@ -24,6 +24,7 @@ from torch.fx import Node +@register_node_visitor class CommonIndexTensorVisitor(NodeVisitor): target = "aten.index.Tensor" @@ -92,136 +93,6 @@ def _calculate_value_strides(self, values_shape: List[int]) -> List[int]: return values_strides -@register_node_visitor -class IndexTensorVisitor_080(CommonIndexTensorVisitor): - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - """ - This approach uses the fact that all indexing tensors are incremented - simultaneously and they essentially act as a map along the corresponding - dimensions of the values tensor. - Note: that this does not hold true when slicing or ellipsis ops - are involved as such they are not currently not supported. - - As such this approach flattens out the values tensor and - constructs a flattened out index obtained by flattening out the - index tensors, multiplying them by the relevant stride and accumulating them. - - This approach suffers from the fact that we are taking a number of index tensors of - type int32 and applying multiplications and additions. - - If the number of total elements in the values tensor exceeds int32 limits - then this approach falls apart. - """ - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_same_dtype(self.target, [inputs[0], output]) - - values, indices = inputs - index_nodes = indices.special - - # Broadcast indices - broadcasted_tensors = tutils.broadcast_tensors( - tosa_graph, index_nodes, self.tosa_spec - ) - - values_strides = self._calculate_value_strides(values.shape) - - # The indices have already been broadcast to a common shape - # in so they are all the same. - _, index_dtype, index_shape = self._get_tensor_info(broadcasted_tensors[0]) - - N, K, W, C = self._calculate_tosa_vals(index_shape, index_nodes, values.shape) - - gather_idx_shape = [N, W] - - gather_index_name = "" - # Flatten out and shift indexes. - for i, index_node in enumerate(broadcasted_tensors): - index_name, _, _ = self._get_tensor_info(index_node) - index_name = index_node.name - - stride_shifted_indices = tosa_graph.addIntermediate( - index_shape, - index_dtype, - ) - - # Division by C is necessary when len(indices) < values.rank - # When there are dimensions left unindexed that changes the - # channels and thus the stride-shift. - data = np.full(index_shape, int(values_strides[i] / C)) - mul_const = tosa_graph.addConst(index_shape, index_dtype, data) - attr = ts.TosaSerializerAttribute() - attr.MulAttribute(shift=0) - tosa_graph.addOperator( - ts.TosaOp.Op().MUL, - [index_name, mul_const.name], - [stride_shifted_indices.name], - attr, - ) - - reshaped_idxs = tosa_graph.addIntermediate( - gather_idx_shape, - index_dtype, - ) - tutils.build_reshape( - tosa_graph, - stride_shifted_indices.name, - gather_idx_shape, - reshaped_idxs.name, - ) - - # Guarantees that the accumulation tensor is properly - # initialized and does not contain junk data. - if i == 0: - gather_index_name = reshaped_idxs.name - else: - add_idxs = tosa_graph.addIntermediate( - reshaped_idxs.shape, - reshaped_idxs.dtype, - ) - tosa_graph.addOperator( - ts.TosaOp.Op().ADD, - [gather_index_name, reshaped_idxs.name], - [add_idxs.name], - ) - gather_index_name = add_idxs.name - - gather_vals_shape = [N, K, C] - reshaped_input = tosa_graph.addIntermediate(gather_vals_shape, values.dtype) - tutils.build_reshape( - tosa_graph, values.name, gather_vals_shape, reshaped_input.name - ) - - gather_out_shape = (N, W, C) - gather_out = tosa_graph.addIntermediate( - gather_out_shape, - output.dtype, - ) - tosa_graph.addOperator( - ts.TosaOp.Op().GATHER, - [reshaped_input.name, gather_index_name], - [gather_out.name], - None, - ) - - output_shape = tutils.tosa_shape(output.shape, output.dim_order) - tutils.build_reshape(tosa_graph, gather_out.name, output_shape, output.name) - - @register_node_visitor class IndexTensorVisitor(CommonIndexTensorVisitor): tosa_specs = [ diff --git a/backends/arm/operators/op_le.py b/backends/arm/operators/op_le.py index af615f8aacd..9301f91cb4c 100644 --- a/backends/arm/operators/op_le.py +++ b/backends/arm/operators/op_le.py @@ -24,57 +24,6 @@ from torch.fx import Node -@register_node_visitor -class LessEqualVisitor_0_80(NodeVisitor): - target = "aten.le.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, inputs, ts) - validate_valid_dtype( - self.target, - inputs, - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - validate_valid_dtype(self.target, output, ts.DType.BOOL, output.tosa_spec) - - input_nodes = inputs - # Handle quantization - if inputs[0].dtype == ts.DType.INT8: - # Rescale inputs to 32 bit - rescaled_inputs, _ = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - # Update IO - input_nodes = rescaled_inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().GREATER_EQUAL, - [input_nodes[1].name, input_nodes[0].name], - [output.name], - None, - ) - - @register_node_visitor class LessEqualVisitor(NodeVisitor): target = "aten.le.Tensor" diff --git a/backends/arm/operators/op_log.py b/backends/arm/operators/op_log.py index 72faa99d0a4..8a48fe4fda5 100644 --- a/backends/arm/operators/op_log.py +++ b/backends/arm/operators/op_log.py @@ -20,34 +20,6 @@ from torch.fx import Node -@register_node_visitor -class LogVisitor_0_80_MI(NodeVisitor): - target = "aten.log.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - tosa_graph.addOperator(ts.TosaOp.Op().LOG, [inputs[0].name], [output.name]) - - @register_node_visitor class LogVisitor(NodeVisitor): target = "aten.log.default" diff --git a/backends/arm/operators/op_lt.py b/backends/arm/operators/op_lt.py index 7b483e075ec..31083e93590 100644 --- a/backends/arm/operators/op_lt.py +++ b/backends/arm/operators/op_lt.py @@ -24,57 +24,6 @@ from torch.fx import Node -@register_node_visitor -class LessThanVisitor_0_80(NodeVisitor): - target = "aten.lt.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, inputs, ts) - validate_valid_dtype( - self.target, - inputs, - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - validate_valid_dtype(self.target, output, ts.DType.BOOL, output.tosa_spec) - - input_nodes = inputs - # Handle quantization - if inputs[0].dtype == ts.DType.INT8: - # Rescale inputs to 32 bit - rescaled_inputs, _ = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - # Update IO - input_nodes = rescaled_inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().GREATER, - [input_nodes[1].name, input_nodes[0].name], - [output.name], - None, - ) - - @register_node_visitor class LessThanVisitor(NodeVisitor): target = "aten.lt.Tensor" diff --git a/backends/arm/operators/op_max_pool2d.py b/backends/arm/operators/op_max_pool2d.py index b3c779477ca..754fcfcd638 100644 --- a/backends/arm/operators/op_max_pool2d.py +++ b/backends/arm/operators/op_max_pool2d.py @@ -8,10 +8,6 @@ import torch -from executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass import ( - get_input_qparams, - get_output_qparams, -) from executorch.backends.arm.operators.node_visitor import ( NodeVisitor, register_node_visitor, @@ -26,102 +22,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class MaxPool2dVisitor_0_80(NodeVisitor): - target = "aten.max_pool2d.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [3, 4, 5, 6]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.FP32], - output.tosa_spec, - ) - - input_tensor = inputs[0] - kernel_size = inputs[1].special - stride = inputs[2].special - - if len(inputs) == 6: - ceil_mode = bool(inputs[5].number) - else: - ceil_mode = False - try: - pad_size_list = inputs[3].special - pad_size_list = [ - pad_size_list[0], - pad_size_list[0], - pad_size_list[1], - pad_size_list[1], - ] - except (IndexError, AttributeError): - pad_size_list = [0, 0, 0, 0] - - # Adjust the padding as necessary - pad_size_list[1] = adjust_pooling_pad_if_needed( - input_tensor.shape[2], - kernel_size[0], - stride[0], - pad_size_list[1], - ceil_mode, - ) - pad_size_list[3] = adjust_pooling_pad_if_needed( - input_tensor.shape[3], - kernel_size[1], - stride[1], - pad_size_list[3], - ceil_mode, - ) - - accumulator_type = output.dtype - - # Initilize zero point to zero. - input_zp = 0 - if inputs[0].dtype == ts.DType.INT8: - input_qparams = get_input_qparams(node) - input_zp = input_qparams[0].get_zp_per_tensor() - - output_zp = 0 - if output.dtype == ts.DType.INT8: - output_qparams = get_output_qparams(node) - output_zp = output_qparams[0].get_zp_per_tensor() - - attr = ts.TosaSerializerAttribute() - attr.PoolAttribute( - kernel=kernel_size, - stride=stride, - pad=pad_size_list, - input_zp=input_zp, - output_zp=output_zp, - accum_dtype=accumulator_type, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().MAX_POOL2D, - [input_tensor.name], - [output.name], - attr, - ) - - @register_node_visitor class MaxPool2dVisitor(NodeVisitor): target = "aten.max_pool2d.default" diff --git a/backends/arm/operators/op_maximum.py b/backends/arm/operators/op_maximum.py index 834429e7bed..27e5fdc2e02 100644 --- a/backends/arm/operators/op_maximum.py +++ b/backends/arm/operators/op_maximum.py @@ -28,74 +28,6 @@ from torch.fx import Node -@register_node_visitor -class MaxVisitor_0_80(NodeVisitor): - target = "aten.maximum.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - scale_back = 1.0 - max_output = output - if inputs[0].dtype == ts.DType.INT8: - input_qparams = get_input_qparams(node) - if len(input_qparams) != 2: - raise ValueError( - f"Both inputs need to have quantization information for {node}" - ) - if input_qparams[0] != input_qparams[1]: - raise ValueError( - "Both inputs must have the same quantization parameters for MAX" - ) - - # insert RESCALEs to int32 - operand_inputs, scale_back = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - output.shape = tosa_shape(output.shape, output.dim_order) - max_output = tosa_graph.addIntermediate(output.shape, ts.DType.INT32) - else: - operand_inputs = inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().MAXIMUM, - [ - operand_inputs[0].name, - operand_inputs[1].name, - ], - [max_output.name], - ) - - if output.dtype == ts.DType.INT8: - # insert RESCALE from int32 back to int8 - tqutils.insert_rescale_op_to_int8(tosa_graph, max_output, scale_back, node) - - @register_node_visitor class MaxVisitor(NodeVisitor): target = "aten.maximum.default" diff --git a/backends/arm/operators/op_minimum.py b/backends/arm/operators/op_minimum.py index 856686cbf47..9dfa7d1f394 100644 --- a/backends/arm/operators/op_minimum.py +++ b/backends/arm/operators/op_minimum.py @@ -27,74 +27,6 @@ from torch.fx import Node -@register_node_visitor -class MinVisitor_0_80(NodeVisitor): - target = "aten.minimum.default" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - scale_back = 1.0 - min_output = output - if inputs[0].dtype == ts.DType.INT8: - input_qparams = get_input_qparams(node) - if len(input_qparams) != 2: - raise ValueError( - f"Both inputs need to have quantization information for {node}" - ) - if input_qparams[0] != input_qparams[1]: - raise ValueError( - "Both inputs must have the same quantization parameters for MIN" - ) - - # insert RESCALEs to int32 - operand_inputs, scale_back = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - - output.shape = tosa_shape(output.shape, output.dim_order) - min_output = tosa_graph.addIntermediate(output.shape, ts.DType.INT32) - else: - operand_inputs = inputs - - tosa_graph.addOperator( - ts.TosaOp.Op().MINIMUM, - [ - operand_inputs[0].name, - operand_inputs[1].name, - ], - [min_output.name], - ) - - if output.dtype == ts.DType.INT8: - # insert RESCALE from int32 back to int8 - tqutils.insert_rescale_op_to_int8(tosa_graph, min_output, scale_back, node) - - @register_node_visitor class MinVisitor(NodeVisitor): target = "aten.minimum.default" diff --git a/backends/arm/operators/op_mul.py b/backends/arm/operators/op_mul.py index 4c09ed91f16..7d9f6eac6aa 100644 --- a/backends/arm/operators/op_mul.py +++ b/backends/arm/operators/op_mul.py @@ -26,136 +26,6 @@ ) from executorch.backends.arm.tosa_mapping import TosaArg from executorch.backends.arm.tosa_specification import TosaSpecification -from executorch.backends.arm.tosa_utils import reshape_for_broadcast - - -@register_node_visitor -class MulVisitor_080_BI(NodeVisitor): - target = "aten.mul.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32], - output.tosa_spec, - ) - - dim_order = ( - inputs[0].dim_order - if len(inputs[0].shape) > len(inputs[1].shape) - else inputs[1].dim_order - ) - if inputs[0].dtype == ts.DType.INT8: - input_A = inputs[0] - input_B = inputs[1] - input_qparams = get_input_qparams(node) - input_A_qargs = input_qparams[0] - input_B_qargs = input_qparams[1] - input_A.shape = tutils.tosa_shape(input_A.shape, input_A.dim_order) - input_B.shape = tutils.tosa_shape(input_B.shape, input_B.dim_order) - - # Rescale inputs to INT32 with zp=0 - input_A_rescaled = tqutils.build_rescale_to_int32( - tosa_graph, - input_A, - input_A_qargs.get_zp_per_tensor(), - 1.0, - ) - input_B_rescaled = tqutils.build_rescale_to_int32( - tosa_graph, - input_B, - input_B_qargs.get_zp_per_tensor(), - 1.0, - ) - else: - # input[0].dtype == ts.DType.INT32 - # Non quantized input, natively support by TOSA.MUL - input_A_rescaled, input_B_rescaled = inputs[0], inputs[1] - - if output.dtype == ts.DType.INT8: - output_shape = tutils.tosa_shape(output.shape, output.dim_order) - mul_output = tosa_graph.addIntermediate(output_shape, ts.DType.INT32) - else: - # output.dtype == ts.DType.INT32 - mul_output = output - - input1, input2 = tutils.reshape_for_broadcast( - tosa_graph, - [ - input_A_rescaled, - input_B_rescaled, - ], - dim_order, - ) - - # Do the INT32 Mul - attr = ts.TosaSerializerAttribute() - attr.MulAttribute(shift=0) - tosa_graph.addOperator( - ts.TosaOp.Op().MUL, - [input1.name, input2.name], - [mul_output.name], - attr, - ) - - if output.dtype == ts.DType.INT8: - # Scale output back to 8 bit - output_scale = ( - input_A_qargs.get_scale_per_tensor() # type: ignore[possibly-undefined] - * input_B_qargs.get_scale_per_tensor() # type: ignore[possibly-undefined] - ) - tqutils.insert_rescale_op_to_int8( - tosa_graph, mul_output, output_scale, node - ) - - -@register_node_visitor -class MulVisitor_080_MI(MulVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - - if inputs[0].dtype == ts.DType.INT8: - return super().define_node(node, tosa_graph, inputs, output) - - input1, input2 = reshape_for_broadcast(tosa_graph, inputs) - - attr = ts.TosaSerializerAttribute() - attr.MulAttribute(shift=0) - tosa_graph.addOperator( - ts.TosaOp.Op().MUL, [input1.name, input2.name], [output.name], attr - ) @register_node_visitor diff --git a/backends/arm/operators/op_neg.py b/backends/arm/operators/op_neg.py index e3b3eabf9ba..54f3dafe769 100644 --- a/backends/arm/operators/op_neg.py +++ b/backends/arm/operators/op_neg.py @@ -37,58 +37,11 @@ def get_negate_zero_points(node: torch.fx.Node, is_int8: bool) -> tuple[int, int return (0, 0) -@register_node_visitor -class NegVisitor_0_80(NodeVisitor): - target = "aten.neg.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - supported_dtypes = [ - ts.DType.INT8, - ts.DType.INT16, - ts.DType.INT32, - ts.DType.FP16, - ts.DType.BF16, - ts.DType.FP32, - ] - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], supported_dtypes, output.tosa_spec - ) - - input_zp, output_zp = get_negate_zero_points( - node, inputs[0].dtype == ts.DType.INT8 - ) - - attr = ts.TosaSerializerAttribute() - attr.NegateAttribute(input1_zp=input_zp, output_zp=output_zp) - tosa_graph.addOperator( - ts.TosaOp.Op().NEGATE, - [inputs[0].name], - [output.name], - attributes=attr, - ) - - @register_node_visitor class NegVisitor(NodeVisitor): target = "aten.neg.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_permute.py b/backends/arm/operators/op_permute.py index 25cd294ba93..0830d8f4504 100644 --- a/backends/arm/operators/op_permute.py +++ b/backends/arm/operators/op_permute.py @@ -94,57 +94,11 @@ def transform_permutation_vector(permutation_vector: list[int], dim_order: list[ return permutation_vector -@register_node_visitor -class PermuteVisitor_0_80(NodeVisitor): - target = "aten.permute_copy.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - # The permutation vector describes a permutation P in default Pytorch dim_order. - # For rank 4, the default dim_order NCHW. - # E.g. (2,3,0,1) -> permute (n,c,h,w) to (w,c,n,h) - permutation_vector = inputs[1].special - - if output.dim_order != tuple(range(len(output.dim_order))): - # the permutation vector can't be used directly if we are not in NCHW dim_order. - # Transform to dim_order. - permutation_vector = transform_permutation_vector( - permutation_vector, output.dim_order - ) - - attr = ts.TosaSerializerAttribute() - attr.TransposeAttribute(permutation_vector) - tosa_graph.addOperator( - ts.TosaOp.Op().TRANSPOSE, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class PermuteVisitor(NodeVisitor): target = "aten.permute_copy.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_pow.py b/backends/arm/operators/op_pow.py index ab5f5ac2f9e..413160c902a 100644 --- a/backends/arm/operators/op_pow.py +++ b/backends/arm/operators/op_pow.py @@ -21,46 +21,6 @@ from torch.fx import Node -@register_node_visitor -class PowVisitor_080_MI(NodeVisitor): - target = "aten.pow.Tensor_Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.FP16, ts.DType.FP32], - output.tosa_spec, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().POW, - [ - inputs[0].name, - inputs[1].name, - ], - [output.name], - None, - ) - - @register_node_visitor class PowVisitor(NodeVisitor): target = "aten.pow.Tensor_Tensor" diff --git a/backends/arm/operators/op_reciprocal.py b/backends/arm/operators/op_reciprocal.py index 26a86ee2330..3838afd9728 100644 --- a/backends/arm/operators/op_reciprocal.py +++ b/backends/arm/operators/op_reciprocal.py @@ -21,36 +21,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class ReciprocalVisitor_080_MI(NodeVisitor): - target = "aten.reciprocal.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().RECIPROCAL, [inputs[0].name], [output.name] - ) - - @register_node_visitor class ReciprocalVisitor(NodeVisitor): target = "aten.reciprocal.default" diff --git a/backends/arm/operators/op_repeat.py b/backends/arm/operators/op_repeat.py index 069cf32f27b..3e636e993b7 100644 --- a/backends/arm/operators/op_repeat.py +++ b/backends/arm/operators/op_repeat.py @@ -21,47 +21,11 @@ from executorch.backends.arm.tosa_utils import tosa_shape -@register_node_visitor -class RepeatVisitor_0_80(NodeVisitor): - target = "aten.repeat.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: list[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - multiples = inputs[1].special - - attr = ts.TosaSerializerAttribute() - attr.TileAttribute(tosa_shape(multiples, output.dim_order)) - tosa_graph.addOperator( - ts.TosaOp.Op().TILE, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class RepeatVisitor(NodeVisitor): target = "aten.repeat.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_rescale.py b/backends/arm/operators/op_rescale.py index df8d3c7dbef..c9ea96baec5 100644 --- a/backends/arm/operators/op_rescale.py +++ b/backends/arm/operators/op_rescale.py @@ -7,7 +7,6 @@ from typing import Any, cast, List -import executorch.backends.arm.tosa_quant_utils as tosa_quant_utils import torch from executorch.backends.arm.operators.node_visitor import ( NodeVisitor, @@ -23,63 +22,6 @@ from torch.fx import Node -@register_node_visitor -class RescaleVisitor_0_80(NodeVisitor): - target = "_rescale.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 5) - - input_dtype = node.all_input_nodes[0].meta["val"].dtype - output_dtype = cast(torch.dtype, node.args[1]) - scale = cast(float, node.args[2]) - input_zp = cast(int, node.args[3]) - output_zp = cast(int, node.args[4]) - - if input_dtype != torch.int8 and input_zp != 0: - raise ValueError( - f"If input dtype is not int8, input_zp must be 0. Got input_dtype{input_dtype=}, {input_zp=}" - ) - if output_dtype != torch.int8 and output_zp != 0: - raise ValueError( - f"If output dtype is not int8, output_zp must be 0. Got {output_dtype=}, {output_zp=}" - ) - - # scale32 gives higher accuracy but for a higher HW cost. - # For now, always go for scale32. - scale_32 = True - scale_width = 32 if scale_32 else 16 - multiplier, shift = tosa_quant_utils.compute_multiplier_and_shift( - [scale], scale_width - ) - attr_rescale = ts.TosaSerializerAttribute() - attr_rescale.RescaleAttribute( - input_zp=input_zp, - output_zp=output_zp, - multiplier=multiplier, - shift=shift, - scale32=scale_32, - double_round=False, - per_channel=False, - input_unsigned=False, - output_unsigned=False, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().RESCALE, [inputs[0].name], [output.name], attr_rescale - ) - - @register_node_visitor class RescaleVisitor_INT(NodeVisitor): target = "_rescale.default" diff --git a/backends/arm/operators/op_rshift_tensor.py b/backends/arm/operators/op_rshift_tensor.py index c46b358638f..5313f5c8143 100644 --- a/backends/arm/operators/op_rshift_tensor.py +++ b/backends/arm/operators/op_rshift_tensor.py @@ -21,51 +21,11 @@ from executorch.backends.arm.tosa_mapping import TosaArg -@register_node_visitor -class RshiftVisitor_0_80(NodeVisitor): - target = "aten.bitwise_right_shift.Tensor" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT16, ts.DType.INT32], - output.tosa_spec, - ) - - attr = ts.TosaSerializerAttribute() - round = False - if self.tosa_spec.is_U55_subset: - # U55 only supports INT32 and round == True - # TODO MLETORCH-525 Emulate round == False with different decomposition - round = True - attr.ArithmeticRightShiftAttribute(round=round) - - tosa_graph.addOperator( - ts.TosaOp.Op().ARITHMETIC_RIGHT_SHIFT, - [inputs[0].name, inputs[1].name], - [output.name], - attr, - ) - - @register_node_visitor class RshiftVisitor(NodeVisitor): target = "aten.bitwise_right_shift.Tensor" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/op_rsqrt.py b/backends/arm/operators/op_rsqrt.py index 6f8340141cc..df293946ded 100644 --- a/backends/arm/operators/op_rsqrt.py +++ b/backends/arm/operators/op_rsqrt.py @@ -21,34 +21,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class RsqrtVisitor_080_MI(NodeVisitor): - target = "aten.rsqrt.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - tosa_graph.addOperator(ts.TosaOp.Op().RSQRT, [inputs[0].name], [output.name]) - - @register_node_visitor class RsqrtVisitor(NodeVisitor): target = "aten.rsqrt.default" diff --git a/backends/arm/operators/op_sigmoid.py b/backends/arm/operators/op_sigmoid.py index 880bbe29a05..dec42ae15f9 100644 --- a/backends/arm/operators/op_sigmoid.py +++ b/backends/arm/operators/op_sigmoid.py @@ -20,34 +20,6 @@ from torch.fx import Node -@register_node_visitor -class SigmoidVisitor_080_MI(NodeVisitor): - target = "aten.sigmoid.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - tosa_graph.addOperator(ts.TosaOp.Op().SIGMOID, [inputs[0].name], [output.name]) - - @register_node_visitor class SigmoidVisitor(NodeVisitor): target = "aten.sigmoid.default" diff --git a/backends/arm/operators/op_slice.py b/backends/arm/operators/op_slice.py index 23acf304bbb..56115073ce1 100644 --- a/backends/arm/operators/op_slice.py +++ b/backends/arm/operators/op_slice.py @@ -34,80 +34,11 @@ def _fixup_end(end, shape, dim): return min(end.number, shape[dim]) -@register_node_visitor -class SliceVisitor_080(NodeVisitor): - target = "aten.slice_copy.Tensor" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, [4, 5]) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - # See slice_copy_support.py - if not (len(inputs) == 4 or (len(inputs) == 5 and inputs[4].number == 1)): - raise ValueError("Unsupported combination of inputs") - - # aten.slice_copy supports slicing in 1d at a time. - # The arguments are the actual input, dimension of slicing, start index, end index and optinal step or stride. - input_node, dim, start, end = inputs - - # Translate and check parameters in Pytorch dim order. - shape = input_node.shape - dim = dim.number - - start_index = _fixup_start(start, shape, dim) - end_index = _fixup_end(end, shape, dim) - size = end_index - start_index - - if size <= 0: - raise ValueError( - f"The calculated slice size must be positive. Got {size=} " - f"with {start_index=} and {end_index=}." - ) - if size > shape[dim]: - raise ValueError( - f"The calculated slice size cannot be greater than the dimension size" - f". Got {size=} and {shape[dim]=}." - ) - - # Convert aten args to Tosa's start and size attributes and in TOSA dim order. - attr = ts.TosaSerializerAttribute() - - start_attr = [ - _fixup_start(start, shape, dim) if i == dim else 0 - for i in input_node.dim_order - ] - size_attr = [size if i == dim else shape[i] for i in input_node.dim_order] - attr.SliceAttribute(start_attr, size_attr) - - tosa_graph.addOperator( - ts.TosaOp.Op().SLICE, [input_node.name], [output.name], attr - ) - - @register_node_visitor class SliceVisitor(NodeVisitor): target = "aten.slice_copy.Tensor" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_sub.py b/backends/arm/operators/op_sub.py index 07986ea14ae..18b3c853271 100644 --- a/backends/arm/operators/op_sub.py +++ b/backends/arm/operators/op_sub.py @@ -24,114 +24,6 @@ from torch.fx import Node -@register_node_visitor -class SubVisitor_080_BI(NodeVisitor): - target = "aten.sub.Tensor" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT32], - output.tosa_spec, - ) - - scale_back = 1.0 - if inputs[0].dtype == ts.DType.INT8: - rescaled_inputs, scale_back = tqutils.insert_rescale_ops_to_int32( - tosa_graph, inputs, node - ) - else: - # input[0].dtype == ts.DType.INT32 - # Non quantized input, natively support by TOSA.SUB - rescaled_inputs = inputs - - if output.dtype == ts.DType.INT8: - broadcasted_shape = tutils.tosa_shape(output.shape, output.dim_order) - sub_output = tosa_graph.addIntermediate(broadcasted_shape, ts.DType.INT32) - else: - # output.dtype == ts.DType.INT32 - sub_output = output - - # Do the INT32 Sub - tosa_graph.addOperator( - ts.TosaOp.Op().SUB, - [ - rescaled_inputs[0].name, - rescaled_inputs[1].name, - ], - [sub_output.name], - None, - ) - - if output.dtype == ts.DType.INT8: - # Scale output back to 8 bit - # pyre-ignore - tqutils.insert_rescale_op_to_int8( - tosa_graph, sub_output, scale_back, node - ) # type: ignore[possibly-undefined] - - -@register_node_visitor -class SubVisitor_080_MI(SubVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - - if inputs[0].dtype in [ts.DType.INT8, ts.DType.INT32]: - # Call the inherited define_node for handling integers - super().define_node(node, tosa_graph, inputs, output) - else: - # FP32 Sub lowering - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - # MI lowering - tosa_graph.addOperator( - ts.TosaOp.Op().SUB, - [inputs[0].name, inputs[1].name], - [output.name], - None, - ) - - @register_node_visitor class SubVisitor_INT(NodeVisitor): target = "aten.sub.Tensor" diff --git a/backends/arm/operators/op_sum.py b/backends/arm/operators/op_sum.py index 84a662db01c..54e848a1bef 100644 --- a/backends/arm/operators/op_sum.py +++ b/backends/arm/operators/op_sum.py @@ -23,107 +23,6 @@ from torch.fx import Node -@register_node_visitor -class SumVisitor_080_BI(NodeVisitor): - target = "aten.sum.dim_IntList" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - - tensor = inputs[0] - input_shape = list(tensor.shape) - dim = int(inputs[1].number % len(input_shape)) - - output_shape = input_shape - output_shape[dim] = 1 # Output shape is input shape with dim reduced - - # Rescale input to 32 bit - rescaled_inputs, scale = tqutils.insert_rescale_ops_to_int32( - tosa_graph, - [tensor], - node, - ) - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(tensor.dim_order.index(dim)) - - intermediate = tosa_graph.addIntermediate( - tutils.tosa_shape(output_shape, tensor.dim_order), - dtype=ts.DType.INT32, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().REDUCE_SUM, - [rescaled_inputs[0].name], - [intermediate.name], - attr, - ) - - tqutils.insert_rescale_op_to_int8(tosa_graph, intermediate, scale, node) - - -@register_node_visitor -class SumVisitor_080_MI(SumVisitor_080_BI): - # inheriting 'target' from BI class - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - - if inputs[0].dtype == ts.DType.INT8: - return super().define_node(node, tosa_graph, inputs, output) - - tensor = inputs[0] - input_shape = list(tensor.shape) - dim = int(inputs[1].number % len(input_shape)) - - output_shape = input_shape - output_shape[dim] = 1 # Output shape is input shape with dim reduced - - attr = ts.TosaSerializerAttribute() - attr.AxisAttribute(tensor.dim_order.index(dim)) - - tosa_graph.addOperator( - ts.TosaOp.Op().REDUCE_SUM, - [tensor.name], - [output.name], - attr, - ) - - @register_node_visitor class SumVisitor_INT(NodeVisitor): target = "aten.sum.dim_IntList" diff --git a/backends/arm/operators/op_table.py b/backends/arm/operators/op_table.py index 86720eec373..557281f4d2a 100644 --- a/backends/arm/operators/op_table.py +++ b/backends/arm/operators/op_table.py @@ -7,7 +7,6 @@ from typing import Any, List -import numpy as np import torch from executorch.backends.arm.operators.node_visitor import ( NodeVisitor, @@ -22,44 +21,6 @@ from executorch.backends.arm.tosa_specification import TosaSpecification -@register_node_visitor -class TableVisitor_0_80(NodeVisitor): - target = "_table.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_valid_dtype( - self.target, inputs, [ts.DType.INT8, ts.DType.INT16], output.tosa_spec - ) - if inputs[0].dtype == ts.DType.INT8: - validate_valid_dtype(self.target, output, ts.DType.INT8, output.tosa_spec) - if inputs[0].dtype == ts.DType.INT16: - validate_valid_dtype(self.target, output, ts.DType.INT32, output.tosa_spec) - - if node.name not in self._exported_program.state_dict.keys(): # type: ignore[union-attr] - raise RuntimeError( - f"Did not find key {node.name} in state_dict {self._exported_program.state_dict.keys()}." - ) - - table = self._exported_program.state_dict[node.name] # type: ignore[union-attr] - table_attr = ts.TosaSerializerAttribute() - table_attr.TableAttribute(np.array(table)) - - tosa_graph.addOperator( - ts.TosaOp.Op().TABLE, [inputs[0].name], [output.name], table_attr - ) - - @register_node_visitor class TableVisitor(NodeVisitor): target = "_table.default" diff --git a/backends/arm/operators/op_tanh.py b/backends/arm/operators/op_tanh.py index 4804af9b382..0d149397eb6 100644 --- a/backends/arm/operators/op_tanh.py +++ b/backends/arm/operators/op_tanh.py @@ -21,34 +21,6 @@ from torch.fx import Node -@register_node_visitor -class TanhVisitor_0_80_MI(NodeVisitor): - target = "aten.tanh.default" - - # BI case should be handled by op_table - tosa_specs = [TosaSpecification.create_from_string("TOSA-0.80+MI")] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - validate_valid_dtype( - self.target, [*inputs, output], ts.DType.FP32, output.tosa_spec - ) - - tosa_graph.addOperator(ts.TosaOp.Op().TANH, [inputs[0].name], [output.name]) - - @register_node_visitor class TanhVisitor(NodeVisitor): target = "aten.tanh.default" diff --git a/backends/arm/operators/op_to_copy.py b/backends/arm/operators/op_to_copy.py index 5dde6828f72..9758a018b87 100644 --- a/backends/arm/operators/op_to_copy.py +++ b/backends/arm/operators/op_to_copy.py @@ -18,35 +18,6 @@ from executorch.backends.arm.tosa_mapping import TosaArg -@register_node_visitor -class ToCopyVisitor_0_80(NodeVisitor): - """ - Implement the type cast functionality of _to_copy. - - Other features like setting of the memory_format or moving a tensor to a - different device are not supported. - - Also note that the node should not be quantized. - """ - - target = "aten._to_copy.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - - tosa_graph.addOperator(ts.TosaOp.Op().CAST, [inputs[0].name], [output.name]) - - @register_node_visitor class ToCopyVisitor(NodeVisitor): """ @@ -60,7 +31,7 @@ class ToCopyVisitor(NodeVisitor): target = "aten._to_copy.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/op_to_dim_order_copy.py b/backends/arm/operators/op_to_dim_order_copy.py index d68bee88a64..74bf1a5ad14 100644 --- a/backends/arm/operators/op_to_dim_order_copy.py +++ b/backends/arm/operators/op_to_dim_order_copy.py @@ -18,35 +18,6 @@ from executorch.backends.arm.tosa_mapping import TosaArg -@register_node_visitor -class ToDimOrderCopyVisitor_0_80(NodeVisitor): - """ - Implement the type cast functionality of _to_dim_order_copy. - - Other features like setting of the dim_order or moving a tensor to a - different device are not supported. - - Also note that the node should not be quantized. - """ - - target = "dim_order_ops._to_dim_order_copy.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 1) - - tosa_graph.addOperator(ts.TosaOp.Op().CAST, [inputs[0].name], [output.name]) - - @register_node_visitor class ToDimOrderCopyVisitor(NodeVisitor): """ @@ -60,7 +31,7 @@ class ToDimOrderCopyVisitor(NodeVisitor): target = "dim_order_ops._to_dim_order_copy.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/op_transpose.py b/backends/arm/operators/op_transpose.py index 2198e05abb7..0845c3ed61c 100644 --- a/backends/arm/operators/op_transpose.py +++ b/backends/arm/operators/op_transpose.py @@ -21,45 +21,6 @@ from executorch.backends.arm.tosa_mapping import TosaArg -@register_node_visitor -class TransposeVisitor_0_80(NodeVisitor): - """ - This node visitor targets the _transpose op defined in the - passthrough_to_tosa library. Used when switching between tosa_dim_orders. - Inserts a TOSA TRANSPOSE. - """ - - target = "_transpose.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - output_rank = len(output.shape) - perms = [dim % output_rank for dim in inputs[1].special] - attr = ts.TosaSerializerAttribute() - attr.TransposeAttribute(perms) - tosa_graph.addOperator( - ts.TosaOp.Op().TRANSPOSE, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class TransposeVisitor(NodeVisitor): """ @@ -70,7 +31,7 @@ class TransposeVisitor(NodeVisitor): target = "_transpose.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/op_upsample_bilinear2d.py b/backends/arm/operators/op_upsample_bilinear2d.py index c7edee9d882..26927bfcfa2 100644 --- a/backends/arm/operators/op_upsample_bilinear2d.py +++ b/backends/arm/operators/op_upsample_bilinear2d.py @@ -18,113 +18,15 @@ validate_valid_dtype, ) from executorch.backends.arm.tosa_mapping import TosaArg -from executorch.backends.arm.tosa_quant_utils import build_rescale, build_rescale_v0_80 +from executorch.backends.arm.tosa_quant_utils import build_rescale from executorch.backends.arm.tosa_utils import get_resize_parameters, tosa_shape -@register_node_visitor -class UpsampleBilinear2dVisitor_0_80(NodeVisitor): - target = "aten.upsample_bilinear2d.vec" - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - from tosa_tools.v0_80.tosa.ResizeMode import ResizeMode # type: ignore - - validate_num_inputs(self.target, inputs, 4) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - if inputs[0].shape is None or output.shape is None: - raise ValueError("Only static shapes are supported") - - input_dtype = inputs[0].dtype - - # tosa_shape output is NHWC, take HW - input_size_yx = tuple([inputs[0].shape[dim] for dim in inputs[0].dim_order])[ - 1:3 - ] - output_size_yx = tuple([output.shape[dim] for dim in output.dim_order])[1:3] - - # Get align_corners value from the node arguments. - align_corners = bool(node.args[2]) - scale_n_yx, scale_d_yx, offset_yx, border_yx = get_resize_parameters( - input_size_yx, - output_size_yx, - ResizeMode.NEAREST, - align_corners=align_corners, - ) - - def in_int16_range(x): - return torch.all(x >= -(2**15)) and torch.all(x <= 2**15 - 1) - - if not in_int16_range(scale_n_yx): - raise ValueError("scale_n_yx is out of the int16 range") - if not in_int16_range(scale_d_yx): - raise ValueError("scale_d_yx is out of the int16 range") - if not in_int16_range(border_yx): - raise ValueError("border_yx is out of the int16 range") - - attr = ts.TosaSerializerAttribute() - attr.ResizeAttribute( - scale=[scale_n_yx[0], scale_d_yx[0], scale_n_yx[1], scale_d_yx[1]], - offset=offset_yx.tolist(), - border=border_yx.tolist(), - mode=ResizeMode.BILINEAR, - ) - - if input_dtype == output.dtype == ts.DType.FP32: - tosa_graph.addOperator( - ts.TosaOp.Op().RESIZE, [inputs[0].name], [output.name], attr - ) - return - elif input_dtype == output.dtype == ts.DType.INT8: - intermediate = tosa_graph.addIntermediate( - tosa_shape(output.shape, output.dim_order), ts.DType.INT32 - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().RESIZE, [inputs[0].name], [intermediate.name], attr - ) - - final_output_scale = float(1 / (scale_n_yx[0] * scale_n_yx[1])) - - build_rescale_v0_80( - tosa_fb=tosa_graph, - scale=[final_output_scale], - input_node=intermediate, - output_name=output.name, - output_type=ts.DType.INT8, - input_zp=[0], - output_zp=[0], - is_double_round=False, - ) - else: - raise ValueError( - "Input/output dtype not in {float32, int8}: {input_dtype=} {output.dtype=}" - ) - - @register_node_visitor class UpsampleBilinear2dVisitor(NodeVisitor): target = "aten.upsample_bilinear2d.vec" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_upsample_nearest2d.py b/backends/arm/operators/op_upsample_nearest2d.py index 1c53a6c3c3c..46dcc0605e6 100644 --- a/backends/arm/operators/op_upsample_nearest2d.py +++ b/backends/arm/operators/op_upsample_nearest2d.py @@ -20,76 +20,14 @@ from executorch.backends.arm.tosa_mapping import TosaArg from executorch.backends.arm.tosa_utils import get_resize_parameters -from tosa_tools.v0_80.tosa.ResizeMode import ResizeMode # type: ignore - - -@register_node_visitor -class UpsampleNearest2dVisitor_0_80(NodeVisitor): - target = "aten.upsample_nearest2d.vec" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 3) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32], - output.tosa_spec, - ) - - # tosa_shape output is NHWC, take HW - input_size_yx = tuple([inputs[0].shape[dim] for dim in inputs[0].dim_order])[ - 1:3 - ] - output_size_yx = tuple([output.shape[dim] for dim in output.dim_order])[1:3] - - # Align corners shouldn't make a difference for nearest upsampling. We set to False so - # half pixel centers are used for resize parameter logic. - scale_n_yx, scale_d_yx, offset_yx, border_yx = get_resize_parameters( - input_size_yx, output_size_yx, ResizeMode.NEAREST, align_corners=False - ) - - def in_int16_range(x): - return torch.all(x >= -(2**15)) and torch.all(x <= 2**15 - 1) - - if not in_int16_range(scale_n_yx): - raise ValueError("scale_n_yx is out of the int16 range") - if not in_int16_range(scale_d_yx): - raise ValueError("scale_d_yx is out of the int16 range") - if not in_int16_range(border_yx): - raise ValueError("border_yx is out of the int16 range") - - attr = ts.TosaSerializerAttribute() - attr.ResizeAttribute( - scale=[scale_n_yx[0], scale_d_yx[0], scale_n_yx[1], scale_d_yx[1]], - offset=offset_yx.tolist(), - border=border_yx.tolist(), - mode=ResizeMode.NEAREST, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().RESIZE, [inputs[0].name], [output.name], attr - ) +from tosa.ResizeMode import ResizeMode # type: ignore @register_node_visitor class UpsampleNearest2dVisitor(NodeVisitor): target = "aten.upsample_nearest2d.vec" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_view.py b/backends/arm/operators/op_view.py index 3a34a830d22..1e8c06b691f 100644 --- a/backends/arm/operators/op_view.py +++ b/backends/arm/operators/op_view.py @@ -21,47 +21,11 @@ from executorch.backends.arm.tosa_utils import tosa_shape -@register_node_visitor -class ViewVisitor_0_80(NodeVisitor): - target = "aten.view_copy.default" - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [inputs[0], output], ts) - validate_valid_dtype( - self.target, - [inputs[0], output], - [ts.DType.INT8, ts.DType.INT32, ts.DType.FP32, ts.DType.BOOL], - output.tosa_spec, - ) - - attr = ts.TosaSerializerAttribute() - new_shape = tosa_shape(inputs[1].special, output.dim_order) - attr.ReshapeAttribute(new_shape) - tosa_graph = cast(ts.TosaSerializer, tosa_graph) - tosa_graph.addOperator( - ts.TosaOp.Op().RESHAPE, [inputs[0].name], [output.name], attr - ) - - @register_node_visitor class ViewVisitor(NodeVisitor): target = "aten.view_copy.default" - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) diff --git a/backends/arm/operators/op_where.py b/backends/arm/operators/op_where.py index 402acaaf492..e6a87be6387 100644 --- a/backends/arm/operators/op_where.py +++ b/backends/arm/operators/op_where.py @@ -20,92 +20,6 @@ from torch.fx import Node -@register_node_visitor -class WhereVisitor_0_80_BI(NodeVisitor): - target = "aten.where.self" - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def _add_node_to_tosa_graph( - self, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - supported_dtypes: Sequence, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - validate_num_inputs(self.target, inputs, 3) - # Not first input, which is condition tensor. - validate_same_dtype(self.target, inputs[1:], ts) - validate_valid_dtype(self.target, inputs[0], ts.DType.BOOL, output.tosa_spec) - validate_valid_dtype( - self.target, - [*inputs[1:], output], - supported_dtypes, - output.tosa_spec, - ) - - tosa_graph.addOperator( - ts.TosaOp.Op().SELECT, - [inputs[0].name, inputs[1].name, inputs[2].name], - [output.name], - None, - ) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - bi_supported_dtypes = [ - ts.DType.INT8, - ts.DType.INT16, - ts.DType.INT32, - ts.DType.BOOL, - ] - self._add_node_to_tosa_graph(tosa_graph, inputs, output, bi_supported_dtypes) - - -@register_node_visitor -class WhereVisitor_0_80_MI(WhereVisitor_0_80_BI): - - tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), - ] - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - mi_supported_dtypes = [ - ts.DType.FP16, - ts.DType.FP32, - ts.DType.INT8, - ts.DType.INT16, - ts.DType.INT32, - ts.DType.BOOL, - ] - self._add_node_to_tosa_graph(tosa_graph, inputs, output, mi_supported_dtypes) - - @register_node_visitor class WhereVisitor_INT(NodeVisitor): target = "aten.where.self" diff --git a/backends/arm/operators/operator_validation_utils.py b/backends/arm/operators/operator_validation_utils.py index fde76f31c7a..cc8317497b8 100644 --- a/backends/arm/operators/operator_validation_utils.py +++ b/backends/arm/operators/operator_validation_utils.py @@ -6,7 +6,7 @@ from math import ceil, floor from typing import Any, List, Optional -from executorch.backends.arm.operators.node_visitor import NodeVisitor +import serializer.tosa_serializer as ts def validate_num_inputs(op_name: str, inputs: List[Any], expected: int | List[int]): @@ -158,10 +158,6 @@ def validate_valid_dtype( ) """ - if tosa_spec in NodeVisitor.tosa_specs_0_80: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - else: - import serializer.tosa_serializer as ts if not tensors: raise ValueError( diff --git a/backends/arm/operators/ops_binary.py b/backends/arm/operators/ops_binary.py index 9c0c15364fc..dc9bd446a34 100644 --- a/backends/arm/operators/ops_binary.py +++ b/backends/arm/operators/ops_binary.py @@ -22,62 +22,12 @@ from executorch.backends.arm.tosa_mapping import TosaArg -def binary_operator_factory_0_80(bw_target: str, tosa_op): - """Creates and registers NodeVisitors for operators that have two inputs and map directly to a TOSA op.""" - - class BinaryOperator_0_80(NodeVisitor): - target = bw_target - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore # noqa: F401 - - validate_num_inputs(self.target, inputs, 2) - validate_same_dtype(self.target, [*inputs, output], ts) - - if self.target in [ - "aten.bitwise_and.Tensor", - "aten.bitwise_xor.Tensor", - "aten.bitwise_or.Tensor", - "aten.bitwise_left_shift.Tensor", - ]: - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.INT8, ts.DType.INT16, ts.DType.INT32], - output.tosa_spec, - ) - if self.target in [ - "aten.logical_and.default", - "aten.logical_xor.defaul", - "aten.logical_or.default", - ]: - validate_valid_dtype( - self.target, - [*inputs, output], - [ts.DType.BOOL], - output.tosa_spec, - ) - - tosa_graph.addOperator( - tosa_op, [inputs[0].name, inputs[1].name], [output.name] - ) - - register_node_visitor(BinaryOperator_0_80) - - def binary_operator_factory(bw_target: str, tosa_op): """Creates and registers NodeVisitors for operators that have two inputs and map directly to a TOSA op.""" class BinaryOperator(NodeVisitor): target = bw_target - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, @@ -122,18 +72,6 @@ def define_node( register_node_visitor(BinaryOperator) -import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - -binary_operator_factory_0_80("aten.bitwise_and.Tensor", ts.TosaOp.Op().BITWISE_AND) -binary_operator_factory_0_80("aten.bitwise_xor.Tensor", ts.TosaOp.Op().BITWISE_XOR) -binary_operator_factory_0_80("aten.bitwise_or.Tensor", ts.TosaOp.Op().BITWISE_OR) -binary_operator_factory_0_80("aten.logical_and.default", ts.TosaOp.Op().LOGICAL_AND) -binary_operator_factory_0_80("aten.logical_xor.default", ts.TosaOp.Op().LOGICAL_XOR) -binary_operator_factory_0_80("aten.logical_or.default", ts.TosaOp.Op().LOGICAL_OR) -binary_operator_factory_0_80( - "aten.bitwise_left_shift.Tensor", ts.TosaOp.Op().LOGICAL_LEFT_SHIFT -) - import serializer.tosa_serializer as ts # type: ignore binary_operator_factory("aten.bitwise_and.Tensor", ts.TosaOp.Op().BITWISE_AND) diff --git a/backends/arm/operators/ops_identity.py b/backends/arm/operators/ops_identity.py index ad5ee0c956d..238b033f8eb 100644 --- a/backends/arm/operators/ops_identity.py +++ b/backends/arm/operators/ops_identity.py @@ -21,41 +21,6 @@ from executorch.backends.arm.tosa_mapping import TosaArg -def identity_operator_factory_v0_80(identity_target: str): - """ - Creates and registers NodeVisitors for operators that map directly - to a TOSA IDENTITY op. - """ - - class IdentityOperatorVisitor(NodeVisitor): - target = identity_target - - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - - # Simply add an identityOp - tosa_graph.addOperator( - ts.TosaOp.Op().IDENTITY, [inputs[0].name], [output.name] - ) - - register_node_visitor(IdentityOperatorVisitor) - - -identity_operator_factory_v0_80("getitem") -identity_operator_factory_v0_80("aten.alias_copy.default") - - def identity_operator_factory(identity_target: str): """ Creates and registers NodeVisitors for operators that map directly @@ -65,7 +30,7 @@ def identity_operator_factory(identity_target: str): class IdentityOperatorVisitor(NodeVisitor): target = identity_target - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def define_node( self, diff --git a/backends/arm/operators/ops_unary.py b/backends/arm/operators/ops_unary.py index 3345619a68e..48092e13968 100644 --- a/backends/arm/operators/ops_unary.py +++ b/backends/arm/operators/ops_unary.py @@ -21,44 +21,6 @@ from executorch.backends.arm.tosa_mapping import TosaArg -def unary_operator_factory_0_80(unary_target: str, tosa_op): - "Creates and registers NodeVisitors for operations that have one input and map directly into a TOSA op." - - # Some TOSA unary operators only support float - fp_only_ops = ["aten.floor.default"] - - class UnaryOperator_0_80(NodeVisitor): - target = unary_target - tosa_specs = NodeVisitor.tosa_specs_0_80 - - def __init__(self, *args): - super().__init__(*args) - - def define_node( - self, - node: torch.fx.Node, - tosa_graph: Any, - inputs: List[TosaArg], - output: TosaArg, - ) -> None: - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore # noqa: F401 - - validate_num_inputs(self.target, inputs, 1) - validate_same_dtype(self.target, [*inputs, output], ts) - - if self.target in fp_only_ops: - validate_valid_dtype( - self.target, - inputs[0], - ts.DType.FP32, - output.tosa_spec, - ) - - tosa_graph.addOperator(tosa_op, [inputs[0].name], [output.name]) - - register_node_visitor(UnaryOperator_0_80) - - def unary_operator_factory(unary_target: str, tosa_op): "Creates and registers NodeVisitors for operations that have one input and map directly into a TOSA op." @@ -67,7 +29,7 @@ def unary_operator_factory(unary_target: str, tosa_op): class UnaryOperator(NodeVisitor): target = unary_target - tosa_specs = NodeVisitor.tosa_specs_1_00 + tosa_specs = NodeVisitor.tosa_specs def __init__(self, *args): super().__init__(*args) @@ -97,12 +59,6 @@ def define_node( register_node_visitor(UnaryOperator) -import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - -unary_operator_factory_0_80("aten.ceil.default", ts.TosaOp.Op().CEIL) -unary_operator_factory_0_80("aten.floor.default", ts.TosaOp.Op().FLOOR) -unary_operator_factory_0_80("aten.logical_not.default", ts.TosaOp.Op().LOGICAL_NOT) - import serializer.tosa_serializer as ts # type: ignore unary_operator_factory("aten.ceil.default", ts.TosaOp.Op().CEIL) From 4c50d97602389f55409d954118fc95da9d04c302 Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Tue, 24 Jun 2025 15:11:15 +0100 Subject: [PATCH 2/6] Arm backend: Remove TOSA 0.80 from operator support Change-Id: I21503bcab233d813759132b4c5a33dc6f7ed4f13 --- backends/arm/operator_support/convolution_support.py | 2 -- backends/arm/operator_support/embedding_support.py | 2 -- backends/arm/operator_support/index_select_support.py | 2 -- backends/arm/operator_support/index_tensor_support.py | 2 -- backends/arm/operator_support/minmax_support.py | 1 - backends/arm/operator_support/pool_2d_support.py | 4 ---- backends/arm/operator_support/reduce_sum_support.py | 2 -- backends/arm/operator_support/right_shift_support.py | 2 -- backends/arm/operator_support/sin_cos_support.py | 1 - backends/arm/operator_support/slice_copy_support.py | 2 -- backends/arm/operator_support/to_copy_support.py | 2 -- backends/arm/operator_support/tosa_supported_operators.py | 2 -- 12 files changed, 24 deletions(-) diff --git a/backends/arm/operator_support/convolution_support.py b/backends/arm/operator_support/convolution_support.py index 3e3149f3443..692d744025f 100644 --- a/backends/arm/operator_support/convolution_support.py +++ b/backends/arm/operator_support/convolution_support.py @@ -21,8 +21,6 @@ class ConvolutionSupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.convolution.default] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/embedding_support.py b/backends/arm/operator_support/embedding_support.py index 02460965a34..58a3a3e3edb 100644 --- a/backends/arm/operator_support/embedding_support.py +++ b/backends/arm/operator_support/embedding_support.py @@ -20,8 +20,6 @@ class EmbeddingSupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.embedding.default] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/index_select_support.py b/backends/arm/operator_support/index_select_support.py index 81d0785b86a..9a48012f603 100644 --- a/backends/arm/operator_support/index_select_support.py +++ b/backends/arm/operator_support/index_select_support.py @@ -18,8 +18,6 @@ class IndexSelectSupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.index_select.default] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/index_tensor_support.py b/backends/arm/operator_support/index_tensor_support.py index 7330f98667d..65ea5755d7e 100644 --- a/backends/arm/operator_support/index_tensor_support.py +++ b/backends/arm/operator_support/index_tensor_support.py @@ -100,8 +100,6 @@ class IndexTensorSupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.index.Tensor] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/minmax_support.py b/backends/arm/operator_support/minmax_support.py index 86b949082eb..1c4b0dd6c78 100644 --- a/backends/arm/operator_support/minmax_support.py +++ b/backends/arm/operator_support/minmax_support.py @@ -21,7 +21,6 @@ class MinMaxSupported(SupportedTOSAOperatorCheck): # TODO : "MLETORCH-718 : Quantization of indices in arm_quantizer" tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/pool_2d_support.py b/backends/arm/operator_support/pool_2d_support.py index 677436ddc50..4ce0f7d75e7 100644 --- a/backends/arm/operator_support/pool_2d_support.py +++ b/backends/arm/operator_support/pool_2d_support.py @@ -43,8 +43,6 @@ class AvgPool2dSupported(SupportedTOSAOperatorCheck): ] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] @@ -122,8 +120,6 @@ class MaxPool2dSupported(SupportedTOSAOperatorCheck): ] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/reduce_sum_support.py b/backends/arm/operator_support/reduce_sum_support.py index 4d0614d4b1a..0c614eb2bd5 100644 --- a/backends/arm/operator_support/reduce_sum_support.py +++ b/backends/arm/operator_support/reduce_sum_support.py @@ -19,8 +19,6 @@ class SumSupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.sum.dim_IntList] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/right_shift_support.py b/backends/arm/operator_support/right_shift_support.py index d18950a58a2..454a3b525e3 100644 --- a/backends/arm/operator_support/right_shift_support.py +++ b/backends/arm/operator_support/right_shift_support.py @@ -27,8 +27,6 @@ class RightShiftSupported(SupportedTOSAOperatorCheck): ] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/sin_cos_support.py b/backends/arm/operator_support/sin_cos_support.py index 9dd63e8258d..03ce1da684b 100644 --- a/backends/arm/operator_support/sin_cos_support.py +++ b/backends/arm/operator_support/sin_cos_support.py @@ -23,7 +23,6 @@ class SinCosSupported(SupportedTOSAOperatorCheck): ] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/slice_copy_support.py b/backends/arm/operator_support/slice_copy_support.py index 3c0c69969c5..ad9b5b250dd 100644 --- a/backends/arm/operator_support/slice_copy_support.py +++ b/backends/arm/operator_support/slice_copy_support.py @@ -22,8 +22,6 @@ class SliceCopySupported(SupportedTOSAOperatorCheck): targets = [exir_ops.edge.aten.slice_copy.Tensor] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/to_copy_support.py b/backends/arm/operator_support/to_copy_support.py index 7f27d0b5b36..a10f3acb766 100644 --- a/backends/arm/operator_support/to_copy_support.py +++ b/backends/arm/operator_support/to_copy_support.py @@ -29,8 +29,6 @@ class ToCopySupported(SupportedTOSAOperatorCheck): ] tosa_specs = [ - TosaSpecification.create_from_string("TOSA-0.80+BI"), - TosaSpecification.create_from_string("TOSA-0.80+MI"), TosaSpecification.create_from_string("TOSA-1.0+INT"), TosaSpecification.create_from_string("TOSA-1.0+FP"), ] diff --git a/backends/arm/operator_support/tosa_supported_operators.py b/backends/arm/operator_support/tosa_supported_operators.py index 29ef36aa658..b51a2b265f2 100644 --- a/backends/arm/operator_support/tosa_supported_operators.py +++ b/backends/arm/operator_support/tosa_supported_operators.py @@ -69,8 +69,6 @@ def is_node_tosa_supported( # container for all SupportedTosaOperatorCheck classes _tosa_spec_support: dict[TosaSpecification, list[Type[SupportedTOSAOperatorCheck]]] = { - TosaSpecification.create_from_string("TOSA-0.80+BI"): [], - TosaSpecification.create_from_string("TOSA-0.80+MI"): [], TosaSpecification.create_from_string("TOSA-1.0+INT"): [], TosaSpecification.create_from_string("TOSA-1.0+FP"): [], } From 26a3584f541efc28f530c93b6601efd36dba3651 Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Tue, 24 Jun 2025 15:34:14 +0100 Subject: [PATCH 3/6] Arm backend: Remove TOSA 0.80 from passes Change-Id: I9ff98f6560c686527cba18c28ea98c00683a3c03 --- backends/arm/_passes/arm_pass_manager.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/backends/arm/_passes/arm_pass_manager.py b/backends/arm/_passes/arm_pass_manager.py index 6a25b8b3a8a..a66abd51fb3 100644 --- a/backends/arm/_passes/arm_pass_manager.py +++ b/backends/arm/_passes/arm_pass_manager.py @@ -105,7 +105,7 @@ def _transform(self, graph_module: GraphModule): with TosaLoweringContext(self.tosa_spec): return self(graph_module).graph_module - def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModule: + def _tosa_INT_pipeline(self, exported_program: ExportedProgram) -> GraphModule: self.add_pass(FuseQuantizedActivationPass()) self.add_pass(RemoveGetItemPass()) self.add_pass(ConvertSplitToSlicePass()) @@ -162,7 +162,7 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul return self._transform(exported_program.graph_module) - def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModule: + def _tosa_FP_pipeline(self, exported_program: ExportedProgram) -> GraphModule: self.add_pass(DecomposeMaskedFill()) self.add_pass(DecomposeRoundPass()) self.add_pass(DecomposeAcoshPass()) @@ -235,22 +235,12 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul return self._transform(exported_program.graph_module) - def _tosa_1_0_int_quantized_pipeline(self, exported_program: ExportedProgram): - return self._tosa_080_BI_pipeline(exported_program) - - def _tosa_1_0_fp_pipeline(self, exported_program: ExportedProgram): - return self._tosa_080_MI_pipeline(exported_program) - def transform_to_backend_pipeline(self, exported_program: ExportedProgram): """Apply passes before transforming program to backend""" - if self.tosa_spec == TosaSpecification.create_from_string("TOSA-0.80.0+BI"): - return self._tosa_080_BI_pipeline(exported_program) - elif self.tosa_spec == TosaSpecification.create_from_string("TOSA-0.80.0+MI"): - return self._tosa_080_MI_pipeline(exported_program) - elif self.tosa_spec == TosaSpecification.create_from_string("TOSA-1.0+FP"): - return self._tosa_1_0_fp_pipeline(exported_program) + if self.tosa_spec == TosaSpecification.create_from_string("TOSA-1.0+FP"): + return self._tosa_FP_pipeline(exported_program) elif self.tosa_spec == TosaSpecification.create_from_string("TOSA-1.0+INT"): - return self._tosa_1_0_int_quantized_pipeline(exported_program) + return self._tosa_INT_pipeline(exported_program) else: raise NotImplementedError( f"No pass pipeline implemented for {self.tosa_spec=}" From fec01d2e99f8eeddc8d492993ce49baa3483b357 Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Tue, 24 Jun 2025 15:48:54 +0100 Subject: [PATCH 4/6] Arm backend: Remove TOSA 0.80 from test infrastructure - Update test names to use INT/FP - Update the test name checker script for INT/FP Change-Id: I93acbd0e5f0c6bca6095fb39f267ed7a01bf0796 --- backends/arm/scripts/parse_test_names.py | 6 +- backends/arm/test/common.py | 12 +- backends/arm/test/conftest.py | 11 -- .../arm/test/misc/test_bn_relu_folding_qat.py | 7 +- .../arm/test/misc/test_custom_partition.py | 18 +- backends/arm/test/misc/test_debug_feats.py | 49 +++-- .../arm/test/misc/test_dim_order_guards.py | 12 +- backends/arm/test/misc/test_lifted_tensor.py | 20 +-- .../arm/test/misc/test_multiple_delegates.py | 12 +- .../arm/test/misc/test_multiple_outputs.py | 20 +-- .../test/misc/test_non_persistent_buffers.py | 12 +- ...test_partition_decomposed_quantized_ops.py | 24 +-- backends/arm/test/misc/test_tosa_spec.py | 48 +---- .../test_CLIPTextModelWithProjection.py | 2 +- .../test_SD3Transformer2DModel.py | 8 +- .../stable_diffusion/test_T5EncoderModel.py | 2 +- .../test_vae_AutoencoderKL.py | 4 +- backends/arm/test/models/test_conformer.py | 24 +-- .../arm/test/models/test_deit_tiny_arm.py | 12 +- backends/arm/test/models/test_dl3_arm.py | 24 +-- backends/arm/test/models/test_llama.py | 12 +- backends/arm/test/models/test_lstm_arm.py | 24 +-- .../arm/test/models/test_mobilenet_v2_arm.py | 24 +-- .../arm/test/models/test_mobilenet_v3_arm.py | 24 +-- .../arm/test/models/test_nn_functional.py | 12 +- backends/arm/test/models/test_nn_modules.py | 12 +- .../arm/test/models/test_torch_functions.py | 12 +- backends/arm/test/models/test_w2l_arm.py | 24 +-- backends/arm/test/ops/test_abs.py | 24 +-- backends/arm/test/ops/test_acosh.py | 32 ++-- .../arm/test/ops/test_adaptive_avg_pool2d.py | 24 +-- backends/arm/test/ops/test_add.py | 53 +++--- backends/arm/test/ops/test_addmm.py | 24 +-- backends/arm/test/ops/test_alias_copy.py | 24 +-- backends/arm/test/ops/test_amax.py | 32 ++-- backends/arm/test/ops/test_amin.py | 32 ++-- backends/arm/test/ops/test_any.py | 20 +-- backends/arm/test/ops/test_arange.py | 44 ++--- backends/arm/test/ops/test_asin.py | 24 +-- backends/arm/test/ops/test_at.py | 36 ++-- backends/arm/test/ops/test_atan.py | 24 +-- backends/arm/test/ops/test_atanh.py | 24 +-- backends/arm/test/ops/test_avg_pool2d.py | 26 +-- backends/arm/test/ops/test_batch_norm.py | 50 +++--- backends/arm/test/ops/test_bitwise.py | 90 +++++----- backends/arm/test/ops/test_bmm.py | 40 ++--- backends/arm/test/ops/test_cat.py | 28 +-- backends/arm/test/ops/test_ceil.py | 24 +-- backends/arm/test/ops/test_clamp.py | 24 +-- backends/arm/test/ops/test_clone.py | 24 +-- backends/arm/test/ops/test_constant_pad_nd.py | 12 +- backends/arm/test/ops/test_conv1d.py | 38 ++-- backends/arm/test/ops/test_conv2d.py | 42 ++--- backends/arm/test/ops/test_conv3d.py | 40 ++--- backends/arm/test/ops/test_conv_combos.py | 136 +++++++------- .../arm/test/ops/test_conv_constant_pad_nd.py | 12 +- backends/arm/test/ops/test_cos.py | 24 +-- backends/arm/test/ops/test_depthwise_conv.py | 56 +++--- backends/arm/test/ops/test_div.py | 24 +-- backends/arm/test/ops/test_embedding.py | 12 +- backends/arm/test/ops/test_eq.py | 34 ++-- backends/arm/test/ops/test_erf.py | 24 +-- backends/arm/test/ops/test_exp.py | 24 +-- backends/arm/test/ops/test_expand.py | 32 ++-- backends/arm/test/ops/test_eye.py | 26 +-- backends/arm/test/ops/test_floor.py | 24 +-- backends/arm/test/ops/test_full.py | 48 ++--- backends/arm/test/ops/test_ge.py | 34 ++-- backends/arm/test/ops/test_gelu.py | 24 +-- backends/arm/test/ops/test_group_norm.py | 24 +-- backends/arm/test/ops/test_gt.py | 34 ++-- backends/arm/test/ops/test_hardsigmoid.py | 24 +-- backends/arm/test/ops/test_hardswish.py | 24 +-- backends/arm/test/ops/test_hardtanh.py | 24 +-- backends/arm/test/ops/test_index_select.py | 16 +- backends/arm/test/ops/test_index_tensor.py | 36 ++-- backends/arm/test/ops/test_layer_norm.py | 24 +-- backends/arm/test/ops/test_le.py | 34 ++-- backends/arm/test/ops/test_leaky_relu.py | 24 +-- .../arm/test/ops/test_linalg_vector_norm.py | 26 +-- backends/arm/test/ops/test_linear.py | 44 ++--- backends/arm/test/ops/test_log.py | 24 +-- backends/arm/test/ops/test_logical.py | 62 +++---- backends/arm/test/ops/test_logsoftmax.py | 24 +-- backends/arm/test/ops/test_lshift.py | 52 +++--- backends/arm/test/ops/test_lt.py | 34 ++-- backends/arm/test/ops/test_masked_fill.py | 20 +-- backends/arm/test/ops/test_matmul.py | 56 +++--- backends/arm/test/ops/test_max_pool.py | 56 +++--- backends/arm/test/ops/test_maximum.py | 24 +-- backends/arm/test/ops/test_mean_dim.py | 40 ++--- backends/arm/test/ops/test_minimum.py | 24 +-- backends/arm/test/ops/test_mm.py | 24 +-- backends/arm/test/ops/test_mul.py | 48 ++--- .../arm/test/ops/test_multihead_attention.py | 24 +-- backends/arm/test/ops/test_ne.py | 34 ++-- backends/arm/test/ops/test_neg.py | 24 +-- backends/arm/test/ops/test_ones.py | 26 +-- backends/arm/test/ops/test_permute.py | 24 +-- backends/arm/test/ops/test_pow.py | 28 +-- backends/arm/test/ops/test_reciprocal.py | 24 +-- backends/arm/test/ops/test_relu.py | 24 +-- backends/arm/test/ops/test_repeat.py | 24 +-- backends/arm/test/ops/test_round.py | 24 +-- backends/arm/test/ops/test_rshift.py | 52 +++--- backends/arm/test/ops/test_rsqrt.py | 24 +-- backends/arm/test/ops/test_scalar_tensor.py | 24 +-- backends/arm/test/ops/test_scalars.py | 168 +++++++++--------- backends/arm/test/ops/test_sdpa.py | 12 +- backends/arm/test/ops/test_select.py | 42 ++--- backends/arm/test/ops/test_sigmoid.py | 56 +++--- backends/arm/test/ops/test_sigmoid_16bit.py | 27 ++- backends/arm/test/ops/test_sigmoid_32bit.py | 27 ++- backends/arm/test/ops/test_sign.py | 24 +-- backends/arm/test/ops/test_silu.py | 54 +++--- backends/arm/test/ops/test_sin.py | 24 +-- backends/arm/test/ops/test_sinh.py | 24 +-- backends/arm/test/ops/test_slice.py | 28 +-- backends/arm/test/ops/test_softmax.py | 24 +-- backends/arm/test/ops/test_split.py | 32 ++-- backends/arm/test/ops/test_sqrt.py | 48 ++--- backends/arm/test/ops/test_squeeze.py | 56 +++--- backends/arm/test/ops/test_sub.py | 48 ++--- backends/arm/test/ops/test_sum.py | 28 +-- backends/arm/test/ops/test_tanh.py | 24 +-- backends/arm/test/ops/test_to_copy.py | 20 +-- backends/arm/test/ops/test_unbind.py | 12 +- backends/arm/test/ops/test_unflatten.py | 12 +- backends/arm/test/ops/test_unsqueeze.py | 24 +-- .../arm/test/ops/test_upsample_bilinear2d.py | 44 ++--- .../arm/test/ops/test_upsample_nearest2d.py | 54 +++--- backends/arm/test/ops/test_var.py | 56 +++--- backends/arm/test/ops/test_view.py | 26 +-- backends/arm/test/ops/test_where.py | 32 ++-- backends/arm/test/ops/test_zeros.py | 26 +-- .../test_convert_expand_copy_to_repeat.py | 2 +- .../passes/test_convert_split_to_slice.py | 2 +- .../arm/test/passes/test_convert_to_clamp.py | 4 +- .../test_decompose_cosine_similarity_pass.py | 2 +- .../test/passes/test_decompose_div_pass.py | 2 +- .../passes/test_decompose_layernorm_pass.py | 2 +- .../test_decompose_linalg_vector_norm_pass.py | 2 +- .../passes/test_decompose_meandim_pass.py | 12 +- .../passes/test_decompose_softmax_pass.py | 4 +- .../test/passes/test_decompose_var_pass.py | 2 +- ...est_decorate_fp32_to_int32_casting_pass.py | 12 +- .../arm/test/passes/test_fold_qdq_pass.py | 2 +- .../test/passes/test_fuse_batchnorm_pass.py | 2 +- .../passes/test_fuse_constant_ops_pass.py | 4 +- .../test_fuse_equal_placeholders_ops_pass.py | 10 +- .../test_insert_int64_to_int32_cast_pass.py | 2 +- .../test/passes/test_insert_table_ops_pass.py | 2 +- .../passes/test_int32_cast_embedding_pass.py | 2 +- .../test/passes/test_ioquantization_pass.py | 6 +- .../arm/test/passes/test_remove_clone_pass.py | 2 +- backends/arm/test/passes/test_rescale_pass.py | 12 +- .../test_unsqueeze_before_repeat_pass.py | 2 +- .../test/quantizer/test_generic_annotater.py | 4 +- backends/arm/test/runner_utils.py | 25 +-- backends/arm/test/tester/arm_tester.py | 3 +- backends/arm/test/tester/test_pipeline.py | 27 +-- 161 files changed, 2079 insertions(+), 2162 deletions(-) diff --git a/backends/arm/scripts/parse_test_names.py b/backends/arm/scripts/parse_test_names.py index e865723722e..b966cc1e8ca 100644 --- a/backends/arm/scripts/parse_test_names.py +++ b/backends/arm/scripts/parse_test_names.py @@ -26,7 +26,7 @@ ALL_EDGE_OPS = SAMPLE_INPUT.keys() | CUSTOM_EDGE_OPS # Add all targets and TOSA profiles we support here. -TARGETS = ["tosa_MI", "tosa_BI", "u55_BI", "u85_BI", "vgf_INT", "vgf_FP"] +TARGETS = ["tosa_FP", "tosa_INT", "u55_INT", "u85_INT", "vgf_INT", "vgf_FP"] def get_op_name_map(): @@ -68,8 +68,8 @@ def parse_test_name( where OP must match a key in op_name_map and TARGET one string in TARGETS. The "not_delegated" suffix indicates that the test tests that the op is not delegated. - Examples of valid names: "test_mm_u55_BI_not_delegated" and - "test_add_scalar_tosa_MI_two_inputs". + Examples of valid names: "test_mm_u55_INT_not_delegated" and + "test_add_scalar_tosa_FP_two_inputs". Returns a tuple (OP, TARGET, IS_DELEGATED) if valid. """ diff --git a/backends/arm/test/common.py b/backends/arm/test/common.py index 8354e36aef2..462098c9b77 100644 --- a/backends/arm/test/common.py +++ b/backends/arm/test/common.py @@ -33,7 +33,7 @@ def get_time_formatted_path(path: str, log_prefix: str) -> str: log_prefix: The name of the test. Example output: - './my_log_folder/test_BI_artifact_28-Nov-14:14:38.log' + './my_log_folder/test_INT_artifact_28-Nov-14:14:38.log' """ return str( Path(path) / f"{log_prefix}_{datetime.now().strftime('%d-%b-%H:%M:%S')}.log" @@ -48,12 +48,12 @@ def maybe_get_tosa_collate_path() -> str | None: tosa_test_base = os.environ.get("TOSA_TESTCASES_BASE_PATH") if tosa_test_base: current_test = os.environ.get("PYTEST_CURRENT_TEST") - # '::test_collate_tosa_BI_tests[randn] (call)' + # '::test_collate_tosa_INT_tests[randn] (call)' test_name = current_test.split("::")[1].split(" ")[0] # type: ignore[union-attr] - if "BI" in test_name: - tosa_test_base = os.path.join(tosa_test_base, "tosa-bi") - elif "MI" in test_name: - tosa_test_base = os.path.join(tosa_test_base, "tosa-mi") + if "INT" in test_name: + tosa_test_base = os.path.join(tosa_test_base, "tosa-int") + elif "FP" in test_name: + tosa_test_base = os.path.join(tosa_test_base, "tosa-fp") else: tosa_test_base = os.path.join(tosa_test_base, "other") return os.path.join(tosa_test_base, test_name) diff --git a/backends/arm/test/conftest.py b/backends/arm/test/conftest.py index 71eb5782967..6fc9e7e5adc 100644 --- a/backends/arm/test/conftest.py +++ b/backends/arm/test/conftest.py @@ -33,17 +33,6 @@ def pytest_configure(config): if config.option.arm_run_tosa_version: pytest._test_options["tosa_version"] = config.option.arm_run_tosa_version - # Not all deployments of ET have the TOSA reference model available. - # Make sure we don't try to use it if it's not available. - try: - if pytest._test_options["tosa_version"] == "0.80": - import tosa_tools.v0_80.tosa_reference_model as tosa_reference_model - else: - import tosa_tools.tosa_ref_model as tosa_reference_model - except ImportError: - pytest._test_options["tosa_ref_model"] = False # type: ignore[attr-defined] - tosa_reference_model = None # noqa - logging.basicConfig(level=logging.INFO, stream=sys.stdout) diff --git a/backends/arm/test/misc/test_bn_relu_folding_qat.py b/backends/arm/test/misc/test_bn_relu_folding_qat.py index bf7bc4227ad..c39c1694d0a 100644 --- a/backends/arm/test/misc/test_bn_relu_folding_qat.py +++ b/backends/arm/test/misc/test_bn_relu_folding_qat.py @@ -12,7 +12,7 @@ TOSAQuantizer, ) from executorch.backends.arm.test import common, conftest -from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineBI +from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineINT from executorch.backends.xnnpack.test.tester.tester import Quantize from torch import nn @@ -46,11 +46,10 @@ def forward(self, x: torch.Tensor): @common.parametrize("model", models) -def test_qat_tosa_BI(model: torch.nn.Module): - pipeline = TosaPipelineBI[input_t1](model, model.test_data, [], [], qtol=1) +def test_qat_tosa_INT(model: torch.nn.Module): + pipeline = TosaPipelineINT[input_t1](model, model.test_data, [], [], qtol=1) tosa_version = conftest.get_option("tosa_version") tosa_profiles = { - "0.80": common.TosaSpecification.create_from_string("TOSA-0.80+BI"), "1.0": common.TosaSpecification.create_from_string("TOSA-1.0+INT"), } tosa_spec = tosa_profiles[tosa_version] diff --git a/backends/arm/test/misc/test_custom_partition.py b/backends/arm/test/misc/test_custom_partition.py index c2889f17ce3..6cdd63af7c9 100644 --- a/backends/arm/test/misc/test_custom_partition.py +++ b/backends/arm/test/misc/test_custom_partition.py @@ -8,7 +8,7 @@ import torch from executorch.backends.arm.test import common -from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineMI +from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineFP from executorch.exir.backend.operator_support import ( DontPartition, DontPartitionModule, @@ -50,7 +50,7 @@ def test_single_reject(caplog, test_data: input_t1): caplog.set_level(logging.INFO) module = CustomPartitioning() - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) check = DontPartition(exir_ops.edge.aten.sigmoid.default) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( @@ -68,7 +68,7 @@ def test_single_reject(caplog, test_data: input_t1): @common.parametrize("test_data", CustomPartitioning.inputs) def test_multiple_reject(test_data: input_t1): module = CustomPartitioning() - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) check = DontPartition( exir_ops.edge.aten.sigmoid.default, exir_ops.edge.aten.mul.Tensor ) @@ -90,7 +90,7 @@ def test_torch_op_reject(caplog, test_data: input_t1): module = CustomPartitioning() check = DontPartition(torch.ops.aten.sigmoid.default) - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", {"torch.ops.higher_order.executorch_call_delegate": 2} @@ -108,7 +108,7 @@ def test_torch_op_reject(caplog, test_data: input_t1): def test_string_op_reject(test_data: input_t1): module = CustomPartitioning() check = DontPartition("aten.sigmoid.default") - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", {"torch.ops.higher_order.executorch_call_delegate": 2} @@ -127,7 +127,7 @@ def test_name_reject(caplog, test_data: input_t1): module = CustomPartitioning() check = DontPartitionName("mul", "sigmoid", exact=False) - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", @@ -142,7 +142,7 @@ def test_name_reject(caplog, test_data: input_t1): def test_module_reject(test_data: input_t1): module = NestedModule() check = DontPartitionModule(module_name="CustomPartitioning") - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", @@ -158,7 +158,7 @@ def test_inexact_module_reject(caplog, test_data: input_t1): module = NestedModule() check = DontPartitionModule(module_name="Custom", exact=False) - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", @@ -173,7 +173,7 @@ def test_inexact_module_reject(caplog, test_data: input_t1): def test_module_instance_reject(test_data: input_t1): module = NestedModule() check = DontPartitionModule(instance_name="nested") - pipeline = TosaPipelineMI[input_t1](module, test_data, [], exir_op=[]) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], exir_op=[]) pipeline.change_args("to_edge_transform_and_lower", additional_checks=[check]) pipeline.change_args( "check_count.exir", diff --git a/backends/arm/test/misc/test_debug_feats.py b/backends/arm/test/misc/test_debug_feats.py index 8da394c9e5d..288d5b41615 100644 --- a/backends/arm/test/misc/test_debug_feats.py +++ b/backends/arm/test/misc/test_debug_feats.py @@ -12,11 +12,11 @@ import pytest import torch -from executorch.backends.arm.test import common, conftest +from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -45,18 +45,18 @@ def forward(self, x): """Tests dumping the partition artifact in ArmTester. Both to file and to stdout.""" -def _tosa_MI_pipeline(module: torch.nn.Module, test_data: input_t1, dump_file=None): +def _tosa_FP_pipeline(module: torch.nn.Module, test_data: input_t1, dump_file=None): - pipeline = TosaPipelineMI[input_t1](module, test_data, [], []) + pipeline = TosaPipelineFP[input_t1](module, test_data, [], []) pipeline.dump_artifact("to_edge_transform_and_lower") pipeline.dump_artifact("to_edge_transform_and_lower", suffix=dump_file) pipeline.pop_stage("run_method_and_compare_outputs") pipeline.run() -def _tosa_BI_pipeline(module: torch.nn.Module, test_data: input_t1, dump_file=None): +def _tosa_INT_pipeline(module: torch.nn.Module, test_data: input_t1, dump_file=None): - pipeline = TosaPipelineBI[input_t1](module, test_data, [], []) + pipeline = TosaPipelineINT[input_t1](module, test_data, [], []) pipeline.dump_artifact("to_edge_transform_and_lower") pipeline.dump_artifact("to_edge_transform_and_lower", suffix=dump_file) pipeline.pop_stage("run_method_and_compare_outputs") @@ -71,12 +71,12 @@ def _is_tosa_marker_in_file(tmp_file): @common.parametrize("test_data", Linear.inputs) -def test_MI_artifact(test_data: input_t1): +def test_FP_artifact(test_data: input_t1): model = Linear() tmp_file = common.get_time_formatted_path( - tempfile.mkdtemp(), test_MI_artifact.__name__ + tempfile.mkdtemp(), test_FP_artifact.__name__ ) - _tosa_MI_pipeline(model, test_data, dump_file=tmp_file) + _tosa_FP_pipeline(model, test_data, dump_file=tmp_file) assert os.path.exists(tmp_file), f"File {tmp_file} was not created" if _is_tosa_marker_in_file(tmp_file): return # Implicit pass test @@ -84,12 +84,12 @@ def test_MI_artifact(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) -def test_BI_artifact(test_data: input_t1): +def test_INT_artifact(test_data: input_t1): model = Linear() tmp_file = common.get_time_formatted_path( - tempfile.mkdtemp(), test_BI_artifact.__name__ + tempfile.mkdtemp(), test_INT_artifact.__name__ ) - _tosa_BI_pipeline(model, test_data, dump_file=tmp_file) + _tosa_INT_pipeline(model, test_data, dump_file=tmp_file) assert os.path.exists(tmp_file), f"File {tmp_file} was not created" if _is_tosa_marker_in_file(tmp_file): return # Implicit pass test @@ -101,7 +101,7 @@ def test_BI_artifact(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) def test_numerical_diff_print(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Linear(), test_data, [], @@ -125,7 +125,7 @@ def test_numerical_diff_print(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) def test_dump_ops_and_dtypes(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Linear(), test_data, [], []) + pipeline = TosaPipelineINT[input_t1](Linear(), test_data, [], []) pipeline.pop_stage("run_method_and_compare_outputs") pipeline.add_stage_after("quantize", pipeline.tester.dump_dtype_distribution) pipeline.add_stage_after("quantize", pipeline.tester.dump_operator_distribution) @@ -143,7 +143,7 @@ def test_dump_ops_and_dtypes(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) def test_dump_ops_and_dtypes_parseable(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Linear(), test_data, [], []) + pipeline = TosaPipelineINT[input_t1](Linear(), test_data, [], []) pipeline.pop_stage("run_method_and_compare_outputs") pipeline.add_stage_after("quantize", pipeline.tester.dump_dtype_distribution, False) pipeline.add_stage_after( @@ -167,24 +167,21 @@ def test_dump_ops_and_dtypes_parseable(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) -def test_collate_tosa_BI_tests(test_data: input_t1): +def test_collate_tosa_INT_tests(test_data: input_t1): # Set the environment variable to trigger the collation of TOSA tests os.environ["TOSA_TESTCASES_BASE_PATH"] = "test_collate_tosa_tests" # Clear out the directory - pipeline = TosaPipelineBI[input_t1](Linear(), test_data, [], []) + pipeline = TosaPipelineINT[input_t1](Linear(), test_data, [], []) pipeline.pop_stage("run_method_and_compare_outputs") pipeline.run() test_collate_dir = ( - "test_collate_tosa_tests/tosa-bi/test_collate_tosa_BI_tests[randn]" + "test_collate_tosa_tests/tosa-int/test_collate_tosa_INT_tests[randn]" ) # test that the output directory is created and contains the expected files assert os.path.exists(test_collate_dir) - tosa_version = conftest.get_option("tosa_version") for file in os.listdir(test_collate_dir): - file_name_prefix = f"TOSA-{tosa_version}+" + ( - "INT" if tosa_version == "1.0" else "BI" - ) + file_name_prefix = "TOSA-1.0+INT" assert file.endswith((f"{file_name_prefix}.json", f"{file_name_prefix}.tosa")) os.environ.pop("TOSA_TESTCASES_BASE_PATH") @@ -193,7 +190,7 @@ def test_collate_tosa_BI_tests(test_data: input_t1): @common.parametrize("test_data", Linear.inputs) def test_dump_tosa_ops(caplog, test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Linear(), test_data, [], []) + pipeline = TosaPipelineINT[input_t1](Linear(), test_data, [], []) pipeline.pop_stage("run_method_and_compare_outputs") pipeline.dump_operator_distribution("to_edge_transform_and_lower") pipeline.run() @@ -211,7 +208,7 @@ def forward(self, x): @common.parametrize("test_data", Add.inputs) def test_fail_dump_tosa_ops(caplog, test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( Add(), test_data, [], [], use_to_edge_transform_and_lower=True, run_on_fvp=False ) pipeline.dump_operator_distribution("to_edge_transform_and_lower") diff --git a/backends/arm/test/misc/test_dim_order_guards.py b/backends/arm/test/misc/test_dim_order_guards.py index 44c9e707324..b291aaa52cf 100644 --- a/backends/arm/test/misc/test_dim_order_guards.py +++ b/backends/arm/test/misc/test_dim_order_guards.py @@ -12,8 +12,8 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -34,9 +34,9 @@ def forward(self, x): @common.parametrize("test_data", Conv2D.inputs) -def test_tosa_MI_pipeline(test_data: input_t1): +def test_tosa_FP_pipeline(test_data: input_t1): module = Conv2D() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, test_data, [], @@ -51,9 +51,9 @@ def test_tosa_MI_pipeline(test_data: input_t1): @common.parametrize("test_data", Conv2D.inputs) -def test_tosa_BI_pipeline(test_data: input_t1): +def test_tosa_INT_pipeline(test_data: input_t1): module = Conv2D() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, test_data, [], diff --git a/backends/arm/test/misc/test_lifted_tensor.py b/backends/arm/test/misc/test_lifted_tensor.py index c17d93765e5..2e45a36d12a 100644 --- a/backends/arm/test/misc/test_lifted_tensor.py +++ b/backends/arm/test/misc/test_lifted_tensor.py @@ -9,8 +9,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) from executorch.backends.test.harness.stages import StageType @@ -60,11 +60,11 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", LiftedTensor.test_data) -def test_partition_lifted_tensor_tosa_MI(test_data: input_t1): +def test_partition_lifted_tensor_tosa_FP(test_data: input_t1): op = test_data[0] data = test_data[1:] module = LiftedTensor(op) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, *data, [], @@ -81,11 +81,11 @@ def test_partition_lifted_tensor_tosa_MI(test_data: input_t1): @common.parametrize("test_data", LiftedTensor.test_data) -def test_partition_lifted_tensor_tosa_BI(test_data: input_t1): +def test_partition_lifted_tensor_tosa_INT(test_data: input_t1): op = test_data[0] data = test_data[1:] module = LiftedTensor(op) - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, *data, [], @@ -102,11 +102,11 @@ def test_partition_lifted_tensor_tosa_BI(test_data: input_t1): @common.parametrize("test_data", LiftedScalarTensor.test_data) -def test_partition_lifted_scalar_tensor_tosa_MI(test_data: input_t1): +def test_partition_lifted_scalar_tensor_tosa_FP(test_data: input_t1): op = test_data[0] data = test_data[1:] module = LiftedScalarTensor(op, data[-1]) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, data[0], [], @@ -117,11 +117,11 @@ def test_partition_lifted_scalar_tensor_tosa_MI(test_data: input_t1): @common.parametrize("test_data", LiftedScalarTensor.test_data) -def test_partition_lifted_scalar_tensor_tosa_BI(test_data: input_t1): +def test_partition_lifted_scalar_tensor_tosa_INT(test_data: input_t1): op = test_data[0] data = test_data[1:] module = LiftedScalarTensor(op, data[-1]) - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, data[0], [], diff --git a/backends/arm/test/misc/test_multiple_delegates.py b/backends/arm/test/misc/test_multiple_delegates.py index 0b0122bf65e..f716bc45385 100644 --- a/backends/arm/test/misc/test_multiple_delegates.py +++ b/backends/arm/test/misc/test_multiple_delegates.py @@ -8,8 +8,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -28,8 +28,8 @@ def forward(self, x: torch.Tensor, y: torch.Tensor): @common.parametrize("test_data", MultipleDelegatesModule.inputs) -def test_tosa_MI_pipeline(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](MultipleDelegatesModule(), test_data, [], []) +def test_tosa_FP_pipeline(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](MultipleDelegatesModule(), test_data, [], []) pipeline.change_args( "check_count.exir", {"torch.ops.higher_order.executorch_call_delegate": 2} ) @@ -37,8 +37,8 @@ def test_tosa_MI_pipeline(test_data: input_t1): @common.parametrize("test_data", MultipleDelegatesModule.inputs) -def test_tosa_BI_pipeline(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_tosa_INT_pipeline(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( MultipleDelegatesModule(), test_data, [], [], qtol=1 ) pipeline.change_args( diff --git a/backends/arm/test/misc/test_multiple_outputs.py b/backends/arm/test/misc/test_multiple_outputs.py index abb6bb1bf30..45398437238 100644 --- a/backends/arm/test/misc/test_multiple_outputs.py +++ b/backends/arm/test/misc/test_multiple_outputs.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -29,14 +29,14 @@ def forward(self, x: torch.Tensor, y: torch.Tensor): @common.parametrize("test_data", MultipleOutputsModule.inputs) -def test_tosa_MI_pipeline(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](MultipleOutputsModule(), test_data, [], []) +def test_tosa_FP_pipeline(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](MultipleOutputsModule(), test_data, [], []) pipeline.run() @common.parametrize("test_data", MultipleOutputsModule.inputs) -def test_tosa_BI_pipeline(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_tosa_INT_pipeline(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( MultipleOutputsModule(), test_data, [], [], qtol=1 ) pipeline.run() @@ -45,7 +45,7 @@ def test_tosa_BI_pipeline(test_data: input_t1): @common.parametrize("test_data", MultipleOutputsModule.inputs) @common.XfailIfNoCorstone300 def test_U55_pipeline(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( MultipleOutputsModule(), test_data, [], [], qtol=1 ) pipeline.run() @@ -54,7 +54,7 @@ def test_U55_pipeline(test_data: input_t1): @common.parametrize("test_data", MultipleOutputsModule.inputs) @common.XfailIfNoCorstone320 def test_U85_pipeline(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( MultipleOutputsModule(), test_data, [], [], qtol=1 ) pipeline.run() diff --git a/backends/arm/test/misc/test_non_persistent_buffers.py b/backends/arm/test/misc/test_non_persistent_buffers.py index 1b9456ae470..c563ba07208 100644 --- a/backends/arm/test/misc/test_non_persistent_buffers.py +++ b/backends/arm/test/misc/test_non_persistent_buffers.py @@ -8,8 +8,8 @@ from executorch.backends.arm.test.common import parametrize from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -32,18 +32,18 @@ def forward(self, x): @parametrize("test_data", test_input) -def test_non_persistent_buffer_MI(test_data: input_t): +def test_non_persistent_buffer_FP(test_data: input_t): """ Test validates Arm backend handling of non-persistent buffers and ensures that there are no asserts or errors when they are used. """ - TosaPipelineMI[input_t](NonPersistentBuffer(), test_data, "").run() + TosaPipelineFP[input_t](NonPersistentBuffer(), test_data, "").run() @parametrize("test_data", test_input) -def test_non_persistent_buffer_BI(test_data: input_t): +def test_non_persistent_buffer_INT(test_data: input_t): """ Test validates Arm backend handling of non-persistent buffers and ensures that there are no asserts or errors when they are used. """ - TosaPipelineBI[input_t](NonPersistentBuffer(), test_data, "").run() + TosaPipelineINT[input_t](NonPersistentBuffer(), test_data, "").run() diff --git a/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py b/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py index 49efbbb4a9c..1aaa2950337 100644 --- a/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py +++ b/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py @@ -14,8 +14,8 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -83,8 +83,8 @@ def forward(self, x: torch.Tensor): # Softplus is decomposed which messes up the quantization. This test tests that CheckProperQuantization does not # partition nodes where quantization is not as expected. @common.parametrize("test_data", test_data) -def test_softplus_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_softplus_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( SoftplusModule(), test_data=test_data, aten_op=softplus_aten_op, @@ -96,8 +96,8 @@ def test_softplus_tosa_MI(test_data: input_t1): @common.parametrize("test_data", test_data) -def test_softplus_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_softplus_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( SoftplusModule(), test_data=test_data, aten_op=softplus_aten_op, @@ -115,16 +115,16 @@ def test_softplus_tosa_BI(test_data: input_t1): # Since GELU will not be quantized by TosaQuantizer, the Dropout's input will not be quantized either. -# If so, the Dropout should not be partitioned by TosaPartitioner for TOSA BI profile. This test tests that the -# partitioner indeed does not partition the Dropout (clone) for TOSA BI. +# If so, the Dropout should not be partitioned by TosaPartitioner for TOSA INT profile. This test tests that the +# partitioner indeed does not partition the Dropout (clone) for TOSA INT. @common.parametrize( "test_data", test_data, {"3d_rand": "MLETORCH-909: Partition test to not rely on unsupported ops"}, strict=False, ) -def test_linear_residaul_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_linear_residaul_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( LinearResidualModule(), test_data=test_data, aten_op=linear_residual_aten_op, @@ -156,8 +156,8 @@ def test_linear_residaul_tosa_MI(test_data: input_t1): {"3d_rand": "MLETORCH-855: Issue with Quantization folding."}, strict=False, ) -def test_linear_residual_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_linear_residual_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( LinearResidualModule(), test_data=test_data, aten_op=linear_residual_aten_op, diff --git a/backends/arm/test/misc/test_tosa_spec.py b/backends/arm/test/misc/test_tosa_spec.py index 19136c514fb..66f7dcf0745 100644 --- a/backends/arm/test/misc/test_tosa_spec.py +++ b/backends/arm/test/misc/test_tosa_spec.py @@ -7,21 +7,12 @@ from executorch.backends.arm.arm_backend import get_tosa_spec -from executorch.backends.arm.tosa_specification import ( - Tosa_0_80, - Tosa_1_00, - TosaSpecification, -) +from executorch.backends.arm.tosa_specification import Tosa_1_00, TosaSpecification from executorch.exir.backend.compile_spec_schema import CompileSpec from parameterized import parameterized # type: ignore[import-untyped] -test_valid_0_80_strings = [ - "TOSA-0.80+BI", - "TOSA-0.80+MI+8k", - "TOSA-0.80+BI+u55", -] -test_valid_1_0_strings = [ +test_valid_strings = [ "TOSA-1.0.0+INT+FP+fft", "TOSA-1.0.0+FP+bf16+fft", "TOSA-1.0.0+INT+int4+cf", @@ -36,34 +27,25 @@ "TOSA-1.0+FP+INT+fft+int4+cf+8k", ] -test_valid_1_0_extensions = { +test_valid_extensions = { "INT": ["int16", "int4", "var", "cf"], "FP": ["bf16", "fp8e4m3", "fp8e5m2", "fft", "var", "cf"], } test_invalid_strings = [ - "TOSA-0.80+bi", - "TOSA-0.80", - "TOSA-0.80+8k", - "TOSA-0.80+BI+MI", - "TOSA-0.80+BI+U55", "TOSA-1.0.0+fft", "TOSA-1.0.0+fp+bf16+fft", "TOSA-1.0.0+INT+INT4+cf", - "TOSA-1.0.0+BI", "TOSA-1.0.0+FP+FP+INT", "TOSA-1.0.0+FP+CF+bf16", "TOSA-1.0.0+BF16+fft+int4+cf+INT", ] test_compile_specs = [ - ([CompileSpec("tosa_spec", "TOSA-0.80+BI".encode())],), - ([CompileSpec("tosa_spec", "TOSA-0.80+BI+u55".encode())],), ([CompileSpec("tosa_spec", "TOSA-1.0.0+INT".encode())],), ] test_compile_specs_no_version = [ - ([CompileSpec("other_key", "TOSA-0.80+BI".encode())],), ([CompileSpec("other_key", "some_value".encode())],), ] @@ -71,14 +53,8 @@ class TestTosaSpecification(unittest.TestCase): """Tests the TOSA specification class""" - @parameterized.expand(test_valid_0_80_strings) # type: ignore[misc] - def test_version_string_0_80(self, version_string: str): - tosa_spec = TosaSpecification.create_from_string(version_string) - assert isinstance(tosa_spec, Tosa_0_80) - assert tosa_spec.profile in ["BI", "MI"] - - @parameterized.expand(test_valid_1_0_strings) # type: ignore[misc] - def test_version_string_1_0(self, version_string: str): + @parameterized.expand(test_valid_strings) # type: ignore[misc] + def test_version_string(self, version_string: str): tosa_spec = TosaSpecification.create_from_string(version_string) assert isinstance(tosa_spec, Tosa_1_00) assert [profile in ["INT", "FP"] for profile in tosa_spec.profiles].count( @@ -86,9 +62,7 @@ def test_version_string_1_0(self, version_string: str): ) > 0 for profile in tosa_spec.profiles: - assert [ - e in test_valid_1_0_extensions[profile] for e in tosa_spec.extensions - ] + assert [e in test_valid_extensions[profile] for e in tosa_spec.extensions] @parameterized.expand(test_invalid_strings) # type: ignore[misc] def test_invalid_version_strings(self, version_string: str): @@ -111,14 +85,8 @@ def test_create_from_invalid_compilespec(self, compile_specs: list[CompileSpec]) assert tosa_spec is None - @parameterized.expand(test_valid_0_80_strings) - def test_correct_string_representation_0_80(self, version_string: str): - tosa_spec = TosaSpecification.create_from_string(version_string) - assert isinstance(tosa_spec, Tosa_0_80) - assert f"{tosa_spec}" == version_string - - @parameterized.expand(test_valid_1_0_strings) - def test_correct_string_representation_1_0(self, version_string: str): + @parameterized.expand(test_valid_strings) + def test_correct_string_representation(self, version_string: str): tosa_spec = TosaSpecification.create_from_string(version_string) assert isinstance(tosa_spec, Tosa_1_00) assert f"{tosa_spec}" == version_string diff --git a/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py b/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py index 72e23d506c5..9561e2132ee 100644 --- a/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py +++ b/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py @@ -83,7 +83,7 @@ def test_CLIPTextModelWithProjection_tosa_MI(self): # MLETORCH-867, MLETORCH-1059 # Failures: "Fatal Python error: Aborted, Dependency cycles, KeyError in CastInt64BuffersToInt32Pass") @unittest.expectedFailure - def test_CLIPTextModelWithProjection_tosa_BI(self): + def test_CLIPTextModelWithProjection_tosa_INT(self): text_encoder_model, text_encoder_model_inputs = self.prepare_model_and_inputs() with torch.no_grad(): ( diff --git a/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py b/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py index fc8ab9b484b..880dc17166d 100644 --- a/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py +++ b/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py @@ -89,7 +89,7 @@ def forward(self, *args, **kwargs): return sd35_transformer2D_model, sd35_transformer2D_model_inputs - def test_SD3Transformer2DModel_tosa_MI(self): + def test_SD3Transformer2DModel_tosa_FP(self): sd35_transformer2D_model, sd35_transformer2D_model_inputs = ( self.prepare_model_and_inputs() ) @@ -106,12 +106,12 @@ def test_SD3Transformer2DModel_tosa_MI(self): .to_executorch() .run_method_and_compare_outputs( inputs=sd35_transformer2D_model_inputs, - rtol=1.0, # TODO: MLETORCH-875: Reduce tolerance of SD3Transformer2DModel with MI and BI + rtol=1.0, # TODO: MLETORCH-875: Reduce tolerance of SD3Transformer2DModel with FP and INT atol=4.0, ) ) - def test_SD3Transformer2DModel_tosa_BI(self): + def test_SD3Transformer2DModel_tosa_INT(self): sd35_transformer2D_model, sd35_transformer2D_model_inputs = ( self.prepare_model_and_inputs() ) @@ -129,7 +129,7 @@ def test_SD3Transformer2DModel_tosa_BI(self): .to_executorch() .run_method_and_compare_outputs( inputs=sd35_transformer2D_model_inputs, - qtol=1.0, # TODO: MLETORCH-875: Reduce tolerance of SD3Transformer2DModel with MI and BI + qtol=1.0, # TODO: MLETORCH-875: Reduce tolerance of SD3Transformer2DModel with FP and INT rtol=1.0, atol=4.0, ) diff --git a/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py b/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py index 565db22492c..aba58379a92 100644 --- a/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py +++ b/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py @@ -86,7 +86,7 @@ def test_T5EncoderModel_tosa_MI(self): ) ) - def test_T5EncoderModel_tosa_BI(self): + def test_T5EncoderModel_tosa_INT(self): t5_encoder_model, t5_encoder_model_inputs = self.prepare_model_and_inputs() with torch.no_grad(): ( diff --git a/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py b/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py index d2c48e2adba..cab4ca53d9c 100644 --- a/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py +++ b/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py @@ -59,7 +59,7 @@ def test_AutoencoderKL_tosa_MI(self): ) ) - def test_AutoencoderKL_tosa_BI(self): + def test_AutoencoderKL_tosa_INT(self): auto_encoder_model, auto_encoder_model_inputs = self.prepare_model_and_inputs() with torch.no_grad(): ( @@ -75,6 +75,6 @@ def test_AutoencoderKL_tosa_BI(self): .to_executorch() .run_method_and_compare_outputs( inputs=auto_encoder_model_inputs, - atol=1.0, # TODO: MLETORCH-990 Reduce tolerance of vae(AutoencoderKL) with BI + atol=1.0, # TODO: MLETORCH-990 Reduce tolerance of vae(AutoencoderKL) with INT ) ) diff --git a/backends/arm/test/models/test_conformer.py b/backends/arm/test/models/test_conformer.py index e6db624f256..e3b9bc21ebf 100644 --- a/backends/arm/test/models/test_conformer.py +++ b/backends/arm/test/models/test_conformer.py @@ -11,10 +11,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torchaudio.models import Conformer @@ -49,8 +49,8 @@ class TestConformer: conformer = conformer.eval() -def test_conformer_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_conformer_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( TestConformer.conformer, TestConformer.model_example_inputs, aten_op=TestConformer.aten_ops, @@ -60,8 +60,8 @@ def test_conformer_tosa_MI(): pipeline.run() -def test_conformer_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_conformer_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( TestConformer.conformer, TestConformer.model_example_inputs, aten_op=TestConformer.aten_ops, @@ -84,8 +84,8 @@ def test_conformer_tosa_BI(): @pytest.mark.xfail( reason="TODO(MLETORCH-635): Expected failure under FVP option, but test passed." ) -def test_conformer_u55_BI(): - pipeline = EthosU55PipelineBI[input_t]( +def test_conformer_u55_INT(): + pipeline = EthosU55PipelineINT[input_t]( TestConformer.conformer, TestConformer.model_example_inputs, aten_ops=TestConformer.aten_ops, @@ -106,8 +106,8 @@ def test_conformer_u55_BI(): @common.XfailIfNoCorstone320 @pytest.mark.xfail(reason="All IO needs to have the same data type (MLETORCH-635)") -def test_conformer_u85_BI(): - pipeline = EthosU85PipelineBI[input_t]( +def test_conformer_u85_INT(): + pipeline = EthosU85PipelineINT[input_t]( TestConformer.conformer, TestConformer.model_example_inputs, aten_ops=TestConformer.aten_ops, diff --git a/backends/arm/test/models/test_deit_tiny_arm.py b/backends/arm/test/models/test_deit_tiny_arm.py index a637db65dfd..4d7f8c925f2 100644 --- a/backends/arm/test/models/test_deit_tiny_arm.py +++ b/backends/arm/test/models/test_deit_tiny_arm.py @@ -12,8 +12,8 @@ import torch from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) from timm.data import IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD @@ -34,8 +34,8 @@ input_t = Tuple[torch.Tensor] -def test_deit_tiny_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_deit_tiny_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( deit_tiny, model_inputs, aten_op=[], @@ -45,8 +45,8 @@ def test_deit_tiny_tosa_MI(): pipeline.run() -def test_deit_tiny_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_deit_tiny_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( deit_tiny, model_inputs, aten_op=[], diff --git a/backends/arm/test/models/test_dl3_arm.py b/backends/arm/test/models/test_dl3_arm.py index 2e7a3117865..433948d15b0 100644 --- a/backends/arm/test/models/test_dl3_arm.py +++ b/backends/arm/test/models/test_dl3_arm.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from executorch.examples.models import deeplab_v3 @@ -31,8 +31,8 @@ class TestDl3: dl3 = dl3.get_eager_model() -def test_dl3_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_dl3_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( TestDl3.dl3, TestDl3.model_example_inputs, aten_op=[], @@ -44,8 +44,8 @@ def test_dl3_tosa_MI(): pipeline.run() -def test_dl3_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_dl3_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( TestDl3.dl3, TestDl3.model_example_inputs, aten_op=[], @@ -59,8 +59,8 @@ def test_dl3_tosa_BI(): @common.XfailIfNoCorstone300 @pytest.mark.skip(reason="upsample_bilinear2d operator is not supported on U55") -def test_dl3_u55_BI(): - pipeline = EthosU55PipelineBI[input_t]( +def test_dl3_u55_INT(): + pipeline = EthosU55PipelineINT[input_t]( TestDl3.dl3, TestDl3.model_example_inputs, aten_ops=[], @@ -75,8 +75,8 @@ def test_dl3_u55_BI(): @common.XfailIfNoCorstone320 @pytest.mark.skip(reason="Runs out of memory on U85") -def test_dl3_u85_BI(): - pipeline = EthosU85PipelineBI[input_t]( +def test_dl3_u85_INT(): + pipeline = EthosU85PipelineINT[input_t]( TestDl3.dl3, TestDl3.model_example_inputs, aten_ops=[], diff --git a/backends/arm/test/models/test_llama.py b/backends/arm/test/models/test_llama.py index 84eec491c1e..ee9750f853c 100644 --- a/backends/arm/test/models/test_llama.py +++ b/backends/arm/test/models/test_llama.py @@ -19,8 +19,8 @@ from executorch.backends.arm.test import conftest from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) from executorch.examples.models.llama.export_llama_lib import ( build_args_parser, @@ -98,14 +98,14 @@ def prepare_model(self): return llama_model, llama_inputs, llama_meta -def test_llama_tosa_MI(): +def test_llama_tosa_FP(): llama_model, llama_inputs, llama_meta = TestLlama().prepare_model() if llama_model is None or llama_inputs is None: pytest.skip("Missing model and/or input files") with torch.no_grad(): - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( llama_model, llama_inputs, aten_op=[], @@ -116,14 +116,14 @@ def test_llama_tosa_MI(): pipeline.run() -def test_llama_tosa_BI(): +def test_llama_tosa_INT(): llama_model, llama_inputs, llama_meta = TestLlama().prepare_model() if llama_model is None or llama_inputs is None: pytest.skip("Missing model and/or input files") with torch.no_grad(): - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( llama_model, llama_inputs, aten_op=[], diff --git a/backends/arm/test/models/test_lstm_arm.py b/backends/arm/test/models/test_lstm_arm.py index 48d2e918ff6..bb9b92a0f7d 100644 --- a/backends/arm/test/models/test_lstm_arm.py +++ b/backends/arm/test/models/test_lstm_arm.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torch.nn.quantizable.modules import rnn @@ -42,8 +42,8 @@ class TestLSTM: model_example_inputs = get_test_inputs() -def test_lstm_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_lstm_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( TestLSTM.lstm, TestLSTM.model_example_inputs, aten_op=[], @@ -54,8 +54,8 @@ def test_lstm_tosa_MI(): pipeline.run() -def test_lstm_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_lstm_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( TestLSTM.lstm, TestLSTM.model_example_inputs, aten_op=[], @@ -69,8 +69,8 @@ def test_lstm_tosa_BI(): @common.XfailIfNoCorstone300 -def test_lstm_u55_BI(): - pipeline = EthosU55PipelineBI[input_t]( +def test_lstm_u55_INT(): + pipeline = EthosU55PipelineINT[input_t]( TestLSTM.lstm, TestLSTM.model_example_inputs, aten_ops=[], @@ -85,8 +85,8 @@ def test_lstm_u55_BI(): @common.XfailIfNoCorstone320 -def test_lstm_u85_BI(): - pipeline = EthosU85PipelineBI[input_t]( +def test_lstm_u85_INT(): + pipeline = EthosU85PipelineINT[input_t]( TestLSTM.lstm, TestLSTM.model_example_inputs, aten_ops=[], diff --git a/backends/arm/test/models/test_mobilenet_v2_arm.py b/backends/arm/test/models/test_mobilenet_v2_arm.py index a1f9bc0633d..090d7f849d3 100644 --- a/backends/arm/test/models/test_mobilenet_v2_arm.py +++ b/backends/arm/test/models/test_mobilenet_v2_arm.py @@ -12,10 +12,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torchvision import models, transforms # type: ignore[import-untyped] @@ -38,16 +38,16 @@ } -def test_mv2_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_mv2_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( mv2, model_inputs, aten_op=[], exir_op=[], use_to_edge_transform_and_lower=True ) pipeline.run() @common.parametrize("per_channel_quantization", quant_test_data) -def test_mv2_tosa_BI(per_channel_quantization): - pipeline = TosaPipelineBI[input_t]( +def test_mv2_tosa_INT(per_channel_quantization): + pipeline = TosaPipelineINT[input_t]( mv2, model_inputs, aten_op=[], @@ -63,8 +63,8 @@ def test_mv2_tosa_BI(per_channel_quantization): @pytest.mark.slow @common.XfailIfNoCorstone300 @common.parametrize("per_channel_quantization", quant_test_data) -def test_mv2_u55_BI(per_channel_quantization): - pipeline = EthosU55PipelineBI[input_t]( +def test_mv2_u55_INT(per_channel_quantization): + pipeline = EthosU55PipelineINT[input_t]( mv2, model_inputs, aten_ops=[], @@ -81,8 +81,8 @@ def test_mv2_u55_BI(per_channel_quantization): @pytest.mark.slow @common.XfailIfNoCorstone320 @common.parametrize("per_channel_quantization", quant_test_data) -def test_mv2_u85_BI(per_channel_quantization): - pipeline = EthosU85PipelineBI[input_t]( +def test_mv2_u85_INT(per_channel_quantization): + pipeline = EthosU85PipelineINT[input_t]( mv2, model_inputs, aten_ops=[], diff --git a/backends/arm/test/models/test_mobilenet_v3_arm.py b/backends/arm/test/models/test_mobilenet_v3_arm.py index f80b94bad2e..c43f20b2884 100644 --- a/backends/arm/test/models/test_mobilenet_v3_arm.py +++ b/backends/arm/test/models/test_mobilenet_v3_arm.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torchvision import models, transforms @@ -31,16 +31,16 @@ @pytest.mark.slow -def test_mv3_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_mv3_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( mv3, model_inputs, aten_op=[], exir_op=[], use_to_edge_transform_and_lower=True ) pipeline.run() @pytest.mark.slow -def test_mv3_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_mv3_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( mv3, model_inputs, aten_op=[], @@ -54,8 +54,8 @@ def test_mv3_tosa_BI(): @pytest.mark.slow @common.XfailIfNoCorstone300 -def test_mv3_u55_BI(): - pipeline = EthosU55PipelineBI[input_t]( +def test_mv3_u55_INT(): + pipeline = EthosU55PipelineINT[input_t]( mv3, model_inputs, aten_ops=[], @@ -70,8 +70,8 @@ def test_mv3_u55_BI(): @pytest.mark.slow @common.XfailIfNoCorstone320 -def test_mv3_u85_BI(): - pipeline = EthosU85PipelineBI[input_t]( +def test_mv3_u85_INT(): + pipeline = EthosU85PipelineINT[input_t]( mv3, model_inputs, aten_ops=[], diff --git a/backends/arm/test/models/test_nn_functional.py b/backends/arm/test/models/test_nn_functional.py index 7c5c98cdcb3..651f9585459 100644 --- a/backends/arm/test/models/test_nn_functional.py +++ b/backends/arm/test/models/test_nn_functional.py @@ -22,8 +22,8 @@ import torch from executorch.backends.arm.test.common import parametrize from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -85,9 +85,9 @@ def forward(self, *args): "affine_grid": "Int64 input. Partition handling fails since arange int64 output is split between 2 partitions.", }, ) -def test_nn_functional_MI(test_data): +def test_nn_functional_FP(test_data): module, inputs = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( module, inputs, "", use_to_edge_transform_and_lower=False ) pipeline.pop_stage("check.aten") @@ -111,9 +111,9 @@ def test_nn_functional_MI(test_data): @parametrize("test_data", module_tests, x_fails, strict=False) -def test_nn_functional_BI(test_data): +def test_nn_functional_INT(test_data): module, inputs = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, inputs, "", use_to_edge_transform_and_lower=True ) pipeline.pop_stage("check.aten") diff --git a/backends/arm/test/models/test_nn_modules.py b/backends/arm/test/models/test_nn_modules.py index 43fe1f4b3f9..0daf035a7f1 100644 --- a/backends/arm/test/models/test_nn_modules.py +++ b/backends/arm/test/models/test_nn_modules.py @@ -20,8 +20,8 @@ import torch from executorch.backends.arm.test.common import parametrize from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) example_input = torch.rand(1, 6, 16, 16) @@ -57,9 +57,9 @@ "test_data", test_parameters, ) -def test_nn_Modules_MI(test_data): +def test_nn_Modules_FP(test_data): module, inputs = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( module, inputs, "", use_to_edge_transform_and_lower=True ) pipeline.pop_stage("check.aten") @@ -83,9 +83,9 @@ def test_nn_Modules_MI(test_data): "Transformer": "AssertionError: Output 0 does not match reference output.", }, ) -def test_nn_Modules_BI(test_data): +def test_nn_Modules_INT(test_data): module, inputs = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, inputs, "", use_to_edge_transform_and_lower=True ) pipeline.pop_stage("check.aten") diff --git a/backends/arm/test/models/test_torch_functions.py b/backends/arm/test/models/test_torch_functions.py index c7fc1654caa..580438f6da8 100644 --- a/backends/arm/test/models/test_torch_functions.py +++ b/backends/arm/test/models/test_torch_functions.py @@ -23,8 +23,8 @@ import torch from executorch.backends.arm.test.common import parametrize from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -104,9 +104,9 @@ def forward(self, *args): "norm": "An error occurred when running the 'KeepDimsFalseToSqueezePass' pass after the following passes:", }, ) -def test_torch_fns_MI(test_data): +def test_torch_fns_FP(test_data): module, inputs = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( module, inputs, "", use_to_edge_transform_and_lower=True ) pipeline.pop_stage("check.aten") @@ -133,9 +133,9 @@ def test_torch_fns_MI(test_data): }, strict=False, ) -def test_torch_fns_BI(test_data): +def test_torch_fns_INT(test_data): module, inputs = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, inputs, "", use_to_edge_transform_and_lower=True ) pipeline.pop_stage("check.aten") diff --git a/backends/arm/test/models/test_w2l_arm.py b/backends/arm/test/models/test_w2l_arm.py index 1a755937482..fa19a3b97e4 100644 --- a/backends/arm/test/models/test_w2l_arm.py +++ b/backends/arm/test/models/test_w2l_arm.py @@ -13,10 +13,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torchaudio import models @@ -46,8 +46,8 @@ class TestW2L(unittest.TestCase): @pytest.mark.slow # about 3min on std laptop -def test_w2l_tosa_MI(): - pipeline = TosaPipelineMI[input_t]( +def test_w2l_tosa_FP(): + pipeline = TosaPipelineFP[input_t]( TestW2L.w2l, TestW2L.model_example_inputs, aten_op=[], @@ -59,8 +59,8 @@ def test_w2l_tosa_MI(): @pytest.mark.slow # about 1min on std laptop @pytest.mark.flaky -def test_w2l_tosa_BI(): - pipeline = TosaPipelineBI[input_t]( +def test_w2l_tosa_INT(): + pipeline = TosaPipelineINT[input_t]( TestW2L.w2l, TestW2L.model_example_inputs, aten_op=[], @@ -76,8 +76,8 @@ def test_w2l_tosa_BI(): reason="MLETORCH-1009: Wav2Letter fails on U55 due to unsupported conditions", strict=False, ) -def test_w2l_u55_BI(): - pipeline = EthosU55PipelineBI[input_t]( +def test_w2l_u55_INT(): + pipeline = EthosU55PipelineINT[input_t]( TestW2L.w2l, TestW2L.model_example_inputs, aten_ops=[], @@ -91,8 +91,8 @@ def test_w2l_u55_BI(): @pytest.mark.slow @common.XfailIfNoCorstone320 @pytest.mark.skip(reason="Intermittent timeout issue: MLETORCH-856") -def test_w2l_u85_BI(): - pipeline = EthosU85PipelineBI[input_t]( +def test_w2l_u85_INT(): + pipeline = EthosU85PipelineINT[input_t]( TestW2L.w2l, TestW2L.model_example_inputs, aten_ops=[], diff --git a/backends/arm/test/ops/test_abs.py b/backends/arm/test/ops/test_abs.py index ed7e616e946..f351253b1b2 100644 --- a/backends/arm/test/ops/test_abs.py +++ b/backends/arm/test/ops/test_abs.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.abs.default" @@ -39,21 +39,21 @@ def forward(self, x): @common.parametrize("test_data", Abs.test_parameters) -def test_abs_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1](Abs(), test_data(), aten_op, exir_op) +def test_abs_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1](Abs(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Abs.test_parameters) -def test_abs_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1](Abs(), test_data(), aten_op, exir_op) +def test_abs_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1](Abs(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Abs.test_parameters) @common.XfailIfNoCorstone300 -def test_abs_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_abs_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Abs(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() @@ -61,8 +61,8 @@ def test_abs_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", Abs.test_parameters) @common.XfailIfNoCorstone320 -def test_abs_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_abs_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Abs(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() diff --git a/backends/arm/test/ops/test_acosh.py b/backends/arm/test/ops/test_acosh.py index 00742105b63..bebf839c340 100644 --- a/backends/arm/test/ops/test_acosh.py +++ b/backends/arm/test/ops/test_acosh.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] # Input x @@ -48,8 +48,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_acosh_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t]( +def test_acosh_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t]( Acosh(), (test_data(),), aten_op, @@ -59,8 +59,8 @@ def test_acosh_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_acosh_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t]( +def test_acosh_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t]( Acosh(), (test_data(),), aten_op=[], @@ -70,8 +70,8 @@ def test_acosh_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_acosh_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t]( +def test_acosh_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t]( Acosh(), (test_data(),), aten_ops=[], @@ -81,8 +81,8 @@ def test_acosh_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite_xfails) @pytest.mark.xfail(reason="Invalid inputs are currently not handled") -def test_acosh_u55_BI_xfail(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t]( +def test_acosh_u55_INT_xfail(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t]( Acosh(), (test_data(),), aten_ops=[], @@ -93,8 +93,8 @@ def test_acosh_u55_BI_xfail(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_acosh_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t]( +def test_acosh_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t]( Acosh(), (test_data(),), aten_ops=[], @@ -104,8 +104,8 @@ def test_acosh_u85_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite_xfails) @pytest.mark.xfail(reason="Invalid inputs are currently not handled") -def test_acosh_u85_BI_xfail(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t]( +def test_acosh_u85_INT_xfail(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t]( Acosh(), (test_data(),), aten_ops=[], diff --git a/backends/arm/test/ops/test_adaptive_avg_pool2d.py b/backends/arm/test/ops/test_adaptive_avg_pool2d.py index 7426ef78dca..2a0562155b7 100644 --- a/backends/arm/test/ops/test_adaptive_avg_pool2d.py +++ b/backends/arm/test/ops/test_adaptive_avg_pool2d.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) exir_op = "executorch_exir_dialects_edge__ops_aten_avg_pool2d_default" @@ -110,10 +110,10 @@ def forward(self, *args, **kwargs): @common.parametrize("test_module", test_modules) -def test_adaptive_avg_pool2d_tosa_MI(test_module): +def test_adaptive_avg_pool2d_tosa_FP(test_module): model, input_tensor = test_module() - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( model, input_tensor, aten_op=[], @@ -123,10 +123,10 @@ def test_adaptive_avg_pool2d_tosa_MI(test_module): @common.parametrize("test_module", test_modules) -def test_adaptive_avg_pool2d_tosa_BI(test_module): +def test_adaptive_avg_pool2d_tosa_INT(test_module): model, input_tensor = test_module() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, input_tensor, aten_op=[], @@ -137,10 +137,10 @@ def test_adaptive_avg_pool2d_tosa_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone300 -def test_adaptive_avg_pool2d_u55_BI(test_module): +def test_adaptive_avg_pool2d_u55_INT(test_module): model, input_tensor = test_module() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, input_tensor, aten_ops=[], @@ -151,10 +151,10 @@ def test_adaptive_avg_pool2d_u55_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone320 -def test_adaptive_avg_pool2d_u85_BI(test_module): +def test_adaptive_avg_pool2d_u85_INT(test_module): model, input_tensor = test_module() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, input_tensor, aten_ops=[], diff --git a/backends/arm/test/ops/test_add.py b/backends/arm/test/ops/test_add.py index 777603f0301..421ec0adc61 100644 --- a/backends/arm/test/ops/test_add.py +++ b/backends/arm/test/ops/test_add.py @@ -12,10 +12,10 @@ from executorch.backends.arm.quantizer import arm_quantizer from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, VgfPipeline, ) from executorch.backends.arm.tosa_specification import TosaSpecification @@ -80,23 +80,22 @@ def forward(self, x: torch.Tensor, y: torch.Tensor): @common.parametrize("test_data", Add.test_data) -def test_add_tensor_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](Add(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](Add(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add.test_data) -def test_add_tensor_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Add(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1](Add(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add.test_data) -def test_add_tensor_tosa_BI_i32(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Add(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_INT_i32(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1](Add(), test_data(), aten_op, exir_op) tosa_version = conftest.get_option("tosa_version") tosa_profiles = { - "0.80": TosaSpecification.create_from_string("TOSA-0.80+BI"), "1.0": TosaSpecification.create_from_string("TOSA-1.0+INT"), } # Create a quantizer with int8 quantization on the input and output but int32 on everything else. @@ -129,8 +128,8 @@ def test_add_tensor_tosa_BI_i32(test_data: input_t1): @common.parametrize("test_data", Add.test_data) @common.XfailIfNoCorstone300 -def test_add_tensor_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_add_tensor_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( Add(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() @@ -138,41 +137,41 @@ def test_add_tensor_u55_BI(test_data: input_t1): @common.parametrize("test_data", Add.test_data) @common.XfailIfNoCorstone320 -def test_add_tensor_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_add_tensor_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( Add(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() @common.parametrize("test_data", Add2.test_data) -def test_add_tensor_tosa_MI_2(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2](Add2(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_FP_2(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2](Add2(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add3.test_data) -def test_add_tensor_tosa_MI_3(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2](Add3(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_FP_3(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2](Add3(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add3.test_data) -def test_add_tensor_tosa_BI_3(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2](Add3(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_INT_3(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2](Add3(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add2.test_data) -def test_add_tensor_tosa_BI_2(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2](Add2(), test_data(), aten_op, exir_op) +def test_add_tensor_tosa_INT_2(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2](Add2(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Add2.test_data) @common.XfailIfNoCorstone300 -def test_add_tensor_u55_BI_2(test_data: input_t2): - pipeline = EthosU55PipelineBI[input_t2]( +def test_add_tensor_u55_INT_2(test_data: input_t2): + pipeline = EthosU55PipelineINT[input_t2]( Add2(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() @@ -180,8 +179,8 @@ def test_add_tensor_u55_BI_2(test_data: input_t2): @common.parametrize("test_data", Add2.test_data) @common.XfailIfNoCorstone320 -def test_add_tensor_u85_BI_2(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_add_tensor_u85_INT_2(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Add2(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() diff --git a/backends/arm/test/ops/test_addmm.py b/backends/arm/test/ops/test_addmm.py index 7da5596ab00..c92ba190439 100644 --- a/backends/arm/test/ops/test_addmm.py +++ b/backends/arm/test/ops/test_addmm.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.addmm.default" @@ -112,8 +112,8 @@ def forward( @common.parametrize("test_data", test_data_suite) -def test_addmm_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_addmm_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Addmm(), (*test_data,), aten_op=aten_op, @@ -123,8 +123,8 @@ def test_addmm_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_addmm_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_addmm_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Addmm(), (*test_data,), aten_op=[], @@ -135,8 +135,8 @@ def test_addmm_tosa_BI(test_data: Tuple): @common.XfailIfNoCorstone300 @common.parametrize("test_data", test_data_suite) -def test_addmm_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_addmm_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Addmm(), (*test_data,), aten_ops=[], @@ -147,8 +147,8 @@ def test_addmm_u55_BI(test_data: Tuple): @common.XfailIfNoCorstone320 @common.parametrize("test_data", test_data_suite) -def test_addmm_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_addmm_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Addmm(), (*test_data,), aten_ops=[], diff --git a/backends/arm/test/ops/test_alias_copy.py b/backends/arm/test/ops/test_alias_copy.py index 74e62275577..401f9df0dac 100644 --- a/backends/arm/test/ops/test_alias_copy.py +++ b/backends/arm/test/ops/test_alias_copy.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -44,8 +44,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", AliasCopy.test_data) -def test_alias_tosa_MI(test_data: input_t1): - TosaPipelineMI[input_t1]( +def test_alias_tosa_FP(test_data: input_t1): + TosaPipelineFP[input_t1]( AliasCopy(), test_data(), AliasCopy.aten_op, @@ -54,8 +54,8 @@ def test_alias_tosa_MI(test_data: input_t1): @common.parametrize("test_data", AliasCopy.test_data) -def test_alias_tosa_BI(test_data: input_t1): - TosaPipelineBI[input_t1]( +def test_alias_tosa_INT(test_data: input_t1): + TosaPipelineINT[input_t1]( AliasCopy(), test_data(), AliasCopy.aten_op, @@ -65,8 +65,8 @@ def test_alias_tosa_BI(test_data: input_t1): @common.parametrize("test_data", AliasCopy.test_data) @common.XfailIfNoCorstone300 -def test_alias_u55_BI(test_data: input_t1): - EthosU55PipelineBI[input_t1]( +def test_alias_u55_INT(test_data: input_t1): + EthosU55PipelineINT[input_t1]( AliasCopy(), test_data(), AliasCopy.aten_op, @@ -76,8 +76,8 @@ def test_alias_u55_BI(test_data: input_t1): @common.parametrize("test_data", AliasCopy.test_data) @common.XfailIfNoCorstone320 -def test_alias_u85_BI(test_data: input_t1): - EthosU85PipelineBI[input_t1]( +def test_alias_u85_INT(test_data: input_t1): + EthosU85PipelineINT[input_t1]( AliasCopy(), test_data(), AliasCopy.aten_op, diff --git a/backends/arm/test/ops/test_amax.py b/backends/arm/test/ops/test_amax.py index bde9174de0f..e8ed3007b80 100644 --- a/backends/arm/test/ops/test_amax.py +++ b/backends/arm/test/ops/test_amax.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -69,20 +69,20 @@ def forward(self, x): @common.parametrize("test_data", Amax.test_data) -def test_amax_tosa_MI(test_data: Amax.input_t): +def test_amax_tosa_FP(test_data: Amax.input_t): data, dim, keep_dims = test_data() - pipeline = TosaPipelineMI[Amax.input_t](Amax(dim, keep_dims), data, Amax.aten_op) + pipeline = TosaPipelineFP[Amax.input_t](Amax(dim, keep_dims), data, Amax.aten_op) pipeline.run() @common.parametrize("test_data", Amax.test_data) -def test_amax_tosa_BI(test_data: Amax.input_t): +def test_amax_tosa_INT(test_data: Amax.input_t): data, dim, keep_dims = test_data() - pipeline = TosaPipelineBI[Amax.input_t](Amax(dim, keep_dims), data, Amax.aten_op) + pipeline = TosaPipelineINT[Amax.input_t](Amax(dim, keep_dims), data, Amax.aten_op) pipeline.run() -def test_amax_u55_BI_not_delegated(): +def test_amax_u55_INT_not_delegated(): data, dim, keep_dims = Amax.test_data["rank_4_all_dim"]() pipeline = OpNotSupportedPipeline[Amax.input_t]( Amax(dim, keep_dims), @@ -99,9 +99,9 @@ def test_amax_u55_BI_not_delegated(): @common.parametrize("test_data", Amax.test_data, fvp_xfails, strict=False) @common.XfailIfNoCorstone320 -def test_amax_u85_BI(test_data: Amax.input_t): +def test_amax_u85_INT(test_data: Amax.input_t): data, dim, keep_dims = test_data() - pipeline = EthosU85PipelineBI[Amax.input_t]( + pipeline = EthosU85PipelineINT[Amax.input_t]( Amax(dim, keep_dims), data, Amax.aten_op, @@ -111,22 +111,22 @@ def test_amax_u85_BI(test_data: Amax.input_t): @common.parametrize("test_data", Max.test_data) -def test_max_dim_tosa_MI_to_amax(test_data: Max.input_t): +def test_max_dim_tosa_FP_to_amax(test_data: Max.input_t): data, dim = test_data() - pipeline = TosaPipelineMI[Max.input_t](Max(dim), data, "torch.ops.aten.max") + pipeline = TosaPipelineFP[Max.input_t](Max(dim), data, "torch.ops.aten.max") pipeline.run() @common.parametrize("test_data", Max.test_data) -def test_max_dim_tosa_BI_to_amax(test_data: Max.input_t): +def test_max_dim_tosa_INT_to_amax(test_data: Max.input_t): data, dim = test_data() module = Max(dim) - pipeline = TosaPipelineBI[Max.input_t](module, data, "torch.ops.aten.amax") + pipeline = TosaPipelineINT[Max.input_t](module, data, "torch.ops.aten.amax") pipeline.run() @pytest.mark.xfail(reason="MLETORCH-718 : Quantization of indices in arm_quantizer") -def test_max_dim_tosa_BI_not_delegated(): +def test_max_dim_tosa_INT_not_delegated(): data, dim = Max.test_data()["rank_4_dim_3"]() pipeline = OpNotSupportedPipeline[Max.input_t]( MaxWithIndex(dim), data, {}, quantize=True @@ -134,7 +134,7 @@ def test_max_dim_tosa_BI_not_delegated(): pipeline.run() -def test_max_dim_tosa_MI_not_delegated(): +def test_max_dim_tosa_FP_not_delegated(): data, dim = Max.test_data["rank_4_dim_3"]() pipeline = OpNotSupportedPipeline[Max.input_t](MaxWithIndex(dim), data, {}) pipeline.run() diff --git a/backends/arm/test/ops/test_amin.py b/backends/arm/test/ops/test_amin.py index 89c4b71e5af..b508259093d 100644 --- a/backends/arm/test/ops/test_amin.py +++ b/backends/arm/test/ops/test_amin.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -70,9 +70,9 @@ def forward(self, x): @common.parametrize("test_data", Amin.test_data) -def test_amin_tosa_MI(test_data: Amin.input_t): +def test_amin_tosa_FP(test_data: Amin.input_t): data, dim, keep_dims = test_data() - pipeline = TosaPipelineMI[Amin.input_t]( + pipeline = TosaPipelineFP[Amin.input_t]( Amin(dim, keep_dims), data, Amin.aten_op, @@ -81,9 +81,9 @@ def test_amin_tosa_MI(test_data: Amin.input_t): @common.parametrize("test_data", Amin.test_data) -def test_amin_tosa_BI(test_data: Amin.input_t): +def test_amin_tosa_INT(test_data: Amin.input_t): data, dim, keep_dims = test_data() - pipeline = TosaPipelineBI[Amin.input_t]( + pipeline = TosaPipelineINT[Amin.input_t]( Amin(dim, keep_dims), data, Amin.aten_op, @@ -91,7 +91,7 @@ def test_amin_tosa_BI(test_data: Amin.input_t): pipeline.run() -def test_amin_u55_BI_not_delegated(): +def test_amin_u55_INT_not_delegated(): data, dim, keep_dims = Amin.test_data["rank_4_all_dim"]() pipeline = OpNotSupportedPipeline[Amin.input_t]( Amin(dim, keep_dims), @@ -108,9 +108,9 @@ def test_amin_u55_BI_not_delegated(): @common.parametrize("test_data", Amin.test_data, fvp_xfails, strict=False) @common.XfailIfNoCorstone320 -def test_amin_u85_BI(test_data: Amin.input_t): +def test_amin_u85_INT(test_data: Amin.input_t): data, dim, keep_dims = test_data() - pipeline = EthosU85PipelineBI[Amin.input_t]( + pipeline = EthosU85PipelineINT[Amin.input_t]( Amin(dim, keep_dims), data, Amin.aten_op, @@ -120,22 +120,22 @@ def test_amin_u85_BI(test_data: Amin.input_t): @common.parametrize("test_data", Min.test_data) -def test_min_dim_tosa_MI_to_amin(test_data: Min.input_t): +def test_min_dim_tosa_FP_to_amin(test_data: Min.input_t): data, dim = test_data() - pipeline = TosaPipelineMI[Min.input_t](Min(dim), data, "torch.ops.aten.min") + pipeline = TosaPipelineFP[Min.input_t](Min(dim), data, "torch.ops.aten.min") pipeline.run() @common.parametrize("test_data", Min.test_data) -def test_min_dim_tosa_BI_to_amin(test_data: Min.input_t): +def test_min_dim_tosa_INT_to_amin(test_data: Min.input_t): data, dim = test_data() module = Min(dim) - pipeline = TosaPipelineBI[Min.input_t](module, data, "torch.ops.aten.amin") + pipeline = TosaPipelineINT[Min.input_t](module, data, "torch.ops.aten.amin") pipeline.run() @pytest.mark.xfail(reason="MLETORCH-718 : Quantization of indices in arm_quantizer") -def test_min_dim_tosa_BI_not_delegated(): +def test_min_dim_tosa_INT_not_delegated(): data, dim = Min.test_data["rank_4_dim_3"]() pipeline = OpNotSupportedPipeline[Min.input_t]( MinWithIndex(dim), @@ -146,7 +146,7 @@ def test_min_dim_tosa_BI_not_delegated(): pipeline.run() -def test_min_dim_tosa_MI_not_delegated(): +def test_min_dim_tosa_FP_not_delegated(): data, dim = Min.test_data["rank_4_dim_3"]() pipeline = OpNotSupportedPipeline[Min.input_t](MinWithIndex(dim), data, {}) pipeline.run() diff --git a/backends/arm/test/ops/test_any.py b/backends/arm/test/ops/test_any.py index 338c5f05cc6..5805eb9c671 100644 --- a/backends/arm/test/ops/test_any.py +++ b/backends/arm/test/ops/test_any.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -122,9 +122,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data) -def test_any_tosa_MI(test_data: input_t1): +def test_any_tosa_FP(test_data: input_t1): op, test_input = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( op, test_input(), op.aten_op, @@ -137,9 +137,9 @@ def test_any_tosa_MI(test_data: input_t1): @common.parametrize("test_data", test_data) -def test_any_tosa_BI(test_data: input_t1): +def test_any_tosa_INT(test_data: input_t1): op, test_input = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( op, test_input(), op.aten_op, @@ -154,7 +154,7 @@ def test_any_tosa_BI(test_data: input_t1): @common.parametrize("test_data", test_data) -def test_any_u55_BI(test_data: input_t1): +def test_any_u55_INT(test_data: input_t1): # Tests that we don't delegate these ops since they are not supported on U55. op, test_input = test_data() pipeline = OpNotSupportedPipeline[input_t1]( @@ -169,9 +169,9 @@ def test_any_u55_BI(test_data: input_t1): @common.parametrize("test_data", test_data) @common.XfailIfNoCorstone320 -def test_any_u85_BI(test_data: input_t1): +def test_any_u85_INT(test_data: input_t1): op, test_input = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( op, test_input(), op.aten_op, diff --git a/backends/arm/test/ops/test_arange.py b/backends/arm/test/ops/test_arange.py index dc2a6cefa12..4cc6a1a119b 100644 --- a/backends/arm/test/ops/test_arange.py +++ b/backends/arm/test/ops/test_arange.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -53,9 +53,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", ArangeAdd.test_data) -def test_arange_start_step_tosa_MI(test_data: test_data_t): +def test_arange_start_step_tosa_FP(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( ArangeAdd(*init_data), input_data(), ArangeAdd.aten_op, @@ -65,9 +65,9 @@ def test_arange_start_step_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", ArangeAdd.test_data_dtypes) -def test_arange_start_step_tosa_MI_dtypes(test_data: test_data_t): +def test_arange_start_step_tosa_FP_dtypes(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( ArangeAdd(*init_data), input_data(), ArangeAdd.aten_op, @@ -77,9 +77,9 @@ def test_arange_start_step_tosa_MI_dtypes(test_data: test_data_t): @common.parametrize("test_data", ArangeAdd.test_data) -def test_arange_start_step_tosa_BI(test_data: test_data_t): +def test_arange_start_step_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( ArangeAdd(*init_data), input_data(), ArangeAdd.aten_op, @@ -91,9 +91,9 @@ def test_arange_start_step_tosa_BI(test_data: test_data_t): @common.parametrize("test_data", ArangeAdd.test_data) @common.XfailIfNoCorstone300 -def test_arange_start_step_u55_BI(test_data: test_data_t): +def test_arange_start_step_u55_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( ArangeAdd(*init_data), input_data(), ArangeAdd.aten_op, @@ -104,9 +104,9 @@ def test_arange_start_step_u55_BI(test_data: test_data_t): @common.parametrize("test_data", ArangeAdd.test_data) @common.XfailIfNoCorstone320 -def test_arange_start_step_u85_BI(test_data: test_data_t): +def test_arange_start_step_u85_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( ArangeAdd(*init_data), input_data(), ArangeAdd.aten_op, @@ -134,9 +134,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", LinspaceAdd.test_data) -def test_linspace_tosa_MI(test_data): +def test_linspace_tosa_FP(test_data): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( LinspaceAdd(*init_data), input_data(), LinspaceAdd.aten_op, @@ -146,9 +146,9 @@ def test_linspace_tosa_MI(test_data): @common.parametrize("test_data", LinspaceAdd.test_data) -def test_linspace_tosa_BI(test_data: test_data_t): +def test_linspace_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( LinspaceAdd(*init_data), input_data(), LinspaceAdd.aten_op, @@ -162,20 +162,20 @@ def test_linspace_tosa_BI(test_data: test_data_t): @pytest.mark.skip(reason=skip_str) -def test_arange_tosa_MI(): +def test_arange_tosa_FP(): pass @pytest.mark.skip(reason=skip_str) -def test_arange_tosa_BI(): +def test_arange_tosa_INT(): pass @pytest.mark.skip(reason=skip_str) -def test_arange_u55_BI(): +def test_arange_u55_INT(): pass @pytest.mark.skip(reason=skip_str) -def test_arange_u85_BI(): +def test_arange_u85_INT(): pass diff --git a/backends/arm/test/ops/test_asin.py b/backends/arm/test/ops/test_asin.py index ccb1b3bfc30..81cd9288e32 100644 --- a/backends/arm/test/ops/test_asin.py +++ b/backends/arm/test/ops/test_asin.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] # Input x @@ -37,8 +37,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_asin_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t]( +def test_asin_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t]( Asin(), (test_data(),), aten_op, @@ -48,8 +48,8 @@ def test_asin_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_asin_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t]( +def test_asin_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t]( Asin(), (test_data(),), aten_op=[], @@ -60,8 +60,8 @@ def test_asin_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_asin_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t]( +def test_asin_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t]( Asin(), (test_data(),), aten_ops=[], @@ -71,8 +71,8 @@ def test_asin_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_asin_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t]( +def test_asin_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t]( Asin(), (test_data(),), aten_ops=[], diff --git a/backends/arm/test/ops/test_at.py b/backends/arm/test/ops/test_at.py index 3d2f5ef7cf2..966b68cc91c 100644 --- a/backends/arm/test/ops/test_at.py +++ b/backends/arm/test/ops/test_at.py @@ -8,8 +8,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op_mm = "torch.ops.aten.matmul.default" @@ -78,56 +78,56 @@ def forward(self, x1: torch.Tensor, x2: torch.Tensor, x3: torch.Tensor): @common.parametrize("test_data", AtMatMulSingleInput.test_data_generators) -def test_atmatmul_single_input_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_atmatmul_single_input_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( AtMatMulSingleInput(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulDoubleInput.test_data_generators) -def test_atmatmul_double_input_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_atmatmul_double_input_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( AtMatMulDoubleInput(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulMixedPattern1.test_data_generators) -def test_atmatmul_mixed_pattern1_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_atmatmul_mixed_pattern1_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( AtMatMulMixedPattern1(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulMixedPattern2.test_data_generators) -def test_atmatmul_mixed_pattern2_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_atmatmul_mixed_pattern2_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( AtMatMulMixedPattern2(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulSingleInput.test_data_generators) -def test_atmatmul_single_input_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_atmatmul_single_input_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( AtMatMulSingleInput(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulDoubleInput.test_data_generators) -def test_atmatmul_double_input_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_atmatmul_double_input_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( AtMatMulDoubleInput(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", AtMatMulMixedPattern1.test_data_generators) -def test_atmatmul_mixed_pattern1_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_atmatmul_mixed_pattern1_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( AtMatMulMixedPattern1(), test_data(), aten_op_mm, @@ -138,8 +138,8 @@ def test_atmatmul_mixed_pattern1_tosa_BI(test_data: input_t1): @common.parametrize("test_data", AtMatMulMixedPattern2.test_data_generators) -def test_atmatmul_mixed_pattern2_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_atmatmul_mixed_pattern2_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( AtMatMulMixedPattern2(), test_data(), aten_op_mm, diff --git a/backends/arm/test/ops/test_atan.py b/backends/arm/test/ops/test_atan.py index 3d6f8cd8fa8..d20fc4fa370 100644 --- a/backends/arm/test/ops/test_atan.py +++ b/backends/arm/test/ops/test_atan.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.atan.default" @@ -39,8 +39,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_atan_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_atan_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Atan(), (test_data,), aten_op=aten_op, @@ -50,8 +50,8 @@ def test_atan_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_atan_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_atan_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Atan(), (test_data,), aten_op=aten_op, @@ -62,8 +62,8 @@ def test_atan_tosa_BI(test_data: Tuple): @common.XfailIfNoCorstone300 @common.parametrize("test_data", test_data_suite) -def test_atan_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_atan_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Atan(), (test_data,), aten_ops=aten_op, @@ -74,8 +74,8 @@ def test_atan_u55_BI(test_data: Tuple): @common.XfailIfNoCorstone320 @common.parametrize("test_data", test_data_suite) -def test_atan_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_atan_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Atan(), (test_data,), aten_ops=aten_op, diff --git a/backends/arm/test/ops/test_atanh.py b/backends/arm/test/ops/test_atanh.py index 446e6ee311a..577b1e6134d 100644 --- a/backends/arm/test/ops/test_atanh.py +++ b/backends/arm/test/ops/test_atanh.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.atanh.default" @@ -40,8 +40,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_atanh_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_atanh_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Atanh(), (test_data,), aten_op=aten_op, @@ -51,8 +51,8 @@ def test_atanh_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_atanh_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_atanh_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Atanh(), (test_data,), aten_op=aten_op, @@ -63,8 +63,8 @@ def test_atanh_tosa_BI(test_data: Tuple): @common.XfailIfNoCorstone300 @common.parametrize("test_data", test_data_suite) -def test_atanh_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_atanh_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Atanh(), (test_data,), aten_ops=aten_op, @@ -75,8 +75,8 @@ def test_atanh_u55_BI(test_data: Tuple): @common.XfailIfNoCorstone320 @common.parametrize("test_data", test_data_suite) -def test_atanh_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_atanh_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Atanh(), (test_data,), aten_ops=aten_op, diff --git a/backends/arm/test/ops/test_avg_pool2d.py b/backends/arm/test/ops/test_avg_pool2d.py index d1bce608156..f838a781148 100644 --- a/backends/arm/test/ops/test_avg_pool2d.py +++ b/backends/arm/test/ops/test_avg_pool2d.py @@ -15,11 +15,11 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.avg_pool2d.default" @@ -113,10 +113,10 @@ def forward(self, *args, **kwargs): @common.parametrize("test_module", test_modules) -def test_avg_pool2d_tosa_MI(test_module): +def test_avg_pool2d_tosa_FP(test_module): model, input_tensor = test_module() - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( model, input_tensor, aten_op, @@ -127,10 +127,10 @@ def test_avg_pool2d_tosa_MI(test_module): @common.parametrize("test_module", test_modules) -def test_avg_pool2d_tosa_BI(test_module): +def test_avg_pool2d_tosa_INT(test_module): model, input_tensor = test_module() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, input_tensor, aten_op, @@ -142,10 +142,10 @@ def test_avg_pool2d_tosa_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone300 -def test_avg_pool2d_u55_BI(test_module): +def test_avg_pool2d_u55_INT(test_module): model, input_tensor = test_module() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, input_tensor, aten_op, @@ -157,10 +157,10 @@ def test_avg_pool2d_u55_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone320 -def test_avg_pool2d_u85_BI(test_module): +def test_avg_pool2d_u85_INT(test_module): model, input_tensor = test_module() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, input_tensor, aten_op, @@ -192,7 +192,7 @@ def test_avg_pool2d_u85_BI(test_module): @common.parametrize("reject_module", reject_modules) -def test_avg_pool2d_u55_BI_not_delegated(reject_module): +def test_avg_pool2d_u55_INT_not_delegated(reject_module): model, test_data = reject_module() diff --git a/backends/arm/test/ops/test_batch_norm.py b/backends/arm/test/ops/test_batch_norm.py index eb0d4306e6e..63bc4e1b159 100644 --- a/backends/arm/test/ops/test_batch_norm.py +++ b/backends/arm/test/ops/test_batch_norm.py @@ -13,11 +13,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -76,9 +76,9 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_native_batch_norm_legit_no_training_tosa_MI(test_data: Tuple): +def test_native_batch_norm_legit_no_training_tosa_FP(test_data: Tuple): test_data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( BatchNorm2d(*model_params), (test_data,), aten_op=BatchNorm2d.aten_op, @@ -87,7 +87,7 @@ def test_native_batch_norm_legit_no_training_tosa_MI(test_data: Tuple): # TODO(MLETORCH-100: Quantized stand-alone batch norms) -def test_native_batch_norm_legit_no_training_tosa_BI_not_delegated(): +def test_native_batch_norm_legit_no_training_tosa_INT_not_delegated(): test_data, model_params = test_data_suite["rand_1_3_254_254"]() OpNotSupportedPipeline[input_t1]( BatchNorm2d(*model_params), @@ -100,7 +100,7 @@ def test_native_batch_norm_legit_no_training_tosa_BI_not_delegated(): # TODO(MLETORCH-100: Quantized stand-alone batch norms) -def test_native_batch_norm_legit_no_training_u55_BI_not_delegated(): +def test_native_batch_norm_legit_no_training_u55_INT_not_delegated(): test_data, model_params = test_data_suite["rand_1_3_254_254"]() OpNotSupportedPipeline[input_t1]( BatchNorm2d(*model_params), @@ -114,7 +114,7 @@ def test_native_batch_norm_legit_no_training_u55_BI_not_delegated(): # TODO(MLETORCH-100: Quantized stand-alone batch norms) -def test_native_batch_norm_legit_no_training_u85_BI_not_delegated(): +def test_native_batch_norm_legit_no_training_u85_INT_not_delegated(): test_data, model_params = test_data_suite["rand_1_3_254_254"]() OpNotSupportedPipeline[input_t1]( BatchNorm2d(*model_params), @@ -169,9 +169,9 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_native_batch_norm_legit_no_training_tosa_MI_conv(test_data: Tuple): +def test_native_batch_norm_legit_no_training_tosa_FP_conv(test_data: Tuple): test_data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( BatchNorm2dConv(*model_params), (test_data,), aten_op=BatchNorm2dConv.aten_ops, @@ -180,9 +180,9 @@ def test_native_batch_norm_legit_no_training_tosa_MI_conv(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_native_batch_norm_legit_no_training_tosa_BI_conv(test_data: Tuple): +def test_native_batch_norm_legit_no_training_tosa_INT_conv(test_data: Tuple): test_data, model_params = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( BatchNorm2dConv(*model_params), (test_data,), aten_op=BatchNorm2dConv.aten_ops[0], # Bn is removed before check @@ -193,9 +193,9 @@ def test_native_batch_norm_legit_no_training_tosa_BI_conv(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_native_batch_norm_legit_no_training_u55_BI_conv(test_data: Tuple): +def test_native_batch_norm_legit_no_training_u55_INT_conv(test_data: Tuple): test_data, model_params = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( BatchNorm2dConv(*model_params), (test_data,), aten_ops=BatchNorm2dConv.aten_ops[0], # Bn is removed before check @@ -207,9 +207,9 @@ def test_native_batch_norm_legit_no_training_u55_BI_conv(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_native_batch_norm_legit_no_training_u85_BI_conv(test_data: Tuple): +def test_native_batch_norm_legit_no_training_u85_INT_conv(test_data: Tuple): test_data, model_params = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( BatchNorm2dConv(*model_params), (test_data,), aten_ops=BatchNorm2dConv.aten_ops[0], # Bn is removed before check @@ -253,9 +253,9 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_native_batch_norm_legit_no_stats_tosa_MI(test_data: Tuple): +def test_native_batch_norm_legit_no_stats_tosa_FP(test_data: Tuple): test_data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( BatchNorm2dNoStats(*model_params), (test_data,), aten_op=BatchNorm2dNoStats.aten_ops, @@ -266,9 +266,9 @@ def test_native_batch_norm_legit_no_stats_tosa_MI(test_data: Tuple): @pytest.mark.skip( reason="MLETORCH-999: Add support for _native_batch_norm_legit.no_stats." ) -def test_native_batch_norm_legit_no_stats_tosa_BI(test_data: Tuple): +def test_native_batch_norm_legit_no_stats_tosa_INT(test_data: Tuple): test_data, model_params = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( BatchNorm2dNoStats(*model_params), (test_data,), aten_op=BatchNorm2dNoStats.aten_ops, @@ -282,9 +282,9 @@ def test_native_batch_norm_legit_no_stats_tosa_BI(test_data: Tuple): ) @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_native_batch_norm_legit_no_stats_u55_BI(test_data: Tuple): +def test_native_batch_norm_legit_no_stats_u55_INT(test_data: Tuple): test_data, model_params = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( BatchNorm2dNoStats(*model_params), (test_data,), aten_op=BatchNorm2dNoStats.aten_ops, @@ -299,9 +299,9 @@ def test_native_batch_norm_legit_no_stats_u55_BI(test_data: Tuple): ) @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_native_batch_norm_legit_no_stats_u85_BI(test_data: Tuple): +def test_native_batch_norm_legit_no_stats_u85_INT(test_data: Tuple): test_data, model_params = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( BatchNorm2dNoStats(*model_params), (test_data,), aten_op=BatchNorm2dNoStats.aten_ops, diff --git a/backends/arm/test/ops/test_bitwise.py b/backends/arm/test/ops/test_bitwise.py index d29ea7c91f2..4e7dd26f04e 100644 --- a/backends/arm/test/ops/test_bitwise.py +++ b/backends/arm/test/ops/test_bitwise.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -132,8 +132,8 @@ def forward(self, tensor: torch.Tensor, scalar: int): @common.parametrize("test_data", And().test_data) -def test_bitwise_and_tensor_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_and_tensor_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( And(), test_data(), And().aten_op, @@ -146,8 +146,8 @@ def test_bitwise_and_tensor_tosa_MI(test_data: input_t2): @common.parametrize("test_data", AndScalar.test_data) -def test_bitwise_and_scalar_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_and_scalar_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( AndScalar(), test_data(), AndScalar.aten_op, @@ -160,8 +160,8 @@ def test_bitwise_and_scalar_tosa_MI(test_data: input_t2): @common.parametrize("test_data", And().test_data) -def test_bitwise_and_tensor_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_and_tensor_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( And(), test_data(), And().aten_op, @@ -176,8 +176,8 @@ def test_bitwise_and_tensor_tosa_BI(test_data: input_t2): @common.parametrize("test_data", AndScalar.test_data) -def test_bitwise_and_scalar_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_and_scalar_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( AndScalar(), test_data(), AndScalar.aten_op, @@ -192,7 +192,7 @@ def test_bitwise_and_scalar_tosa_BI(test_data: input_t2): @common.parametrize("test_data", And().test_data) -def test_bitwise_and_tensor_u55_BI(test_data: input_t2): +def test_bitwise_and_tensor_u55_INT(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( And(), @@ -205,7 +205,7 @@ def test_bitwise_and_tensor_u55_BI(test_data: input_t2): @common.parametrize("test_data", AndScalar.test_data) -def test_bitwise_and_scalar_u55_BI(test_data: input_t2): +def test_bitwise_and_scalar_u55_INT(test_data: input_t2): # There will be one full op which will be delegated. num_delegates = 1 num_exir = 0 @@ -225,8 +225,8 @@ def test_bitwise_and_scalar_u55_BI(test_data: input_t2): @common.parametrize("test_data", AndScalar.test_data) @common.XfailIfNoCorstone320 -def test_bitwise_and_scalar_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_and_scalar_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( AndScalar(), test_data(), AndScalar.aten_op, @@ -243,8 +243,8 @@ def test_bitwise_and_scalar_u85_BI(test_data: input_t2): @common.parametrize("test_data", And().test_data) @common.XfailIfNoCorstone320 -def test_bitwise_and_tensor_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_and_tensor_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( And(), test_data(), And().aten_op, @@ -260,8 +260,8 @@ def test_bitwise_and_tensor_u85_BI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_bitwise_xor_tensor_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_xor_tensor_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -274,8 +274,8 @@ def test_bitwise_xor_tensor_tosa_MI(test_data: input_t2): @common.parametrize("test_data", XorScalar.test_data) -def test_bitwise_xor_scalar_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_xor_scalar_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( XorScalar(), test_data(), XorScalar.aten_op, @@ -288,8 +288,8 @@ def test_bitwise_xor_scalar_tosa_MI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_bitwise_xor_tensor_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_xor_tensor_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -304,8 +304,8 @@ def test_bitwise_xor_tensor_tosa_BI(test_data: input_t2): @common.parametrize("test_data", XorScalar.test_data) -def test_bitwise_xor_scalar_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_xor_scalar_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( XorScalar(), test_data(), XorScalar.aten_op, @@ -320,7 +320,7 @@ def test_bitwise_xor_scalar_tosa_BI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_bitwise_xor_tensor_u55_BI(test_data: input_t2): +def test_bitwise_xor_tensor_u55_INT(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( Xor(), @@ -333,7 +333,7 @@ def test_bitwise_xor_tensor_u55_BI(test_data: input_t2): @common.parametrize("test_data", XorScalar.test_data) -def test_bitwise_xor_scalar_u55_BI(test_data: input_t2): +def test_bitwise_xor_scalar_u55_INT(test_data: input_t2): # There will be one full op which will be delegated. num_delegates = 1 num_exir = 0 @@ -353,8 +353,8 @@ def test_bitwise_xor_scalar_u55_BI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) @common.XfailIfNoCorstone320 -def test_bitwise_xor_tensor_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_xor_tensor_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -371,8 +371,8 @@ def test_bitwise_xor_tensor_u85_BI(test_data: input_t2): @common.parametrize("test_data", XorScalar.test_data) @common.XfailIfNoCorstone320 -def test_bitwise_xor_scalar_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_xor_scalar_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( XorScalar(), test_data(), XorScalar.aten_op, @@ -388,8 +388,8 @@ def test_bitwise_xor_scalar_u85_BI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_bitwise_or_tensor_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_or_tensor_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( Or(), test_data(), Or().aten_op, @@ -402,8 +402,8 @@ def test_bitwise_or_tensor_tosa_MI(test_data: input_t2): @common.parametrize("test_data", OrScalar.test_data) -def test_bitwise_or_scalar_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_bitwise_or_scalar_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( OrScalar(), test_data(), OrScalar.aten_op, @@ -416,8 +416,8 @@ def test_bitwise_or_scalar_tosa_MI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_bitwise_or_tensor_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_or_tensor_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( Or(), test_data(), Or().aten_op, @@ -432,8 +432,8 @@ def test_bitwise_or_tensor_tosa_BI(test_data: input_t2): @common.parametrize("test_data", OrScalar.test_data) -def test_bitwise_or_scalar_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_bitwise_or_scalar_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( OrScalar(), test_data(), OrScalar.aten_op, @@ -448,7 +448,7 @@ def test_bitwise_or_scalar_tosa_BI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_bitwise_or_tensor_u55_BI(test_data: input_t2): +def test_bitwise_or_tensor_u55_INT(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( Or(), @@ -461,7 +461,7 @@ def test_bitwise_or_tensor_u55_BI(test_data: input_t2): @common.parametrize("test_data", OrScalar.test_data) -def test_bitwise_or_scalar_u55_BI(test_data: input_t2): +def test_bitwise_or_scalar_u55_INT(test_data: input_t2): # There will be one full op which will be delegated. num_delegates = 1 num_exir = 0 @@ -481,8 +481,8 @@ def test_bitwise_or_scalar_u55_BI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) @common.XfailIfNoCorstone320 -def test_bitwise_or_tensor_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_or_tensor_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Or(), test_data(), Or().aten_op, @@ -499,8 +499,8 @@ def test_bitwise_or_tensor_u85_BI(test_data: input_t2): @common.parametrize("test_data", OrScalar.test_data) @common.XfailIfNoCorstone320 -def test_bitwise_or_scalar_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_bitwise_or_scalar_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( OrScalar(), test_data(), OrScalar.aten_op, diff --git a/backends/arm/test/ops/test_bmm.py b/backends/arm/test/ops/test_bmm.py index 6b66abbda01..40ae35cb5dd 100644 --- a/backends/arm/test/ops/test_bmm.py +++ b/backends/arm/test/ops/test_bmm.py @@ -13,10 +13,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op_bmm = "torch.ops.aten.bmm.default" @@ -57,31 +57,31 @@ def forward(self, x): @common.parametrize("test_data", BMM.test_data_generators) -def test_bmm_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](BMM(), test_data(), aten_op_bmm, exir_op_bmm) +def test_bmm_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](BMM(), test_data(), aten_op_bmm, exir_op_bmm) pipeline.run() @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLETORCH-534) @common.parametrize("test_data", BMMSingleInput.test_data_generators) -def test_bmm_tosa_MI_single_input(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_bmm_tosa_FP_single_input(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( BMMSingleInput(), test_data(), aten_op_bmm, exir_op_bmm ) pipeline.run() @common.parametrize("test_data", BMM.test_data_generators) -def test_bmm_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_bmm_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( BMM(), test_data(), aten_op_bmm, exir_op_bmm, qtol=1 ) pipeline.run() @common.parametrize("test_data", BMMSingleInput.test_data_generators) -def test_bmm_tosa_BI_single_input(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_bmm_tosa_INT_single_input(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( BMMSingleInput(), test_data(), aten_op_bmm, exir_op_bmm ) pipeline.change_args("run_method_and_compare_outputs", qtol=1) @@ -90,8 +90,8 @@ def test_bmm_tosa_BI_single_input(test_data: input_t1): @common.parametrize("test_data", BMM.test_data_generators) @common.XfailIfNoCorstone300 -def test_bmm_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_bmm_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( BMM(), test_data(), aten_op_bmm, @@ -103,8 +103,8 @@ def test_bmm_u55_BI(test_data: input_t1): @common.parametrize("test_data", BMM.test_data_generators) @common.XfailIfNoCorstone320 -def test_bmm_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_bmm_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( BMM(), test_data(), aten_op_bmm, @@ -116,8 +116,8 @@ def test_bmm_u85_BI(test_data: input_t1): @common.parametrize("test_data", BMMSingleInput.test_data_generators) @common.XfailIfNoCorstone300 -def test_bmm_u55_BI_single_input(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_bmm_u55_INT_single_input(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( BMMSingleInput(), test_data(), aten_op_bmm, @@ -129,8 +129,8 @@ def test_bmm_u55_BI_single_input(test_data: input_t1): @common.parametrize("test_data", BMMSingleInput.test_data_generators) @common.XfailIfNoCorstone320 -def test_bmm_u85_BI_single_input(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_bmm_u85_INT_single_input(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( BMMSingleInput(), test_data(), aten_op_bmm, diff --git a/backends/arm/test/ops/test_cat.py b/backends/arm/test/ops/test_cat.py index d5ebd6fe569..583a79e6710 100644 --- a/backends/arm/test/ops/test_cat.py +++ b/backends/arm/test/ops/test_cat.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -70,8 +70,8 @@ def forward(self, t: tuple[torch.Tensor, ...], dim: int) -> torch.Tensor: @common.parametrize("test_data", Cat.test_parameters) -def test_cat_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_cat_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Cat(), test_data(), aten_op, @@ -80,11 +80,11 @@ def test_cat_tosa_MI(test_data: Tuple): pipeline.run() -def test_cat_tosa_MI_4d(): +def test_cat_tosa_FP_4d(): square = torch.ones((2, 2, 2, 2)) for dim in range(-3, 3): test_data = ((square, square.clone()), dim) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Cat(), test_data, aten_op, @@ -94,8 +94,8 @@ def test_cat_tosa_MI_4d(): @common.parametrize("test_data", Cat.test_parameters) -def test_cat_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_cat_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Cat(), test_data(), aten_op, @@ -114,8 +114,8 @@ def test_cat_tosa_BI(test_data: Tuple): @common.parametrize("test_data", Cat.test_parameters, x_fails) @common.XfailIfNoCorstone300 -def test_cat_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_cat_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Cat(), test_data(), aten_op, @@ -127,8 +127,8 @@ def test_cat_u55_BI(test_data: Tuple): @common.parametrize("test_data", Cat.test_parameters, x_fails) @common.XfailIfNoCorstone320 -def test_cat_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_cat_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Cat(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_ceil.py b/backends/arm/test/ops/test_ceil.py index 5235e6f4027..25e641fa72c 100644 --- a/backends/arm/test/ops/test_ceil.py +++ b/backends/arm/test/ops/test_ceil.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -43,9 +43,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data) -def test_ceil_tosa_MI(test_data: input_t1): +def test_ceil_tosa_FP(test_data: input_t1): module, data = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, (data,), module.aten_op, @@ -55,9 +55,9 @@ def test_ceil_tosa_MI(test_data: input_t1): @common.parametrize("test_data", test_data) -def test_ceil_tosa_BI(test_data: input_t1): +def test_ceil_tosa_INT(test_data: input_t1): module, data = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, (data,), module.aten_op, @@ -70,9 +70,9 @@ def test_ceil_tosa_BI(test_data: input_t1): @common.parametrize("test_data", test_data) @common.XfailIfNoCorstone300 -def test_ceil_u55_BI(test_data: input_t1): +def test_ceil_u55_INT(test_data: input_t1): module, data = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( module, (data,), module.aten_op, @@ -84,9 +84,9 @@ def test_ceil_u55_BI(test_data: input_t1): @common.parametrize("test_data", test_data) @common.XfailIfNoCorstone320 -def test_ceil_u85_BI(test_data: input_t1): +def test_ceil_u85_INT(test_data: input_t1): module, data = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( module, (data,), module.aten_op, diff --git a/backends/arm/test/ops/test_clamp.py b/backends/arm/test/ops/test_clamp.py index b05e0e08eec..4c67e096c59 100644 --- a/backends/arm/test/ops/test_clamp.py +++ b/backends/arm/test/ops/test_clamp.py @@ -11,10 +11,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.clamp.default" @@ -51,12 +51,12 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_clamp_tosa_MI(test_data): +def test_clamp_tosa_FP(test_data): input_tensor, min_val, max_val = test_data() model = Clamp(min_val, max_val) - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( model, (input_tensor,), aten_op, @@ -67,12 +67,12 @@ def test_clamp_tosa_MI(test_data): @common.parametrize("test_data", test_data_suite) -def test_clamp_tosa_BI(test_data): +def test_clamp_tosa_INT(test_data): input_tensor, min_val, max_val = test_data() model = Clamp(min_val, max_val) - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, (input_tensor,), aten_op, @@ -85,12 +85,12 @@ def test_clamp_tosa_BI(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_clamp_u55_BI(test_data): +def test_clamp_u55_INT(test_data): input_tensor, min_val, max_val = test_data() model = Clamp(min_val, max_val) - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, (input_tensor,), aten_op, @@ -104,12 +104,12 @@ def test_clamp_u55_BI(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_clamp_u85_BI(test_data): +def test_clamp_u85_INT(test_data): input_tensor, min_val, max_val = test_data() model = Clamp(min_val, max_val) - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, (input_tensor,), aten_op, diff --git a/backends/arm/test/ops/test_clone.py b/backends/arm/test/ops/test_clone.py index 5a754b90934..88755f7254a 100644 --- a/backends/arm/test/ops/test_clone.py +++ b/backends/arm/test/ops/test_clone.py @@ -15,10 +15,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.clone.default" @@ -46,9 +46,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_clone_tosa_MI(test_data: Tuple[torch.Tensor]): +def test_clone_tosa_FP(test_data: Tuple[torch.Tensor]): - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( Clone(), test_data(), aten_op, @@ -59,8 +59,8 @@ def test_clone_tosa_MI(test_data: Tuple[torch.Tensor]): @common.parametrize("test_data", test_data_suite) -def test_clone_tosa_BI(test_data): - pipeline = TosaPipelineBI[input_t]( +def test_clone_tosa_INT(test_data): + pipeline = TosaPipelineINT[input_t]( Clone(), test_data(), aten_op, @@ -74,8 +74,8 @@ def test_clone_tosa_BI(test_data): @pytest.mark.xfail( reason="Empty subgraph leads to Vela compilation failure. See: https://jira.arm.com/browse/MLBEDSW-10477" ) -def test_clone_u55_BI(test_data): - pipeline = EthosU55PipelineBI[input_t]( +def test_clone_u55_INT(test_data): + pipeline = EthosU55PipelineINT[input_t]( Clone(), test_data(), aten_op, @@ -91,8 +91,8 @@ def test_clone_u55_BI(test_data): @pytest.mark.xfail( reason="Empty subgraph leads to Vela compilation failure. See: https://jira.arm.com/browse/MLBEDSW-10477" ) -def test_clone_u85_BI(test_data): - pipeline = EthosU85PipelineBI[input_t]( +def test_clone_u85_INT(test_data): + pipeline = EthosU85PipelineINT[input_t]( Clone(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_constant_pad_nd.py b/backends/arm/test/ops/test_constant_pad_nd.py index 0a81fd0f97d..5670cbd312c 100644 --- a/backends/arm/test/ops/test_constant_pad_nd.py +++ b/backends/arm/test/ops/test_constant_pad_nd.py @@ -11,8 +11,8 @@ import torch.nn.functional as F from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.pad.default" @@ -53,9 +53,9 @@ def forward(self, x: torch.Tensor): "test_data", test_data_suite, ) -def test_constant_pad_nd_tosa_MI(test_data: Tuple): +def test_constant_pad_nd_tosa_FP(test_data: Tuple): test_data, padding, value = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( ConstantPadND(padding, value), (test_data,), aten_op, @@ -65,9 +65,9 @@ def test_constant_pad_nd_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_constant_pad_nd_tosa_BI(test_data: Tuple): +def test_constant_pad_nd_tosa_INT(test_data: Tuple): test_data, padding, value = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( ConstantPadND(padding, value), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_conv1d.py b/backends/arm/test/ops/test_conv1d.py index cc8245ba126..60f51260db2 100644 --- a/backends/arm/test/ops/test_conv1d.py +++ b/backends/arm/test/ops/test_conv1d.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.conv1d.default" @@ -249,7 +249,7 @@ def forward(self, x): batches=1, ) -test_data_MI = { +test_data_FP = { "2_3x2x40_nobias": lambda: conv1d_2_3x2x40_nobias, "3_1x3x256_st1": lambda: conv1d_3_1x3x256_st1, "3_1x3x12_st2_pd1": lambda: conv1d_3_1x3x12_st2_pd1, @@ -265,16 +265,16 @@ def forward(self, x): "two_conv1d": lambda: two_conv1d, } -test_data_BI = { +test_data_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_MI.items() + for (k, v) in test_data_FP.items() for q in [True, False] } -@common.parametrize("test_data", test_data_MI) -def test_convolution_1d_tosa_MI(test_data): - pipeline = TosaPipelineMI[input_t]( +@common.parametrize("test_data", test_data_FP) +def test_convolution_1d_tosa_FP(test_data): + pipeline = TosaPipelineFP[input_t]( test_data(), test_data().get_inputs(), aten_op, @@ -283,10 +283,10 @@ def test_convolution_1d_tosa_MI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) -def test_convolution_1d_tosa_BI(test_data): +@common.parametrize("test_data", test_data_INT) +def test_convolution_1d_tosa_INT(test_data): model, per_channel_quantization = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -297,11 +297,11 @@ def test_convolution_1d_tosa_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) +@common.parametrize("test_data", test_data_INT) @common.XfailIfNoCorstone300 -def test_convolution_1d_u55_BI(test_data): +def test_convolution_1d_u55_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -313,11 +313,11 @@ def test_convolution_1d_u55_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) +@common.parametrize("test_data", test_data_INT) @common.XfailIfNoCorstone320 -def test_convolution_1d_u85_BI(test_data): +def test_convolution_1d_u85_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, model.get_inputs(), aten_op, diff --git a/backends/arm/test/ops/test_conv2d.py b/backends/arm/test/ops/test_conv2d.py index 54e9157284e..ef5ad5c3dec 100644 --- a/backends/arm/test/ops/test_conv2d.py +++ b/backends/arm/test/ops/test_conv2d.py @@ -9,11 +9,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.conv2d.default" @@ -356,8 +356,8 @@ def forward(self, x): ) # Shenanigan to get a nicer output when test fails. With unittest it looks like: -# FAIL: test_convolution_2d_tosa_BI_2_3x3_1x3x12x12_st2_pd1 -test_data_MI = { +# FAIL: test_convolution_2d_tosa_INT_2_3x3_1x3x12x12_st2_pd1 +test_data_FP = { "2x2_3x2x40x40_nobias": lambda: conv2d_2x2_3x2x40x40_nobias, "3x3_1x3x256x256_st1": lambda: conv2d_3x3_1x3x256x256_st1, "3x3_1x3x12x12_st2_pd1": lambda: conv2d_3x3_1x3x12x12_st2_pd1, @@ -381,9 +381,9 @@ def forward(self, x): } # Generate a new test set paired with per_channel_quant=True/False. -test_data_BI = { +test_data_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_MI.items() + for (k, v) in test_data_FP.items() for q in [True, False] } @@ -399,10 +399,10 @@ def forward(self, x): input_t = Tuple[torch.Tensor] -@common.parametrize("test_data", test_data_MI) -def test_convolution_2d_tosa_MI(test_data): +@common.parametrize("test_data", test_data_FP) +def test_convolution_2d_tosa_FP(test_data): model = test_data() - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( model, model.get_inputs(), aten_op, @@ -411,10 +411,10 @@ def test_convolution_2d_tosa_MI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) -def test_convolution_2d_tosa_BI(test_data): +@common.parametrize("test_data", test_data_INT) +def test_convolution_2d_tosa_INT(test_data): model, per_channel_quantization = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -425,11 +425,11 @@ def test_convolution_2d_tosa_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI, fvp_xfails) +@common.parametrize("test_data", test_data_INT, fvp_xfails) @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI(test_data): +def test_convolution_2d_u55_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -440,11 +440,11 @@ def test_convolution_2d_u55_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI, fvp_xfails) +@common.parametrize("test_data", test_data_INT, fvp_xfails) @common.XfailIfNoCorstone320 -def test_convolution_u85_BI(test_data): +def test_convolution_u85_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -490,7 +490,7 @@ def test_convolution_u85_BI(test_data): @common.parametrize("module", reject_suite) -def test_convolution_2d_u55_BI_not_delegated(module: Conv2d): +def test_convolution_2d_u55_INT_not_delegated(module: Conv2d): OpNotSupportedPipeline( module(), module().get_inputs(), diff --git a/backends/arm/test/ops/test_conv3d.py b/backends/arm/test/ops/test_conv3d.py index 1a8ea5c3dd5..0e7ba7b2bfb 100644 --- a/backends/arm/test/ops/test_conv3d.py +++ b/backends/arm/test/ops/test_conv3d.py @@ -10,11 +10,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.conv3d.default" @@ -304,7 +304,7 @@ def forward(self, x): batches=1, ) -test_data_MI = { +test_data_FP = { "2x2_3x2x40x40_nobias": lambda: conv3d_2x2_3x2x40x40_nobias, "3x3_1x3x256x256_st1": lambda: conv3d_3x3_1x3x256x256_st1, "3x3_1x3x12x12_st2_pd1": lambda: conv3d_3x3_1x3x12x12_st2_pd1, @@ -324,29 +324,29 @@ def forward(self, x): } # Generate a new test set paired with per_channel_quant=True/False. -test_data_BI = { +test_data_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_MI.items() + for (k, v) in test_data_FP.items() for q in [True, False] } input_t = Tuple[torch.Tensor] -@common.parametrize("test_data", test_data_MI) +@common.parametrize("test_data", test_data_FP) @pytest.mark.skip # Not implemented, skip until it is. -def test_convolution_3d_tosa_MI(test_data): - pipeline = TosaPipelineMI[input_t]( +def test_convolution_3d_tosa_FP(test_data): + pipeline = TosaPipelineFP[input_t]( test_data(), test_data().get_inputs(), aten_op, exir_op ) pipeline.run() -@common.parametrize("test_data", test_data_BI) +@common.parametrize("test_data", test_data_INT) @pytest.mark.skip # Not implemented, skip until it is. -def test_convolution_3d_tosa_BI(test_data): +def test_convolution_3d_tosa_INT(test_data): model, per_channel_quantization = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -357,11 +357,11 @@ def test_convolution_3d_tosa_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) +@common.parametrize("test_data", test_data_INT) @pytest.mark.skip # Not implemented, skip until it is. -def test_convolution_3d_u55_BI(test_data): +def test_convolution_3d_u55_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -372,11 +372,11 @@ def test_convolution_3d_u55_BI(test_data): pipeline.run() -@common.parametrize("test_data", test_data_BI) +@common.parametrize("test_data", test_data_INT) @pytest.mark.skip # Not implemented, skip until it is. -def test_convolution_3d_u85_BI(test_data): +def test_convolution_3d_u85_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, model.get_inputs(), aten_op, @@ -412,7 +412,7 @@ def test_convolution_3d_u85_BI(test_data): @common.parametrize("module", reject_suite) -def test_convolution_u55_BI_not_delegated_3d(module: Conv3d): +def test_convolution_u55_INT_not_delegated_3d(module: Conv3d): OpNotSupportedPipeline( module(), module().get_inputs(), diff --git a/backends/arm/test/ops/test_conv_combos.py b/backends/arm/test/ops/test_conv_combos.py index d3218258087..6769eb7ea34 100644 --- a/backends/arm/test/ops/test_conv_combos.py +++ b/backends/arm/test/ops/test_conv_combos.py @@ -11,10 +11,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -36,7 +36,7 @@ class ComboBlockBottleneckResidual(torch.nn.Module): "executorch_exir_dialects_edge__ops_aten_add_Tensor", ] - test_data_BI = { + test_data_INT = { "per_channel_quant=True": True, "per_channel_quant=False": False, } @@ -119,12 +119,12 @@ class ComboConvBatchnormRelu6(torch.nn.Module): "executorch_exir_dialects_edge__ops_aten_hardtanh_default", ] - test_data_MI = { + test_data_FP = { "affine=True": True, "affine=False": False, } - test_data_BI = { + test_data_INT = { "affine=True,per_channel_quant=True": (True, True), "affine=True,per_channel_quant=False": (True, False), "affine=False,per_channel_quant=True": (False, True), @@ -159,7 +159,7 @@ class ComboConvRelu6(torch.nn.Module): "executorch_exir_dialects_edge__ops_aten_hardtanh_default", ] - test_data_MI = { + test_data_FP = { "combo_conv_relu_2_x_4d": lambda: (2 * torch.randn(1, 3, 256, 256),), "combo_conv_relu_0_5_x_4d": lambda: (0.5 * torch.randn(1, 3, 256, 256),), "combo_conv_relu_4d": lambda: (torch.randn(1, 3, 256, 256),), @@ -168,10 +168,10 @@ class ComboConvRelu6(torch.nn.Module): } # Generate a new test set paired with per_channel_quant=True/False. - test_data_BI = { + test_data_INT = { # test_name: (input, per_channel_quant) f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_MI.items() + for (k, v) in test_data_FP.items() for q in [True, False] } @@ -194,7 +194,7 @@ class ComboConvAvgPool2d(torch.nn.Module): "executorch_exir_dialects_edge__ops_aten_avg_pool2d_default", ] - test_data_MI = { + test_data_FP = { "combo_conv_avgpool_20_x_4d": lambda: (20 * torch.randn(1, 3, 64, 32),), "combo_conv_avgpool_4d": lambda: (torch.randn(1, 3, 100, 200),), "combo_conv_avgpool_5_x_4d_randn": lambda: (5 * torch.randn(1, 3, 256, 256),), @@ -202,10 +202,10 @@ class ComboConvAvgPool2d(torch.nn.Module): } # Generate a new test set paired with per_channel_quant=True/False. - test_data_BI = { + test_data_INT = { # test_name: (input, per_channel_quant) f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_MI.items() + for (k, v) in test_data_FP.items() for q in [True, False] } @@ -227,9 +227,9 @@ def forward(self, x): #################### -def test_convolution_2d_tosa_MI_meandim(): +def test_convolution_2d_tosa_FP_meandim(): model = ComboConv2dMeandim() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( model, model.get_inputs(), aten_op=[], @@ -238,9 +238,9 @@ def test_convolution_2d_tosa_MI_meandim(): pipeline.run() -def test_convolution_2d_tosa_BI_meandim(): +def test_convolution_2d_tosa_INT_meandim(): model = ComboConv2dMeandim() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( model, model.get_inputs(), aten_op=[], @@ -250,9 +250,9 @@ def test_convolution_2d_tosa_BI_meandim(): @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI_meandim(): +def test_convolution_2d_u55_INT_meandim(): model = ComboConv2dMeandim() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -263,9 +263,9 @@ def test_convolution_2d_u55_BI_meandim(): @common.XfailIfNoCorstone320 -def test_convolution_2d_u85_BI_meandim(): +def test_convolution_2d_u85_INT_meandim(): model = ComboConv2dMeandim() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -280,11 +280,11 @@ def test_convolution_2d_u85_BI_meandim(): ############################## -@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_MI) -def test_convolution_2d_tosa_MI_batchnorm_relu6(test_data): +@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_FP) +def test_convolution_2d_tosa_FP_batchnorm_relu6(test_data): affine = test_data model = ComboConvBatchnormRelu6(affine) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( model, model.get_inputs(), aten_op=[], @@ -294,11 +294,11 @@ def test_convolution_2d_tosa_MI_batchnorm_relu6(test_data): @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLTORCH-307) -@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_BI) -def test_convolution_2d_tosa_BI_batchnorm_relu6(test_data): +@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_INT) +def test_convolution_2d_tosa_INT_batchnorm_relu6(test_data): affine, per_channel_quantization = test_data model = ComboConvBatchnormRelu6(affine) - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( model, model.get_inputs(), aten_op=[], @@ -309,12 +309,12 @@ def test_convolution_2d_tosa_BI_batchnorm_relu6(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_BI) +@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_INT) @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI_batchnorm_relu6(test_data): +def test_convolution_2d_u55_INT_batchnorm_relu6(test_data): affine, per_channel_quantization = test_data model = ComboConvBatchnormRelu6(affine) - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -325,12 +325,12 @@ def test_convolution_2d_u55_BI_batchnorm_relu6(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_BI) +@common.parametrize("test_data", ComboConvBatchnormRelu6.test_data_INT) @common.XfailIfNoCorstone320 -def test_convolution_2d_u85_BI_batchnorm_relu6(test_data): +def test_convolution_2d_u85_INT_batchnorm_relu6(test_data): affine, per_channel_quantization = test_data model = ComboConvBatchnormRelu6(affine) - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -346,10 +346,10 @@ def test_convolution_2d_u85_BI_batchnorm_relu6(test_data): ################## -@common.parametrize("test_data", ComboConvRelu6.test_data_MI) -def test_convolution_2d_tosa_MI_relu6(test_data): +@common.parametrize("test_data", ComboConvRelu6.test_data_FP) +def test_convolution_2d_tosa_FP_relu6(test_data): model = ComboConvRelu6() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( model, test_data(), aten_op=[], @@ -359,11 +359,11 @@ def test_convolution_2d_tosa_MI_relu6(test_data): @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLTORCH-307) -@common.parametrize("test_data", ComboConvRelu6.test_data_BI) -def test_convolution_2d_tosa_BI_relu6(test_data): +@common.parametrize("test_data", ComboConvRelu6.test_data_INT) +def test_convolution_2d_tosa_INT_relu6(test_data): input, per_channel_quantization = test_data() model = ComboConvRelu6() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( model, input, aten_op=[], @@ -373,12 +373,12 @@ def test_convolution_2d_tosa_BI_relu6(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvRelu6.test_data_BI) +@common.parametrize("test_data", ComboConvRelu6.test_data_INT) @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI_relu6(test_data): +def test_convolution_2d_u55_INT_relu6(test_data): input, per_channel_quantization = test_data() model = ComboConvRelu6() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( model, input, aten_ops=[], @@ -389,12 +389,12 @@ def test_convolution_2d_u55_BI_relu6(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvRelu6.test_data_BI) +@common.parametrize("test_data", ComboConvRelu6.test_data_INT) @common.XfailIfNoCorstone320 -def test_convolution_2d_u85_BI_relu6(test_data): +def test_convolution_2d_u85_INT_relu6(test_data): input, per_channel_quantization = test_data() model = ComboConvRelu6() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( model, input, aten_ops=[], @@ -408,9 +408,9 @@ def test_convolution_2d_u85_BI_relu6(test_data): ############################### ## Block bottleneck residual ## ############################### -def test_convolution_2d_tosa_MI_block_bottleneck(): +def test_convolution_2d_tosa_FP_block_bottleneck(): model = ComboBlockBottleneckResidual() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( model, model.get_inputs(), aten_op=[], @@ -419,12 +419,12 @@ def test_convolution_2d_tosa_MI_block_bottleneck(): pipeline.run() -@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_BI) +@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_INT) @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLTORCH-307) -def test_convolution_2d_tosa_BI_block_bottleneck(test_data): +def test_convolution_2d_tosa_INT_block_bottleneck(test_data): per_channel_quantization = test_data model = ComboBlockBottleneckResidual() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( model, model.get_inputs(), aten_op=[], @@ -435,12 +435,12 @@ def test_convolution_2d_tosa_BI_block_bottleneck(test_data): pipeline.run() -@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_BI) +@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_INT) @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI_block_bottleneck(test_data): +def test_convolution_2d_u55_INT_block_bottleneck(test_data): per_channel_quantization = test_data model = ComboBlockBottleneckResidual() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -451,12 +451,12 @@ def test_convolution_2d_u55_BI_block_bottleneck(test_data): pipeline.run() -@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_BI) +@common.parametrize("test_data", ComboBlockBottleneckResidual.test_data_INT) @common.XfailIfNoCorstone320 -def test_convolution_2d_u85_BI_block_bottleneck(test_data): +def test_convolution_2d_u85_INT_block_bottleneck(test_data): per_channel_quantization = test_data model = ComboBlockBottleneckResidual() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( model, model.get_inputs(), aten_ops=[], @@ -472,10 +472,10 @@ def test_convolution_2d_u85_BI_block_bottleneck(test_data): ###################### -@common.parametrize("test_data", ComboConvAvgPool2d.test_data_MI) -def test_convolution_2d_tosa_MI_avgpool2d(test_data): +@common.parametrize("test_data", ComboConvAvgPool2d.test_data_FP) +def test_convolution_2d_tosa_FP_avgpool2d(test_data): model = ComboConvAvgPool2d() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( model, test_data(), aten_op=[], @@ -485,11 +485,11 @@ def test_convolution_2d_tosa_MI_avgpool2d(test_data): @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLTORCH-307) -@common.parametrize("test_data", ComboConvAvgPool2d.test_data_BI) -def test_convolution_2d_tosa_BI_avgpool2d(test_data): +@common.parametrize("test_data", ComboConvAvgPool2d.test_data_INT) +def test_convolution_2d_tosa_INT_avgpool2d(test_data): input, per_channel_quantization = test_data() model = ComboConvAvgPool2d() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( model, input, aten_op=[], @@ -499,12 +499,12 @@ def test_convolution_2d_tosa_BI_avgpool2d(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvAvgPool2d.test_data_BI) +@common.parametrize("test_data", ComboConvAvgPool2d.test_data_INT) @common.XfailIfNoCorstone300 -def test_convolution_2d_u55_BI_avgpool2d(test_data): +def test_convolution_2d_u55_INT_avgpool2d(test_data): input, per_channel_quantization = test_data() model = ComboConvAvgPool2d() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( model, input, aten_ops=[], @@ -515,12 +515,12 @@ def test_convolution_2d_u55_BI_avgpool2d(test_data): pipeline.run() -@common.parametrize("test_data", ComboConvAvgPool2d.test_data_BI) +@common.parametrize("test_data", ComboConvAvgPool2d.test_data_INT) @common.XfailIfNoCorstone320 -def test_convolution_2d_u85_BI_avgpool2d(test_data): +def test_convolution_2d_u85_INT_avgpool2d(test_data): input, per_channel_quantization = test_data() model = ComboConvAvgPool2d() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( model, input, aten_ops=[], diff --git a/backends/arm/test/ops/test_conv_constant_pad_nd.py b/backends/arm/test/ops/test_conv_constant_pad_nd.py index 61497578fb6..19750788e6e 100644 --- a/backends/arm/test/ops/test_conv_constant_pad_nd.py +++ b/backends/arm/test/ops/test_conv_constant_pad_nd.py @@ -14,8 +14,8 @@ import torch.nn.functional as F from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.pad.default" @@ -91,9 +91,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_constant_pad_nd_tosa_MI(test_data: Tuple): +def test_constant_pad_nd_tosa_FP(test_data: Tuple): test_data, padding, value = test_data - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( ConstantPadND(padding, value), (test_data,), aten_op, @@ -103,9 +103,9 @@ def test_constant_pad_nd_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_constant_pad_nd_tosa_BI(test_data: Tuple): +def test_constant_pad_nd_tosa_INT(test_data: Tuple): test_data, padding, value = test_data - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( ConstantPadND(padding, value), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_cos.py b/backends/arm/test/ops/test_cos.py index 7cfd32d2bd2..e872c847ade 100644 --- a/backends/arm/test/ops/test_cos.py +++ b/backends/arm/test/ops/test_cos.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.cos.default" @@ -39,8 +39,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) @pytest.mark.tosa_ref_model -def test_cos_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_cos_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Cos(), (test_data,), aten_op, @@ -53,8 +53,8 @@ def test_cos_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @pytest.mark.tosa_ref_model -def test_cos_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_cos_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Cos(), (test_data,), aten_op, @@ -65,8 +65,8 @@ def test_cos_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_cos_tosa_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_cos_tosa_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Cos(), (test_data,), aten_op, @@ -77,8 +77,8 @@ def test_cos_tosa_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_cos_tosa_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_cos_tosa_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Cos(), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_depthwise_conv.py b/backends/arm/test/ops/test_depthwise_conv.py index 4a6150317b5..9d044dc2237 100644 --- a/backends/arm/test/ops/test_depthwise_conv.py +++ b/backends/arm/test/ops/test_depthwise_conv.py @@ -11,10 +11,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] # Input x @@ -154,7 +154,7 @@ ) # Shenanigan to get a nicer output when test fails. -test_data_conv2d_MI = { +test_data_conv2d_FP = { "2x2_1x6x4x4_gp6_st1": lambda: dw_conv2d_2x2_1x6x4x4_gp6_st1, "3x3_1x3x256x256_gp3_st1": lambda: dw_conv2d_3x3_1x3x256x256_gp3_st1, "3x3_1x4x256x256_gp4_nobias": lambda: dw_conv2d_3x3_1x4x256x256_gp4_nobias, @@ -164,9 +164,9 @@ } # Generate a new test set paired with per_channel_quant=True/False. -test_data_conv2d_BI = { +test_data_conv2d_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_conv2d_MI.items() + for (k, v) in test_data_conv2d_FP.items() for q in [True, False] } @@ -182,7 +182,7 @@ for q in [True, False] } -test_data_conv1d_MI = { +test_data_conv1d_FP = { "2_1x6x4_gp6_st1": lambda: dw_conv1d_2_1x6x4_gp6_st1, "two_dw_conv1d": lambda: two_dw_conv1d, "3_1x3x256_gp3_st1": lambda: dw_conv1d_3_1x3x256_gp3_st1, @@ -190,16 +190,16 @@ } # Generate a new test set paired with per_channel_quant=True/False. -test_data_conv1d_BI = { +test_data_conv1d_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (v(), q)) - for (k, v) in test_data_conv1d_MI.items() + for (k, v) in test_data_conv1d_FP.items() for q in [True, False] } -@common.parametrize("test_data", test_data_conv1d_MI | test_data_conv2d_MI) -def test_depthwise_convolution_2d_tosa_MI(test_data: torch.nn.Module): - pipeline = TosaPipelineMI[input_t]( +@common.parametrize("test_data", test_data_conv1d_FP | test_data_conv2d_FP) +def test_depthwise_convolution_2d_tosa_FP(test_data: torch.nn.Module): + pipeline = TosaPipelineFP[input_t]( test_data(), test_data().get_inputs(), aten_op=[], @@ -209,10 +209,10 @@ def test_depthwise_convolution_2d_tosa_MI(test_data: torch.nn.Module): @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness (MLTORCH-307) -@common.parametrize("test_data", test_data_conv1d_BI | test_data_conv2d_BI) -def test_depthwise_convolution_2d_tosa_BI(test_data): +@common.parametrize("test_data", test_data_conv1d_INT | test_data_conv2d_INT) +def test_depthwise_convolution_2d_tosa_INT(test_data): model, per_channel_quantization = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, model.get_inputs(), aten_op=[], @@ -233,10 +233,10 @@ def test_depthwise_convolution_2d_tosa_BI(test_data): @common.XfailIfNoCorstone300 # TODO: MLETORCH-516 -@common.parametrize("test_data", test_data_conv2d_BI, x_fails) -def test_depthwise_convolution_2d_u55_BI(test_data): +@common.parametrize("test_data", test_data_conv2d_INT, x_fails) +def test_depthwise_convolution_2d_u55_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, model.get_inputs(), aten_ops=[], @@ -248,10 +248,10 @@ def test_depthwise_convolution_2d_u55_BI(test_data): @common.XfailIfNoCorstone300 # TODO: MLETORCH-516 -@common.parametrize("test_data", test_data_conv1d_BI) -def test_depthwise_convolution_1d_u55_BI(test_data): +@common.parametrize("test_data", test_data_conv1d_INT) +def test_depthwise_convolution_1d_u55_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, model.get_inputs(), aten_ops=[], @@ -263,10 +263,10 @@ def test_depthwise_convolution_1d_u55_BI(test_data): @common.XfailIfNoCorstone320 # TODO: MLETORCH-516 -@common.parametrize("test_data", test_data_conv2d_BI, x_fails) -def test_depthwise_convolution_2d_u85_BI(test_data): +@common.parametrize("test_data", test_data_conv2d_INT, x_fails) +def test_depthwise_convolution_2d_u85_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, model.get_inputs(), aten_ops=[], @@ -278,10 +278,10 @@ def test_depthwise_convolution_2d_u85_BI(test_data): @common.XfailIfNoCorstone320 # TODO: MLETORCH-516 -@common.parametrize("test_data", test_data_conv1d_BI, x_fails) -def test_depthwise_convolution_1d_u85_BI(test_data): +@common.parametrize("test_data", test_data_conv1d_INT, x_fails) +def test_depthwise_convolution_1d_u85_INT(test_data): model, per_channel_quantization = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, model.get_inputs(), aten_ops=[], diff --git a/backends/arm/test/ops/test_div.py b/backends/arm/test/ops/test_div.py index 0e1ca005fa1..2c27a0a0c96 100644 --- a/backends/arm/test/ops/test_div.py +++ b/backends/arm/test/ops/test_div.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.div.Tensor" @@ -89,14 +89,14 @@ def forward( @common.parametrize("test_data", test_data_suite) -def test_div_tensor_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1](Div(), test_data(), aten_op, exir_op) +def test_div_tensor_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1](Div(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_div_tensor_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1](Div(), test_data(), aten_op=[], exir_op=[]) +def test_div_tensor_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1](Div(), test_data(), aten_op=[], exir_op=[]) pipeline.run() @@ -112,8 +112,8 @@ def test_div_tensor_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite, xfails=x_fails) @common.XfailIfNoCorstone300 -def test_div_tensor_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_div_tensor_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Div(), test_data(), aten_ops=[], @@ -125,8 +125,8 @@ def test_div_tensor_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite, xfails=x_fails) @common.XfailIfNoCorstone320 -def test_div_tensor_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_div_tensor_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Div(), test_data(), aten_ops=[], diff --git a/backends/arm/test/ops/test_embedding.py b/backends/arm/test/ops/test_embedding.py index 5696346b225..df6bf601f0b 100644 --- a/backends/arm/test/ops/test_embedding.py +++ b/backends/arm/test/ops/test_embedding.py @@ -11,8 +11,8 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -57,9 +57,9 @@ def forward(self, weights: torch.Tensor, indices: torch.Tensor): @common.parametrize("test_input", test_input) -def test_embedding_tosa_MI(test_input: input_params): +def test_embedding_tosa_FP(test_input: input_params): op = Embedding() - pipeline = TosaPipelineMI[input_params]( + pipeline = TosaPipelineFP[input_params]( op, test_input, op.aten_op, @@ -71,9 +71,9 @@ def test_embedding_tosa_MI(test_input: input_params): @common.parametrize("test_input", test_input) -def test_embedding_tosa_BI(test_input: input_params): +def test_embedding_tosa_INT(test_input: input_params): op = Embedding() - pipeline = TosaPipelineBI[input_params]( + pipeline = TosaPipelineINT[input_params]( op, test_input, op.aten_op, diff --git a/backends/arm/test/ops/test_eq.py b/backends/arm/test/ops/test_eq.py index bd6cace00a5..dd1add495ed 100644 --- a/backends/arm/test/ops/test_eq.py +++ b/backends/arm/test/ops/test_eq.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] @@ -77,8 +77,8 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_eq_scalar_tosa_MI_tensor(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_eq_scalar_tosa_FP_tensor(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Tensor, @@ -88,8 +88,8 @@ def test_eq_scalar_tosa_MI_tensor(test_module): @common.parametrize("test_module", test_data_scalar) -def test_eq_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_eq_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Scalar, @@ -99,8 +99,8 @@ def test_eq_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_eq_scalar_tosa_BI_tensor(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_eq_scalar_tosa_INT_tensor(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Tensor, @@ -110,8 +110,8 @@ def test_eq_scalar_tosa_BI_tensor(test_module): @common.parametrize("test_module", test_data_scalar) -def test_eq_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_eq_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Tensor, @@ -122,7 +122,7 @@ def test_eq_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_eq_scalar_u55_BI_tensor(test_module): +def test_eq_scalar_u55_INT_tensor(test_module): # EQUAL is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -136,7 +136,7 @@ def test_eq_scalar_u55_BI_tensor(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_eq_scalar_u55_BI(test_module): +def test_eq_scalar_u55_INT(test_module): # EQUAL is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -158,8 +158,8 @@ def test_eq_scalar_u55_BI(test_module): strict=False, ) @common.XfailIfNoCorstone320 -def test_eq_scalar_u85_BI_tensor(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_eq_scalar_u85_INT_tensor(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Tensor, @@ -178,8 +178,8 @@ def test_eq_scalar_u85_BI_tensor(test_module): strict=False, ) @common.XfailIfNoCorstone320 -def test_eq_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_eq_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), Equal.aten_op_Tensor, diff --git a/backends/arm/test/ops/test_erf.py b/backends/arm/test/ops/test_erf.py index e7136036c65..f50aa34b9b0 100644 --- a/backends/arm/test/ops/test_erf.py +++ b/backends/arm/test/ops/test_erf.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.erf.default" @@ -34,21 +34,21 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Erf.test_data) -def test_erf_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](Erf(), test_data(), aten_op, exir_op) +def test_erf_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](Erf(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Erf.test_data) -def test_erf_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Erf(), test_data(), aten_op, exir_op) +def test_erf_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1](Erf(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", Erf.test_data) @common.XfailIfNoCorstone300 -def test_erf_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_erf_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( Erf(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() @@ -56,8 +56,8 @@ def test_erf_u55_BI(test_data: input_t1): @common.parametrize("test_data", Erf.test_data) @common.XfailIfNoCorstone320 -def test_erf_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_erf_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( Erf(), test_data(), aten_op, exir_op, run_on_fvp=True ) pipeline.run() diff --git a/backends/arm/test/ops/test_exp.py b/backends/arm/test/ops/test_exp.py index 9218455916a..4458f651e71 100644 --- a/backends/arm/test/ops/test_exp.py +++ b/backends/arm/test/ops/test_exp.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_data_suite = { @@ -38,8 +38,8 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", test_data_suite) -def test_exp_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_exp_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Exp(), (test_data(),), aten_op, @@ -49,8 +49,8 @@ def test_exp_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_exp_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_exp_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Exp(), (test_data(),), aten_op, @@ -61,8 +61,8 @@ def test_exp_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_exp_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_exp_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Exp(), (test_data(),), aten_op, @@ -74,8 +74,8 @@ def test_exp_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_exp_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_exp_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Exp(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_expand.py b/backends/arm/test/ops/test_expand.py index 8f84c39dd27..30ab4d73092 100644 --- a/backends/arm/test/ops/test_expand.py +++ b/backends/arm/test/ops/test_expand.py @@ -16,10 +16,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.expand.default" @@ -48,8 +48,8 @@ def forward(self, x: torch.Tensor, m: Sequence): @common.parametrize("test_data", Expand.test_parameters | Expand.test_reject_set) -def test_expand_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_expand_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Expand(), test_data(), aten_op, @@ -59,8 +59,8 @@ def test_expand_tosa_MI(test_data: Tuple): @common.parametrize("test_data", Expand.test_parameters | Expand.test_reject_set) -def test_expand_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_expand_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Expand(), test_data(), aten_op, @@ -78,8 +78,8 @@ def test_expand_tosa_BI(test_data: Tuple): @common.parametrize("test_data", Expand.test_parameters, x_fails) @common.XfailIfNoCorstone300 -def test_expand_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_expand_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Expand(), test_data(), aten_op, @@ -91,8 +91,8 @@ def test_expand_u55_BI(test_data: Tuple): @common.parametrize("test_data", Expand.test_parameters, x_fails) @common.XfailIfNoCorstone320 -def test_expand_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_expand_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Expand(), test_data(), aten_op, @@ -107,8 +107,8 @@ def test_expand_u85_BI(test_data: Tuple): @pytest.mark.xfail( reason="MLETORCH-716: Node will be optimized away and Vela can't handle empty graphs" ) -def test_expand_u55_BI_failure_set(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_expand_u55_INT_failure_set(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Expand(), test_data(), aten_op, @@ -123,8 +123,8 @@ def test_expand_u55_BI_failure_set(test_data: Tuple): @pytest.mark.xfail( reason="MLETORCH-716: Node will be optimized away and Vela can't handle empty graphs" ) -def test_expand_u85_BI_failure_set(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_expand_u85_INT_failure_set(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Expand(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_eye.py b/backends/arm/test/ops/test_eye.py index ef9256a6a08..cd2eac74548 100644 --- a/backends/arm/test/ops/test_eye.py +++ b/backends/arm/test/ops/test_eye.py @@ -6,11 +6,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -48,9 +48,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", EyeAdd.test_data) -def test_eye_tosa_MI(test_data: test_data_t): +def test_eye_tosa_FP(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( EyeAdd(*init_data), input_data(), EyeAdd.aten_op, @@ -59,9 +59,9 @@ def test_eye_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", EyeAdd.test_data) -def test_eye_tosa_BI(test_data: test_data_t): +def test_eye_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( EyeAdd(*init_data), input_data(), EyeAdd.aten_op, @@ -72,9 +72,9 @@ def test_eye_tosa_BI(test_data: test_data_t): @common.parametrize("test_data", EyeAdd.test_data) @common.XfailIfNoCorstone300 -def test_eye_u55_BI(test_data: test_data_t): +def test_eye_u55_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( EyeAdd(*init_data), input_data(), EyeAdd.aten_op, @@ -86,9 +86,9 @@ def test_eye_u55_BI(test_data: test_data_t): @common.parametrize("test_data", EyeAdd.test_data) @common.XfailIfNoCorstone320 -def test_eye_u85_BI(test_data: test_data_t): +def test_eye_u85_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( EyeAdd(*init_data), input_data(), EyeAdd.aten_op, @@ -107,7 +107,7 @@ def test_eye_u85_BI(test_data: test_data_t): "int32_int64": "MLETORCG-716: Do not delegate empty networks to vela", }, ) -def test_eye_tosa_BI_not_delegated(test_data: test_data_t): +def test_eye_tosa_INT_not_delegated(test_data: test_data_t): input_data, init_data = test_data pipeline = OpNotSupportedPipeline[input_t]( EyeAdd(*init_data), input_data(), non_delegated_ops={}, quantize=True diff --git a/backends/arm/test/ops/test_floor.py b/backends/arm/test/ops/test_floor.py index 87c9ae8d4bd..0a77181efe7 100644 --- a/backends/arm/test/ops/test_floor.py +++ b/backends/arm/test/ops/test_floor.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -43,9 +43,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data) -def test_floor_tosa_MI(test_data: input_t1): +def test_floor_tosa_FP(test_data: input_t1): module, data = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, (data,), module.aten_op, @@ -55,9 +55,9 @@ def test_floor_tosa_MI(test_data: input_t1): @common.parametrize("test_data", test_data) -def test_floor_tosa_BI(test_data: input_t1): +def test_floor_tosa_INT(test_data: input_t1): module, data = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, (data,), module.aten_op, @@ -70,9 +70,9 @@ def test_floor_tosa_BI(test_data: input_t1): @common.parametrize("test_data", test_data) @common.XfailIfNoCorstone300 -def test_floor_u55_BI(test_data: input_t1): +def test_floor_u55_INT(test_data: input_t1): module, data = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( module, (data,), module.aten_op, @@ -84,9 +84,9 @@ def test_floor_u55_BI(test_data: input_t1): @common.parametrize("test_data", test_data) @common.XfailIfNoCorstone320 -def test_floor_u85_BI(test_data: input_t1): +def test_floor_u85_INT(test_data: input_t1): module, data = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( module, (data,), module.aten_op, diff --git a/backends/arm/test/ops/test_full.py b/backends/arm/test/ops/test_full.py index 13a3146f2fe..09cb47812d7 100644 --- a/backends/arm/test/ops/test_full.py +++ b/backends/arm/test/ops/test_full.py @@ -15,10 +15,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor, int] @@ -76,8 +76,8 @@ def forward(self, input_tensor: torch.Tensor, value): return input_tensor + torch.full_like(input_tensor, value) -def test_full_tosa_MI_only(): - pipeline = TosaPipelineMI[input_t1]( +def test_full_tosa_FP_only(): + pipeline = TosaPipelineFP[input_t1]( Full(), (), aten_op=[], @@ -86,9 +86,9 @@ def test_full_tosa_MI_only(): pipeline.run() -def test_full_tosa_MI_const(): +def test_full_tosa_FP_const(): test_data = (torch.rand((2, 2, 3, 3)) * 10,) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( AddConstFull(), test_data, aten_op=[], @@ -98,8 +98,8 @@ def test_full_tosa_MI_const(): @common.parametrize("test_data", FullLike.test_parameters) -def test_full_like_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_full_like_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( FullLike(), test_data(), aten_op=[], @@ -109,8 +109,8 @@ def test_full_like_tosa_MI(test_data: Tuple): @common.parametrize("test_data", AddVariableFull.test_parameters) -def test_full_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_full_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( AddVariableFull(), test_data, aten_op=[], @@ -120,8 +120,8 @@ def test_full_tosa_MI(test_data: Tuple): @common.parametrize("test_data", AddVariableFull.test_parameters) -def test_full_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_full_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( AddVariableFull(), test_data, aten_op=[], @@ -131,8 +131,8 @@ def test_full_tosa_BI(test_data: Tuple): @common.parametrize("test_data", FullLike.test_parameters) -def test_full_like_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_full_like_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( FullLike(), test_data(), aten_op=[], @@ -144,8 +144,8 @@ def test_full_like_tosa_BI(test_data: Tuple): @common.parametrize("test_data", AddVariableFull.test_parameters) @common.XfailIfNoCorstone320 -def test_full_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_full_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( AddVariableFull(), test_data, aten_ops=[], @@ -158,8 +158,8 @@ def test_full_u85_BI(test_data: Tuple): @common.parametrize("test_data", AddVariableFull.test_parameters) @common.XfailIfNoCorstone300 -def test_full_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_full_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( AddVariableFull(), test_data, aten_ops=[], @@ -174,9 +174,9 @@ def test_full_u55_BI(test_data: Tuple): @pytest.mark.skip( "This fails since full outputs int64 by default if 'fill_value' is integer, which our backend doesn't support." ) -def test_full_tosa_MI_integer_value(): +def test_full_tosa_FP_integer_value(): test_data = (torch.ones((2, 2)), 1.0) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( AddVariableFull(), test_data, aten_op=[], @@ -191,9 +191,9 @@ def test_full_tosa_MI_integer_value(): @pytest.mark.skip( "This fails since the fill value in the full tensor is set at compile time by the example data (1.)." ) -def test_full_tosa_MI_set_value_at_runtime(tosa_version: str): +def test_full_tosa_FP_set_value_at_runtime(tosa_version: str): test_data = (torch.ones((2, 2)), 1.0) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( AddVariableFull(), test_data, aten_op=[], diff --git a/backends/arm/test/ops/test_ge.py b/backends/arm/test/ops/test_ge.py index 19c036be526..4090d04dc89 100644 --- a/backends/arm/test/ops/test_ge.py +++ b/backends/arm/test/ops/test_ge.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] @@ -77,8 +77,8 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_ge_tensor_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_ge_tensor_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_tensor, @@ -88,8 +88,8 @@ def test_ge_tensor_tosa_MI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_ge_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_ge_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_scalar, @@ -99,8 +99,8 @@ def test_ge_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_ge_tensor_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_ge_tensor_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_tensor, @@ -110,8 +110,8 @@ def test_ge_tensor_tosa_BI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_ge_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_ge_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_tensor, @@ -122,7 +122,7 @@ def test_ge_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_ge_tensor_u55_BI(test_module): +def test_ge_tensor_u55_INT(test_module): # GREATER_EQUAL is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -136,7 +136,7 @@ def test_ge_tensor_u55_BI(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_ge_scalar_u55_BI(test_module): +def test_ge_scalar_u55_INT(test_module): # GREATER_EQUAL is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -155,8 +155,8 @@ def test_ge_scalar_u55_BI(test_module): xfails={"ge_tensor_rank4_randn": "MLETORCH-847: Boolean eq result unstable on U85"}, ) @common.XfailIfNoCorstone320 -def test_ge_tensor_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_ge_tensor_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_tensor, @@ -172,8 +172,8 @@ def test_ge_tensor_u85_BI(test_module): xfails={"ge_scalar_rank4_randn": "MLETORCH-847: Boolean eq result unstable on U85"}, ) @common.XfailIfNoCorstone320 -def test_ge_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_ge_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), GreaterEqual.aten_op_tensor, diff --git a/backends/arm/test/ops/test_gelu.py b/backends/arm/test/ops/test_gelu.py index 6ac9b5dabf5..8187ec69dc6 100644 --- a/backends/arm/test/ops/test_gelu.py +++ b/backends/arm/test/ops/test_gelu.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -81,9 +81,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Gelu.test_data) -def test_gelu_tosa_MI(test_data: input_t1): +def test_gelu_tosa_FP(test_data: input_t1): approximate, test_data = test_data() - TosaPipelineMI[input_t1]( + TosaPipelineFP[input_t1]( Gelu(approximate), (test_data,), Gelu.aten_op, @@ -93,9 +93,9 @@ def test_gelu_tosa_MI(test_data: input_t1): @common.parametrize("test_data", Gelu.test_data) -def test_gelu_tosa_BI(test_data: input_t1): +def test_gelu_tosa_INT(test_data: input_t1): approximate, test_data = test_data() - TosaPipelineBI[input_t1]( + TosaPipelineINT[input_t1]( Gelu(approximate), (test_data,), Gelu.aten_op, @@ -105,9 +105,9 @@ def test_gelu_tosa_BI(test_data: input_t1): @common.parametrize("test_data", Gelu.test_data) @common.XfailIfNoCorstone300 -def test_gelu_u55_BI(test_data: input_t1): +def test_gelu_u55_INT(test_data: input_t1): approximate, test_data = test_data() - EthosU55PipelineBI[input_t1]( + EthosU55PipelineINT[input_t1]( Gelu(approximate), (test_data,), Gelu.aten_op, @@ -117,9 +117,9 @@ def test_gelu_u55_BI(test_data: input_t1): @common.parametrize("test_data", Gelu.test_data) @common.XfailIfNoCorstone320 -def test_gelu_u85_BI(test_data: input_t1): +def test_gelu_u85_INT(test_data: input_t1): approximate, test_data = test_data() - EthosU85PipelineBI[input_t1]( + EthosU85PipelineINT[input_t1]( Gelu(approximate), (test_data,), Gelu.aten_op, diff --git a/backends/arm/test/ops/test_group_norm.py b/backends/arm/test/ops/test_group_norm.py index 9c5517d9dae..248a13e51f8 100644 --- a/backends/arm/test/ops/test_group_norm.py +++ b/backends/arm/test/ops/test_group_norm.py @@ -6,10 +6,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -61,10 +61,10 @@ def forward( @common.parametrize("test_data", test_data_suite) -def test_native_group_norm_tosa_MI(test_data): +def test_native_group_norm_tosa_FP(test_data): aten_op = "torch.ops.aten.group_norm.default" exir_op = "executorch_exir_dialects_edge__ops_aten_native_group_norm_default" - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( test_data[1], test_data[0], aten_op=aten_op, @@ -84,10 +84,10 @@ def test_native_group_norm_tosa_MI(test_data): }, strict=False, ) -def test_native_group_norm_tosa_BI(test_data): +def test_native_group_norm_tosa_INT(test_data): aten_op = "torch.ops.aten.sub.Tensor" # 'sub' op arbitrarily chosen to confirm groupnorm was decomposed exir_op = "executorch_exir_dialects_edge__ops_aten_native_group_norm_default" - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( test_data[1], test_data[0], aten_op=aten_op, @@ -109,8 +109,8 @@ def test_native_group_norm_tosa_BI(test_data): strict=False, ) @common.XfailIfNoCorstone300 -def test_native_group_norm_u55_BI(test_data): - pipeline = EthosU55PipelineBI[input_t]( +def test_native_group_norm_u55_INT(test_data): + pipeline = EthosU55PipelineINT[input_t]( test_data[1], test_data[0], "torch.ops.aten.sub.Tensor", # 'sub' op arbitrarily chosen to confirm groupnorm was decomposed @@ -133,8 +133,8 @@ def test_native_group_norm_u55_BI(test_data): strict=False, ) @common.XfailIfNoCorstone320 -def test_native_group_norm_u85_BI(test_data): - pipeline = EthosU85PipelineBI[input_t]( +def test_native_group_norm_u85_INT(test_data): + pipeline = EthosU85PipelineINT[input_t]( test_data[1], test_data[0], "torch.ops.aten.sub.Tensor", # 'sub' op arbitrarily chosen to confirm groupnorm was decomposed diff --git a/backends/arm/test/ops/test_gt.py b/backends/arm/test/ops/test_gt.py index 0a1b97928fd..76e18444185 100644 --- a/backends/arm/test/ops/test_gt.py +++ b/backends/arm/test/ops/test_gt.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -78,8 +78,8 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_gt_tensor_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_gt_tensor_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_tensor, @@ -89,8 +89,8 @@ def test_gt_tensor_tosa_MI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_gt_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_gt_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_scalar, @@ -100,8 +100,8 @@ def test_gt_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_gt_tensor_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_gt_tensor_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_tensor, @@ -111,8 +111,8 @@ def test_gt_tensor_tosa_BI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_gt_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_gt_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_tensor, @@ -123,7 +123,7 @@ def test_gt_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_gt_tensor_u55_BI(test_module): +def test_gt_tensor_u55_INT(test_module): # Greater is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -137,7 +137,7 @@ def test_gt_tensor_u55_BI(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_gt_scalar_u55_BI(test_module): +def test_gt_scalar_u55_INT(test_module): # Greater is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -158,8 +158,8 @@ def test_gt_scalar_u55_BI(test_module): }, ) @common.XfailIfNoCorstone320 -def test_gt_tensor_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_gt_tensor_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_tensor, @@ -177,8 +177,8 @@ def test_gt_tensor_u85_BI(test_module): }, ) @common.XfailIfNoCorstone320 -def test_gt_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_gt_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), Greater.aten_op_tensor, diff --git a/backends/arm/test/ops/test_hardsigmoid.py b/backends/arm/test/ops/test_hardsigmoid.py index 399c6088e89..6c928b4a37e 100644 --- a/backends/arm/test/ops/test_hardsigmoid.py +++ b/backends/arm/test/ops/test_hardsigmoid.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.hardsigmoid.default" @@ -40,8 +40,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_hardsigmoid_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_hardsigmoid_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Hardsigmoid(), (test_data(),), aten_op, @@ -51,8 +51,8 @@ def test_hardsigmoid_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_hardsigmoid_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_hardsigmoid_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Hardsigmoid(), (test_data(),), aten_op, @@ -63,8 +63,8 @@ def test_hardsigmoid_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_hardsigmoid_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_hardsigmoid_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Hardsigmoid(), (test_data(),), aten_op, @@ -77,8 +77,8 @@ def test_hardsigmoid_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_hardsigmoid_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_hardsigmoid_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Hardsigmoid(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_hardswish.py b/backends/arm/test/ops/test_hardswish.py index bd61346e3db..bfd559fc1d7 100644 --- a/backends/arm/test/ops/test_hardswish.py +++ b/backends/arm/test/ops/test_hardswish.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.hardswish.default" @@ -42,21 +42,21 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_hardswish_tosa_MI(test_data): - pipeline = TosaPipelineMI[input_t1](Hardswish(), (test_data(),), aten_op, exir_op) +def test_hardswish_tosa_FP(test_data): + pipeline = TosaPipelineFP[input_t1](Hardswish(), (test_data(),), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_hardswish_tosa_BI(test_data): - pipeline = TosaPipelineBI[input_t1](Hardswish(), (test_data(),), aten_op, exir_op) +def test_hardswish_tosa_INT(test_data): + pipeline = TosaPipelineINT[input_t1](Hardswish(), (test_data(),), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_hardswish_u55_BI(test_data): - EthosU55PipelineBI[input_t1]( +def test_hardswish_u55_INT(test_data): + EthosU55PipelineINT[input_t1]( Hardswish(), (test_data(),), aten_op, @@ -68,8 +68,8 @@ def test_hardswish_u55_BI(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_hardswish_u85_BI(test_data): - EthosU85PipelineBI[input_t1]( +def test_hardswish_u85_INT(test_data): + EthosU85PipelineINT[input_t1]( Hardswish(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_hardtanh.py b/backends/arm/test/ops/test_hardtanh.py index 5c8cfffbb2d..28f44c58a74 100644 --- a/backends/arm/test/ops/test_hardtanh.py +++ b/backends/arm/test/ops/test_hardtanh.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_data_suite = { @@ -46,14 +46,14 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_hardtanh_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t](HardTanh(), (test_data(),), aten_op, exir_op) +def test_hardtanh_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t](HardTanh(), (test_data(),), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_hardtanh_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t]( +def test_hardtanh_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t]( HardTanh(), (test_data(),), aten_op, @@ -64,8 +64,8 @@ def test_hardtanh_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_hardtanh_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t]( +def test_hardtanh_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t]( HardTanh(), (test_data(),), aten_op, @@ -77,8 +77,8 @@ def test_hardtanh_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_hardtanh_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t]( +def test_hardtanh_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t]( HardTanh(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_index_select.py b/backends/arm/test/ops/test_index_select.py index a3045e421aa..a3e655db0ce 100644 --- a/backends/arm/test/ops/test_index_select.py +++ b/backends/arm/test/ops/test_index_select.py @@ -10,8 +10,8 @@ import torch from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -78,19 +78,19 @@ def forward(self, input_: torch.Tensor, dim, index_: torch.Tensor): @pytest.mark.parametrize("test_data", list(test_data.values())) -def test_index_select_tosa_MI(test_data: input_params): +def test_index_select_tosa_FP(test_data: input_params): op, test_input = test_data - pipeline = TosaPipelineMI[input_params]( + pipeline = TosaPipelineFP[input_params]( op, test_input, op.aten_op, op.exir_op, use_to_edge_transform_and_lower=True ) pipeline.run() @pytest.mark.parametrize("test_data", list(test_data.values())[:-1]) -def test_index_select_tosa_BI(test_data: input_params): +def test_index_select_tosa_INT(test_data: input_params): op, test_input = test_data - pipeline = TosaPipelineBI[input_params]( + pipeline = TosaPipelineINT[input_params]( op, test_input, op.aten_op, @@ -101,10 +101,10 @@ def test_index_select_tosa_BI(test_data: input_params): @pytest.mark.parametrize("test_data", list(test_data.values())[-1:]) -def test_index_select_tosa_BI_rand(test_data: input_params): +def test_index_select_tosa_INT_rand(test_data: input_params): op, test_input = test_data - pipeline = TosaPipelineBI[input_params]( + pipeline = TosaPipelineINT[input_params]( op, test_input, op.aten_op, diff --git a/backends/arm/test/ops/test_index_tensor.py b/backends/arm/test/ops/test_index_tensor.py index f1f6f5171d8..37ed0e131a4 100644 --- a/backends/arm/test/ops/test_index_tensor.py +++ b/backends/arm/test/ops/test_index_tensor.py @@ -10,8 +10,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -102,11 +102,11 @@ def forward( "test_4d_ellipsis_middle": "Ellipsis before index unsupported", }, ) -def test_index_tensor_tosa_MI_ellipsis(test_data: input_params): +def test_index_tensor_tosa_FP_ellipsis(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineMI[input_params]( + TosaPipelineFP[input_params]( IndexTensor_Ellipsis(), test_input, IndexTensorTestCommon.aten_op, @@ -126,11 +126,11 @@ def test_index_tensor_tosa_MI_ellipsis(test_data: input_params): "test_4d_ellipsis_middle": "Ellipsis before index unsupported", }, ) -def test_index_tensor_tosa_BI_ellipsis(test_data: input_params): +def test_index_tensor_tosa_INT_ellipsis(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineBI[input_params]( + TosaPipelineINT[input_params]( IndexTensor_Ellipsis(), test_input, IndexTensorTestCommon.aten_op, @@ -216,11 +216,11 @@ def forward( "test_4d_slice_middle": "Slice before index unsupported", }, ) -def test_index_tensor_tosa_MI_slice(test_data: input_params_slice): +def test_index_tensor_tosa_FP_slice(test_data: input_params_slice): test_input = test_data with torch.no_grad(): ( - TosaPipelineMI[input_params_slice]( + TosaPipelineFP[input_params_slice]( IndexTensor_Slice(), test_input, IndexTensorTestCommon.aten_op, @@ -241,11 +241,11 @@ def test_index_tensor_tosa_MI_slice(test_data: input_params_slice): "test_4d_slice_middle": "Slice before index unsupported", }, ) -def test_index_tensor_tosa_BI_slice(test_data: input_params_slice): +def test_index_tensor_tosa_INT_slice(test_data: input_params_slice): test_input = test_data with torch.no_grad(): ( - TosaPipelineBI[input_params_slice]( + TosaPipelineINT[input_params_slice]( IndexTensor_Slice(), test_input, IndexTensorTestCommon.aten_op, @@ -383,11 +383,11 @@ def forward(self, input_: torch.Tensor, indices: Tuple[None | torch.Tensor]): @common.parametrize("test_data", IndexTensor.test_data) -def test_index_tensor_tosa_MI(test_data: input_params): +def test_index_tensor_tosa_FP(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineMI[input_params]( + TosaPipelineFP[input_params]( IndexTensor(), test_input, IndexTensorTestCommon.aten_op, @@ -399,11 +399,11 @@ def test_index_tensor_tosa_MI(test_data: input_params): @common.parametrize("test_data", IndexTensor.test_data) -def test_index_tensor_tosa_BI(test_data: input_params): +def test_index_tensor_tosa_INT(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineBI[input_params]( + TosaPipelineINT[input_params]( IndexTensor(), test_input, IndexTensorTestCommon.aten_op, @@ -423,11 +423,11 @@ def test_index_tensor_tosa_BI(test_data: input_params): "test_3d_3_idx_with_none_middle": "None (Unsqueeze) unsupported", }, ) -def test_index_tensor_tosa_MI_none(test_data: input_params): +def test_index_tensor_tosa_FP_none(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineMI[input_params]( + TosaPipelineFP[input_params]( IndexTensor(), test_input, IndexTensorTestCommon.aten_op, @@ -449,11 +449,11 @@ def test_index_tensor_tosa_MI_none(test_data: input_params): "test_3d_3_idx_with_none_middle": "None (Unsqueeze) unsupported", }, ) -def test_index_tensor_tosa_BI_none(test_data: input_params): +def test_index_tensor_tosa_INT_none(test_data: input_params): test_input = test_data with torch.no_grad(): ( - TosaPipelineBI[input_params]( + TosaPipelineINT[input_params]( IndexTensor(), test_input, IndexTensorTestCommon.aten_op, diff --git a/backends/arm/test/ops/test_layer_norm.py b/backends/arm/test/ops/test_layer_norm.py index 8d31ef992cb..fddfd6af2ee 100644 --- a/backends/arm/test/ops/test_layer_norm.py +++ b/backends/arm/test/ops/test_layer_norm.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -64,9 +64,9 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_native_layer_norm_tosa_MI(test_data): +def test_native_layer_norm_tosa_FP(test_data): test_data, model = test_data() - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( model, test_data, "torch.ops.aten.layer_norm.default", @@ -75,9 +75,9 @@ def test_native_layer_norm_tosa_MI(test_data): @common.parametrize("test_data", test_data_suite) -def test_native_layer_norm_tosa_BI(test_data): +def test_native_layer_norm_tosa_INT(test_data): test_data, model = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, test_data, "torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition @@ -88,9 +88,9 @@ def test_native_layer_norm_tosa_BI(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_native_layer_norm_u55_BI(test_data): +def test_native_layer_norm_u55_INT(test_data): test_data, model = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, test_data, "torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition @@ -102,9 +102,9 @@ def test_native_layer_norm_u55_BI(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_native_layer_norm_u85_BI(test_data): +def test_native_layer_norm_u85_INT(test_data): test_data, model = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, test_data, "torch.ops.aten.sub.Tensor", # Just check for sub op included in the layernorm decomposition diff --git a/backends/arm/test/ops/test_le.py b/backends/arm/test/ops/test_le.py index b48bad8248b..f5773713d9c 100644 --- a/backends/arm/test/ops/test_le.py +++ b/backends/arm/test/ops/test_le.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -78,8 +78,8 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_le_tensor_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_le_tensor_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_tensor, @@ -89,8 +89,8 @@ def test_le_tensor_tosa_MI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_le_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_le_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_scalar, @@ -100,8 +100,8 @@ def test_le_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_le_tensor_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_le_tensor_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_tensor, @@ -111,8 +111,8 @@ def test_le_tensor_tosa_BI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_le_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_le_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_tensor, @@ -123,7 +123,7 @@ def test_le_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_le_tensor_u55_BI_not_delegated(test_module): +def test_le_tensor_u55_INT_not_delegated(test_module): # GREATER_EQUAL is not supported on U55. LE uses the GREATER_EQUAL Tosa operator. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -137,7 +137,7 @@ def test_le_tensor_u55_BI_not_delegated(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_le_scalar_u55_BI_not_delegated(test_module): +def test_le_scalar_u55_INT_not_delegated(test_module): # GREATER_EQUAL is not supported on U55. LE uses the GREATER_EQUAL Tosa operator. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -159,8 +159,8 @@ def test_le_scalar_u55_BI_not_delegated(test_module): }, ) @common.XfailIfNoCorstone320 -def test_le_tensor_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_le_tensor_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_tensor, @@ -179,8 +179,8 @@ def test_le_tensor_u85_BI(test_module): }, ) @common.XfailIfNoCorstone320 -def test_le_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_le_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), LessEqual.aten_op_tensor, diff --git a/backends/arm/test/ops/test_leaky_relu.py b/backends/arm/test/ops/test_leaky_relu.py index a83c2812bf0..5be1a600150 100644 --- a/backends/arm/test/ops/test_leaky_relu.py +++ b/backends/arm/test/ops/test_leaky_relu.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.leaky_relu.default" @@ -37,9 +37,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", LeakyReLU.test_data) -def test_leaky_relu_tosa_MI(test_data): +def test_leaky_relu_tosa_FP(test_data): data, slope = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( LeakyReLU(slope), data, [], @@ -52,9 +52,9 @@ def test_leaky_relu_tosa_MI(test_data): @common.parametrize("test_data", LeakyReLU.test_data) -def test_leaky_relu_tosa_BI(test_data): +def test_leaky_relu_tosa_INT(test_data): data, slope = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( LeakyReLU(slope), data, [], @@ -66,9 +66,9 @@ def test_leaky_relu_tosa_BI(test_data): @common.parametrize("test_data", LeakyReLU.test_data) @common.XfailIfNoCorstone300 -def test_leaky_relu_u55_BI(test_data): +def test_leaky_relu_u55_INT(test_data): data, slope = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( LeakyReLU(slope), data, [], @@ -81,9 +81,9 @@ def test_leaky_relu_u55_BI(test_data): @common.parametrize("test_data", LeakyReLU.test_data) @common.XfailIfNoCorstone320 -def test_leaky_relu_u85_BI(test_data): +def test_leaky_relu_u85_INT(test_data): data, slope = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( LeakyReLU(slope), data, [], diff --git a/backends/arm/test/ops/test_linalg_vector_norm.py b/backends/arm/test/ops/test_linalg_vector_norm.py index 27e4bef97e6..8cd6c44ecab 100644 --- a/backends/arm/test/ops/test_linalg_vector_norm.py +++ b/backends/arm/test/ops/test_linalg_vector_norm.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] @@ -60,29 +60,29 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_module", test_modules) -def test_vector_norm_tosa_MI(test_module): +def test_vector_norm_tosa_FP(test_module): model, input_tensor = test_module # We decompose LinalgVectorNorm before quantize stage to have annotations - # with q/dq nodes. In case of MI, this operator will be decomposed + # with q/dq nodes. In case of FP, this operator will be decomposed # by global decompositions. aten_op = "torch.ops.aten.linalg_vector_norm.default" # Should not found this op exir_op = "executorch_exir_dialects_edge__ops_aten_linalg_vector_norm_default" - pipeline = TosaPipelineMI[input_t](model, input_tensor, aten_op, exir_op) + pipeline = TosaPipelineFP[input_t](model, input_tensor, aten_op, exir_op) pipeline.run() @common.parametrize("test_module", test_modules) -def test_vector_norm_tosa_BI(test_module): +def test_vector_norm_tosa_INT(test_module): model, input_tensor = test_module # Should not found this op exir_op = "executorch_exir_dialects_edge__ops_aten_linalg_vector_norm_default" - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( model, input_tensor, aten_op_q_decomposed_q, @@ -94,10 +94,10 @@ def test_vector_norm_tosa_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone300 -def test_vector_norm_u55_BI_fvp(test_module): +def test_vector_norm_u55_INT_fvp(test_module): model, input_tensor = test_module - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( model, input_tensor, aten_op_q_decomposed_q, @@ -111,11 +111,11 @@ def test_vector_norm_u55_BI_fvp(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone320 -def test_vector_norm_u85_BI_fvp(test_module): +def test_vector_norm_u85_INT_fvp(test_module): model, input_tensor = test_module # The should be decomposed and annotated in DecomposeLinalgVectorNorm pass. - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( model, input_tensor, aten_op_q_decomposed_q, diff --git a/backends/arm/test/ops/test_linear.py b/backends/arm/test/ops/test_linear.py index 14f65a07192..b35d108a8a3 100644 --- a/backends/arm/test/ops/test_linear.py +++ b/backends/arm/test/ops/test_linear.py @@ -14,17 +14,17 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.linear.default" input_t1 = Tuple[torch.Tensor] -test_data_rank1_MI = { +test_data_rank1_FP = { # test_name: (test_data, out_features, has_bias) "model_linear_rank1_zeros": lambda: ( torch.zeros(10), @@ -58,7 +58,7 @@ ), } -test_data_rank4_MI = { +test_data_rank4_FP = { # test_name: (test_data, out_features, has_bias) "model_linear_rank4_zeros": lambda: ( torch.zeros(5, 10, 25, 20), @@ -93,16 +93,16 @@ } # Generate a new test set paired with per_channel_quant=True/False. -test_data_rank1_BI = { +test_data_rank1_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (*v(), q)) - for (k, v) in test_data_rank1_MI.items() + for (k, v) in test_data_rank1_FP.items() for q in [True, False] } # Generate a new test set paired with per_channel_quant=True/False. -test_data_rank4_BI = { +test_data_rank4_INT = { f"{k},per_channel_quant={q}": (lambda v=v, q=q: (*v(), q)) - for (k, v) in test_data_rank4_MI.items() + for (k, v) in test_data_rank4_FP.items() for q in [True, False] } @@ -125,11 +125,11 @@ def forward(self, x): return self.fc(x) -@common.parametrize("test_data", test_data_rank1_MI | test_data_rank4_MI) -def test_linear_tosa_MI(test_data: torch.Tensor): +@common.parametrize("test_data", test_data_rank1_FP | test_data_rank4_FP) +def test_linear_tosa_FP(test_data: torch.Tensor): test_data, out_features, has_bias = test_data() in_features = test_data.shape[-1] - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Linear( in_features=in_features, out_features=out_features, @@ -143,11 +143,11 @@ def test_linear_tosa_MI(test_data: torch.Tensor): @pytest.mark.flaky(reruns=5) # TODO: Investigate flakyness. -@common.parametrize("test_data", test_data_rank1_BI | test_data_rank4_BI) -def test_linear_tosa_BI(test_data: torch.Tensor): +@common.parametrize("test_data", test_data_rank1_INT | test_data_rank4_INT) +def test_linear_tosa_INT(test_data: torch.Tensor): test_data, out_features, has_bias, per_channel_quantization = test_data() in_features = test_data.shape[-1] - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Linear( in_features=in_features, out_features=out_features, @@ -162,12 +162,12 @@ def test_linear_tosa_BI(test_data: torch.Tensor): pipeline.run() -@common.parametrize("test_data", test_data_rank1_BI) +@common.parametrize("test_data", test_data_rank1_INT) @common.XfailIfNoCorstone300 -def test_linear_u55_BI(test_data: torch.Tensor): +def test_linear_u55_INT(test_data: torch.Tensor): test_data, out_features, has_bias, per_channel_quantization = test_data() in_features = test_data.shape[-1] - EthosU55PipelineBI[input_t1]( + EthosU55PipelineINT[input_t1]( Linear( in_features=in_features, out_features=out_features, @@ -198,14 +198,14 @@ def test_linear_u55_BI(test_data: torch.Tensor): @common.parametrize( "test_data", - test_data_rank1_BI | test_data_rank4_BI, + test_data_rank1_INT | test_data_rank4_INT, x_fail, ) @common.XfailIfNoCorstone320 -def test_linear_u85_BI(test_data: torch.Tensor): +def test_linear_u85_INT(test_data: torch.Tensor): test_data, out_features, has_bias, per_channel_quantization = test_data() in_features = test_data.shape[-1] - EthosU85PipelineBI[input_t1]( + EthosU85PipelineINT[input_t1]( Linear( in_features=in_features, out_features=out_features, diff --git a/backends/arm/test/ops/test_log.py b/backends/arm/test/ops/test_log.py index 0ca4510681d..d24052c8793 100644 --- a/backends/arm/test/ops/test_log.py +++ b/backends/arm/test/ops/test_log.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.log.default" @@ -40,21 +40,21 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", test_data_suite) -def test_log_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](Log(), (test_data(),), aten_op, exir_op) +def test_log_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](Log(), (test_data(),), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_log_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Log(), (test_data(),), aten_op, exir_op) +def test_log_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1](Log(), (test_data(),), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_log_u55_BI(test_data: input_t1): - EthosU55PipelineBI[input_t1]( +def test_log_u55_INT(test_data: input_t1): + EthosU55PipelineINT[input_t1]( Log(), (test_data(),), aten_op, @@ -65,8 +65,8 @@ def test_log_u55_BI(test_data: input_t1): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_log_u85_BI(test_data: input_t1): - EthosU85PipelineBI[input_t1]( +def test_log_u85_INT(test_data: input_t1): + EthosU85PipelineINT[input_t1]( Log(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_logical.py b/backends/arm/test/ops/test_logical.py index 1a056e31b3c..de90077d71f 100644 --- a/backends/arm/test/ops/test_logical.py +++ b/backends/arm/test/ops/test_logical.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -81,8 +81,8 @@ def forward(self, tensor: torch.Tensor): @common.parametrize("test_data", And().test_data) -def test_logical_and_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_logical_and_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( And(), test_data(), And().aten_op, @@ -95,8 +95,8 @@ def test_logical_and_tosa_MI(test_data: input_t2): @common.parametrize("test_data", And().test_data) -def test_logical_and_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_logical_and_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( And(), test_data(), And().aten_op, @@ -111,7 +111,7 @@ def test_logical_and_tosa_BI(test_data: input_t2): @common.parametrize("test_data", And().test_data) -def test_logical_and_u55_BI_not_delegated(test_data: input_t2): +def test_logical_and_u55_INT_not_delegated(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( And(), @@ -125,8 +125,8 @@ def test_logical_and_u55_BI_not_delegated(test_data: input_t2): @common.parametrize("test_data", And().test_data) @common.XfailIfNoCorstone320 -def test_logical_and_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_logical_and_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( And(), test_data(), And().aten_op, @@ -142,8 +142,8 @@ def test_logical_and_u85_BI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_logical_xor_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_logical_xor_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -156,8 +156,8 @@ def test_logical_xor_tosa_MI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_logical_xor_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_logical_xor_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -172,7 +172,7 @@ def test_logical_xor_tosa_BI(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) -def test_logical_xor_u55_BI_not_delegated(test_data: input_t2): +def test_logical_xor_u55_INT_not_delegated(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( Xor(), @@ -186,8 +186,8 @@ def test_logical_xor_u55_BI_not_delegated(test_data: input_t2): @common.parametrize("test_data", Xor().test_data) @common.XfailIfNoCorstone320 -def test_logical_xor_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_logical_xor_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Xor(), test_data(), Xor().aten_op, @@ -203,8 +203,8 @@ def test_logical_xor_u85_BI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_logical_or_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_logical_or_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( Or(), test_data(), Or().aten_op, @@ -217,8 +217,8 @@ def test_logical_or_tosa_MI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_logical_or_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_logical_or_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( Or(), test_data(), Or().aten_op, @@ -233,7 +233,7 @@ def test_logical_or_tosa_BI(test_data: input_t2): @common.parametrize("test_data", Or().test_data) -def test_logical_or_u55_BI_not_delegated(test_data: input_t2): +def test_logical_or_u55_INT_not_delegated(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( Or(), @@ -247,8 +247,8 @@ def test_logical_or_u55_BI_not_delegated(test_data: input_t2): @common.parametrize("test_data", Or().test_data) @common.XfailIfNoCorstone320 -def test_logical_or_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_logical_or_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Or(), test_data(), Or().aten_op, @@ -264,8 +264,8 @@ def test_logical_or_u85_BI(test_data: input_t2): @common.parametrize("test_data", Not().test_data) -def test_logical_not_tosa_MI(test_data: input_t2): - pipeline = TosaPipelineMI[input_t2]( +def test_logical_not_tosa_FP(test_data: input_t2): + pipeline = TosaPipelineFP[input_t2]( Not(), test_data(), Not().aten_op, @@ -278,8 +278,8 @@ def test_logical_not_tosa_MI(test_data: input_t2): @common.parametrize("test_data", Not().test_data) -def test_logical_not_tosa_BI(test_data: input_t2): - pipeline = TosaPipelineBI[input_t2]( +def test_logical_not_tosa_INT(test_data: input_t2): + pipeline = TosaPipelineINT[input_t2]( Not(), test_data(), Not().aten_op, @@ -294,7 +294,7 @@ def test_logical_not_tosa_BI(test_data: input_t2): @common.parametrize("test_data", Not().test_data) -def test_logical_not_u55_BI_not_delegated(test_data: input_t2): +def test_logical_not_u55_INT_not_delegated(test_data: input_t2): # Tests that we don't delegate these ops since they are not supported on U55. pipeline = OpNotSupportedPipeline[input_t2]( Not(), @@ -308,8 +308,8 @@ def test_logical_not_u55_BI_not_delegated(test_data: input_t2): @common.parametrize("test_data", Not().test_data) @common.XfailIfNoCorstone320 -def test_logical_not_u85_BI(test_data: input_t2): - pipeline = EthosU85PipelineBI[input_t2]( +def test_logical_not_u85_INT(test_data: input_t2): + pipeline = EthosU85PipelineINT[input_t2]( Not(), test_data(), Not().aten_op, diff --git a/backends/arm/test/ops/test_logsoftmax.py b/backends/arm/test/ops/test_logsoftmax.py index 50132ba8211..27106bc40cc 100644 --- a/backends/arm/test/ops/test_logsoftmax.py +++ b/backends/arm/test/ops/test_logsoftmax.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.log_softmax.default" # Used for checking that we do not have log_softmax in the graph @@ -43,9 +43,9 @@ def forward(self, x): @common.parametrize("test_data", LogSoftmax.test_data) -def test_log_softmax_tosa_MI(test_data): +def test_log_softmax_tosa_FP(test_data): data, dim = test_data() - pipeline = TosaPipelineMI[input_t1](LogSoftmax(dim), data, []) + pipeline = TosaPipelineFP[input_t1](LogSoftmax(dim), data, []) pipeline.add_stage_after( "to_edge_transform_and_lower", pipeline.tester.check_not, [exir_op] ) @@ -55,9 +55,9 @@ def test_log_softmax_tosa_MI(test_data): @pytest.mark.flaky(reruns=5) @common.parametrize("test_data", LogSoftmax.test_data) -def test_log_softmax_tosa_BI(test_data): +def test_log_softmax_tosa_INT(test_data): data, dim = test_data() - pipeline = TosaPipelineBI[input_t1](LogSoftmax(dim), data, []) + pipeline = TosaPipelineINT[input_t1](LogSoftmax(dim), data, []) pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op]) pipeline.change_args("run_method_and_compare_outputs", qtol=1) pipeline.run() @@ -71,9 +71,9 @@ def test_log_softmax_tosa_BI(test_data): }, ) @common.XfailIfNoCorstone300() -def test_log_softmax_u55_BI(test_data): +def test_log_softmax_u55_INT(test_data): data, dim = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( LogSoftmax(dim), data, [], @@ -92,9 +92,9 @@ def test_log_softmax_u55_BI(test_data): }, ) @common.XfailIfNoCorstone320 -def test_log_softmax_u85_BI(test_data): +def test_log_softmax_u85_INT(test_data): data, dim = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( LogSoftmax(dim), data, [], diff --git a/backends/arm/test/ops/test_lshift.py b/backends/arm/test/ops/test_lshift.py index e74e80deeed..6bd2a9202cd 100644 --- a/backends/arm/test/ops/test_lshift.py +++ b/backends/arm/test/ops/test_lshift.py @@ -10,18 +10,18 @@ XfailIfNoCorstone320, ) from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) scalar_input_t = tuple[torch.Tensor, int] class LshiftScalar(torch.nn.Module): - torch_op_MI = "torch.ops.aten.__lshift__.Scalar" - torch_op_BI = "torch.ops.aten.bitwise_left_shift.Tensor" + torch_op_FP = "torch.ops.aten.__lshift__.Scalar" + torch_op_INT = "torch.ops.aten.bitwise_left_shift.Tensor" exir_op = "executorch_exir_dialects_edge__ops_aten_bitwise_left_shift_Tensor" test_data = { "randint_neg_8_int8": ( @@ -68,21 +68,21 @@ def forward(self, x: torch.Tensor, shift: torch.Tensor): @common.parametrize("test_data", LshiftScalar.test_data) -def test_lshift_scalar_tosa_MI_scalar(test_data): - TosaPipelineMI[scalar_input_t]( +def test_lshift_scalar_tosa_FP_scalar(test_data): + TosaPipelineFP[scalar_input_t]( LshiftScalar(), test_data, - LshiftScalar.torch_op_MI, + LshiftScalar.torch_op_FP, LshiftScalar.exir_op, ).run() @common.parametrize("test_data", LshiftScalar.test_data) -def test_bitwise_left_shift_tensor_tosa_BI_scalar(test_data): - pipeline = TosaPipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_tosa_INT_scalar(test_data): + pipeline = TosaPipelineINT[scalar_input_t]( LshiftScalar(), test_data, - LshiftScalar.torch_op_BI, + LshiftScalar.torch_op_INT, LshiftScalar.exir_op, ) pipeline.pop_stage("check.quant_nodes") @@ -91,11 +91,11 @@ def test_bitwise_left_shift_tensor_tosa_BI_scalar(test_data): @common.parametrize("test_data", LshiftScalar.test_data) @XfailIfNoCorstone300 -def test_bitwise_left_shift_tensor_u55_BI_scalar(test_data): - pipeline = EthosU55PipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_u55_INT_scalar(test_data): + pipeline = EthosU55PipelineINT[scalar_input_t]( LshiftScalar(), test_data, - LshiftScalar.torch_op_BI, + LshiftScalar.torch_op_INT, LshiftScalar.exir_op, run_on_fvp=True, ) @@ -105,11 +105,11 @@ def test_bitwise_left_shift_tensor_u55_BI_scalar(test_data): @common.parametrize("test_data", LshiftScalar.test_data) @XfailIfNoCorstone320 -def test_bitwise_left_shift_tensor_u85_BI_scalar(test_data): - pipeline = EthosU85PipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_u85_INT_scalar(test_data): + pipeline = EthosU85PipelineINT[scalar_input_t]( LshiftScalar(), test_data, - LshiftScalar.torch_op_BI, + LshiftScalar.torch_op_INT, LshiftScalar.exir_op, run_on_fvp=True, ) @@ -118,8 +118,8 @@ def test_bitwise_left_shift_tensor_u85_BI_scalar(test_data): @common.parametrize("test_data", LshiftTensor.test_data) -def test_lshift_scalar_tosa_MI(test_data): - TosaPipelineMI[scalar_input_t]( +def test_lshift_scalar_tosa_FP(test_data): + TosaPipelineFP[scalar_input_t]( LshiftTensor(), test_data, LshiftTensor.torch_op, @@ -128,8 +128,8 @@ def test_lshift_scalar_tosa_MI(test_data): @common.parametrize("test_data", LshiftTensor.test_data) -def test_bitwise_left_shift_tensor_tosa_BI(test_data): - pipeline = TosaPipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_tosa_INT(test_data): + pipeline = TosaPipelineINT[scalar_input_t]( LshiftTensor(), test_data, LshiftTensor.torch_op, @@ -141,8 +141,8 @@ def test_bitwise_left_shift_tensor_tosa_BI(test_data): @common.parametrize("test_data", LshiftTensor.test_data) @XfailIfNoCorstone300 -def test_bitwise_left_shift_tensor_u55_BI(test_data): - pipeline = EthosU55PipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_u55_INT(test_data): + pipeline = EthosU55PipelineINT[scalar_input_t]( LshiftTensor(), test_data, LshiftTensor.torch_op, @@ -155,8 +155,8 @@ def test_bitwise_left_shift_tensor_u55_BI(test_data): @common.parametrize("test_data", LshiftTensor.test_data) @XfailIfNoCorstone320 -def test_bitwise_left_shift_tensor_u85_BI(test_data): - pipeline = EthosU85PipelineBI[scalar_input_t]( +def test_bitwise_left_shift_tensor_u85_INT(test_data): + pipeline = EthosU85PipelineINT[scalar_input_t]( LshiftTensor(), test_data, LshiftTensor.torch_op, diff --git a/backends/arm/test/ops/test_lt.py b/backends/arm/test/ops/test_lt.py index 92298ca70fa..3193ef83e65 100644 --- a/backends/arm/test/ops/test_lt.py +++ b/backends/arm/test/ops/test_lt.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -78,8 +78,8 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_lt_tensor_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_lt_tensor_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_tensor, @@ -89,8 +89,8 @@ def test_lt_tensor_tosa_MI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_lt_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_lt_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_scalar, @@ -100,8 +100,8 @@ def test_lt_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_lt_tensor_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_lt_tensor_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_tensor, @@ -111,8 +111,8 @@ def test_lt_tensor_tosa_BI(test_module): @common.parametrize("test_module", test_data_scalar) -def test_lt_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_lt_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_tensor, @@ -123,7 +123,7 @@ def test_lt_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_lt_tensor_u55_BI_not_delegated(test_module): +def test_lt_tensor_u55_INT_not_delegated(test_module): # LessThan is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -137,7 +137,7 @@ def test_lt_tensor_u55_BI_not_delegated(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_lt_scalar_u55_BI_not_delegated(test_module): +def test_lt_scalar_u55_INT_not_delegated(test_module): # LessThan is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module(), @@ -158,8 +158,8 @@ def test_lt_scalar_u55_BI_not_delegated(test_module): }, ) @common.XfailIfNoCorstone320 -def test_lt_tensor_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_lt_tensor_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_tensor, @@ -177,8 +177,8 @@ def test_lt_tensor_u85_BI(test_module): }, ) @common.XfailIfNoCorstone320 -def test_lt_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_lt_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), LessThan.aten_op_tensor, diff --git a/backends/arm/test/ops/test_masked_fill.py b/backends/arm/test/ops/test_masked_fill.py index bfd5c8857c7..80c0c4b0d8e 100644 --- a/backends/arm/test/ops/test_masked_fill.py +++ b/backends/arm/test/ops/test_masked_fill.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -99,16 +99,16 @@ def forward( @common.parametrize("test_module", test_modules) -def test_masked_fill_scalar_tosa_MI(test_module): +def test_masked_fill_scalar_tosa_FP(test_module): module, inputs = test_module() - pipeline = TosaPipelineMI[input_t](module, inputs, aten_op=[]) + pipeline = TosaPipelineFP[input_t](module, inputs, aten_op=[]) pipeline.run() @common.parametrize("test_module", test_modules) -def test_masked_fill_scalar_tosa_BI(test_module): +def test_masked_fill_scalar_tosa_INT(test_module): module, inputs = test_module() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, inputs, aten_op=[], @@ -118,7 +118,7 @@ def test_masked_fill_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone300 -def test_masked_fill_scalar_u55_BI(test_module): +def test_masked_fill_scalar_u55_INT(test_module): module, inputs = test_module() pipeline = OpNotSupportedPipeline[input_t]( module, @@ -133,9 +133,9 @@ def test_masked_fill_scalar_u55_BI(test_module): @common.parametrize("test_module", test_modules) @common.XfailIfNoCorstone320 -def test_masked_fill_scalar_u85_BI(test_module): +def test_masked_fill_scalar_u85_INT(test_module): module, inputs = test_module() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( module, inputs, aten_ops=[], diff --git a/backends/arm/test/ops/test_matmul.py b/backends/arm/test/ops/test_matmul.py index 11a4786c4af..17356f98420 100644 --- a/backends/arm/test/ops/test_matmul.py +++ b/backends/arm/test/ops/test_matmul.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op_mm = "torch.ops.aten.matmul.default" @@ -60,38 +60,38 @@ def forward(self, x1: torch.Tensor, x2: torch.Tensor, x3: torch.Tensor): @common.parametrize("test_data", MatMul.test_data_generators) -def test_matmul_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](MatMul(), test_data(), aten_op_mm, exir_op_mm) +def test_matmul_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](MatMul(), test_data(), aten_op_mm, exir_op_mm) pipeline.run() @common.parametrize("test_data", MatMulSingleInput.test_data_generators) -def test_matmul_single_input_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_matmul_single_input_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( MatMulSingleInput(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", MatMulCombo.test_data_generators) -def test_matmul_combo_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_matmul_combo_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( MatMulCombo(), test_data(), aten_op_mm, exir_op_mm ) pipeline.run() @common.parametrize("test_data", MatMul.test_data_generators) -def test_matmul_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_matmul_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( MatMul(), test_data(), aten_op_mm, exir_op_mm, qtol=1 ) pipeline.run() @common.parametrize("test_data", MatMulSingleInput.test_data_generators) -def test_matmul_single_input_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_matmul_single_input_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( MatMulSingleInput(), test_data(), aten_op_mm, @@ -102,8 +102,8 @@ def test_matmul_single_input_tosa_BI(test_data: input_t1): @common.parametrize("test_data", MatMulCombo.test_data_generators) -def test_matmul_combo_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_matmul_combo_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( MatMulCombo(), test_data(), aten_op_mm, @@ -115,8 +115,8 @@ def test_matmul_combo_tosa_BI(test_data: input_t1): @common.parametrize("test_data", MatMul.test_data_generators) @common.XfailIfNoCorstone300 -def test_matmul_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_matmul_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( MatMul(), test_data(), aten_op_mm, @@ -129,8 +129,8 @@ def test_matmul_u55_BI(test_data: input_t1): @common.parametrize("test_data", MatMulSingleInput.test_data_generators) @common.XfailIfNoCorstone300 -def test_matmul_single_input_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_matmul_single_input_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( MatMulSingleInput(), test_data(), aten_op_mm, @@ -143,8 +143,8 @@ def test_matmul_single_input_u55_BI(test_data: input_t1): @common.parametrize("test_data", MatMulCombo.test_data_generators) @common.XfailIfNoCorstone300 -def test_matmul_combo_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_matmul_combo_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( MatMulCombo(), test_data(), aten_op_mm, @@ -157,8 +157,8 @@ def test_matmul_combo_u55_BI(test_data: input_t1): @common.parametrize("test_data", MatMul.test_data_generators) @common.XfailIfNoCorstone320 -def test_matmul_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_matmul_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( MatMul(), test_data(), aten_op_mm, @@ -171,8 +171,8 @@ def test_matmul_u85_BI(test_data: input_t1): @common.parametrize("test_data", MatMulSingleInput.test_data_generators) @common.XfailIfNoCorstone320 -def test_matmul_single_input_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_matmul_single_input_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( MatMulSingleInput(), test_data(), aten_op_mm, @@ -185,8 +185,8 @@ def test_matmul_single_input_u85_BI(test_data: input_t1): @common.parametrize("test_data", MatMulCombo.test_data_generators) @common.XfailIfNoCorstone320 -def test_matmul_combo_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_matmul_combo_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( MatMulCombo(), test_data(), aten_op_mm, diff --git a/backends/arm/test/ops/test_max_pool.py b/backends/arm/test/ops/test_max_pool.py index b2aa263de39..488dda145d0 100644 --- a/backends/arm/test/ops/test_max_pool.py +++ b/backends/arm/test/ops/test_max_pool.py @@ -13,10 +13,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_data_suite = { @@ -114,18 +114,18 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_max_pool2d_tosa_MI(test_data: torch.Tensor): +def test_max_pool2d_tosa_FP(test_data: torch.Tensor): test_data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, exir_op ) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_max_pool2d_tosa_BI(test_data: torch.Tensor): +def test_max_pool2d_tosa_INT(test_data: torch.Tensor): test_data, model_params = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -136,9 +136,9 @@ def test_max_pool2d_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_max_pool2d_u55_BI(test_data: torch.Tensor): +def test_max_pool2d_u55_INT(test_data: torch.Tensor): test_data, model_params = test_data() - EthosU55PipelineBI[input_t1]( + EthosU55PipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -149,9 +149,9 @@ def test_max_pool2d_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_max_pool2d_u85_BI(test_data: torch.Tensor): +def test_max_pool2d_u85_INT(test_data: torch.Tensor): test_data, model_params = test_data() - EthosU85PipelineBI[input_t1]( + EthosU85PipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -161,9 +161,9 @@ def test_max_pool2d_u85_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_mult_batches) -def test_max_pool2d_tosa_MI_mult_batches(test_data: torch.Tensor): +def test_max_pool2d_tosa_FP_mult_batches(test_data: torch.Tensor): test_data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -173,9 +173,9 @@ def test_max_pool2d_tosa_MI_mult_batches(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_mult_batches) -def test_max_pool2d_tosa_BI_mult_batches(test_data: torch.Tensor): +def test_max_pool2d_tosa_INT_mult_batches(test_data: torch.Tensor): test_data, model_params = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -189,9 +189,9 @@ def test_max_pool2d_tosa_BI_mult_batches(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_mult_batches, x_fail) @common.XfailIfNoCorstone300 -def test_max_pool2d_u55_BI_mult_batches(test_data: torch.Tensor): +def test_max_pool2d_u55_INT_mult_batches(test_data: torch.Tensor): test_data, model_params = test_data() - EthosU55PipelineBI[input_t1]( + EthosU55PipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -203,9 +203,9 @@ def test_max_pool2d_u55_BI_mult_batches(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_mult_batches, x_fail) @common.XfailIfNoCorstone320 -def test_max_pool2d_u85_BI_mult_batches(test_data: torch.Tensor): +def test_max_pool2d_u85_INT_mult_batches(test_data: torch.Tensor): test_data, model_params = test_data() - EthosU85PipelineBI[input_t1]( + EthosU85PipelineINT[input_t1]( MaxPool2d(*model_params), (test_data,), aten_op, @@ -224,9 +224,9 @@ def test_max_pool2d_u85_BI_mult_batches(test_data: torch.Tensor): @common.parametrize("test_data", reject_data_suite) @common.XfailIfNoCorstone300 -def test_max_pool2d_u55_BI_failure_set(test_data: Tuple): +def test_max_pool2d_u55_INT_failure_set(test_data: Tuple): module, test_data = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( module, (test_data,), aten_op, @@ -246,12 +246,12 @@ def test_max_pool2d_u55_BI_failure_set(test_data: Tuple): @common.parametrize("test_data", dilation_test_data) -def test_max_pool2d_tosa_MI_dilation(test_data): +def test_max_pool2d_tosa_FP_dilation(test_data): """ - TOSA MI pipeline with dilation > 1 (and dilation=1 sanity cases). + TOSA FP pipeline with dilation > 1 (and dilation=1 sanity cases). """ data, model_params = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( MaxPool2d(*model_params), (data,), aten_op, @@ -261,12 +261,12 @@ def test_max_pool2d_tosa_MI_dilation(test_data): @common.parametrize("test_data", dilation_test_data) -def test_max_pool2d_tosa_BI_dilation(test_data): +def test_max_pool2d_tosa_INT_dilation(test_data): """ - TOSA BI pipeline with dilation > 1 (and dilation=1 sanity cases). + TOSA INT pipeline with dilation > 1 (and dilation=1 sanity cases). """ data, model_params = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( MaxPool2d(*model_params), (data,), aten_op, diff --git a/backends/arm/test/ops/test_maximum.py b/backends/arm/test/ops/test_maximum.py index adcc7dc9cab..5b7dd7fb520 100644 --- a/backends/arm/test/ops/test_maximum.py +++ b/backends/arm/test/ops/test_maximum.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_t = tuple[torch.Tensor, torch.Tensor] @@ -44,19 +44,19 @@ def forward(self, x, y): @common.parametrize("test_data", Maximum.test_parameters) -def test_maximum_tosa_MI(test_data: Tuple): - TosaPipelineMI[test_t](Maximum(), test_data(), aten_op).run() +def test_maximum_tosa_FP(test_data: Tuple): + TosaPipelineFP[test_t](Maximum(), test_data(), aten_op).run() @common.parametrize("test_data", Maximum.test_parameters) -def test_maximum_tosa_BI(test_data: Tuple): - TosaPipelineBI[test_t](Maximum(), test_data(), aten_op).run() +def test_maximum_tosa_INT(test_data: Tuple): + TosaPipelineINT[test_t](Maximum(), test_data(), aten_op).run() @common.parametrize("test_data", Maximum.test_parameters) @common.XfailIfNoCorstone300 -def test_maximum_u55_BI(test_data: Tuple): - EthosU55PipelineBI[test_t]( +def test_maximum_u55_INT(test_data: Tuple): + EthosU55PipelineINT[test_t]( Maximum(), test_data(), aten_op, @@ -66,8 +66,8 @@ def test_maximum_u55_BI(test_data: Tuple): @common.parametrize("test_data", Maximum.test_parameters) @common.XfailIfNoCorstone320 -def test_maximum_u85_BI(test_data: Tuple): - EthosU85PipelineBI[test_t]( +def test_maximum_u85_INT(test_data: Tuple): + EthosU85PipelineINT[test_t]( Maximum(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_mean_dim.py b/backends/arm/test/ops/test_mean_dim.py index 6803ec44a12..2685c047222 100644 --- a/backends/arm/test/ops/test_mean_dim.py +++ b/backends/arm/test/ops/test_mean_dim.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -37,8 +37,8 @@ def forward(self, x): @common.parametrize("test_data", AdaptiveAveragePool2d.test_data_suite) -def test_adaptive_avg_pool2d_tosa_MI(test_data): - TosaPipelineMI[input_t]( +def test_adaptive_avg_pool2d_tosa_FP(test_data): + TosaPipelineFP[input_t]( AdaptiveAveragePool2d(), test_data(), AdaptiveAveragePool2d.aten_op, @@ -47,8 +47,8 @@ def test_adaptive_avg_pool2d_tosa_MI(test_data): @common.parametrize("test_data", AdaptiveAveragePool2d.test_data_suite) -def test_adaptive_avg_pool2d_tosa_BI(test_data): - TosaPipelineBI[input_t]( +def test_adaptive_avg_pool2d_tosa_INT(test_data): + TosaPipelineINT[input_t]( AdaptiveAveragePool2d(), test_data(), AdaptiveAveragePool2d.aten_op, @@ -59,8 +59,8 @@ def test_adaptive_avg_pool2d_tosa_BI(test_data): @common.parametrize("test_data", AdaptiveAveragePool2d.test_data_suite) @common.XfailIfNoCorstone300 -def test_adaptive_avg_pool2d_u55_BI(test_data): - EthosU55PipelineBI[input_t]( +def test_adaptive_avg_pool2d_u55_INT(test_data): + EthosU55PipelineINT[input_t]( AdaptiveAveragePool2d(), test_data(), AdaptiveAveragePool2d.aten_op, @@ -72,8 +72,8 @@ def test_adaptive_avg_pool2d_u55_BI(test_data): @common.parametrize("test_data", AdaptiveAveragePool2d.test_data_suite) @common.XfailIfNoCorstone320 -def test_adaptive_avg_pool2d_u85_BI(test_data): - EthosU85PipelineBI[input_t]( +def test_adaptive_avg_pool2d_u85_INT(test_data): + EthosU85PipelineINT[input_t]( AdaptiveAveragePool2d(), test_data(), AdaptiveAveragePool2d.aten_op, @@ -234,9 +234,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", MeanDim.test_data_suite) -def test_mean_dim_tosa_MI(test_data): +def test_mean_dim_tosa_FP(test_data): test_data, dim, keep_dim = test_data() - TosaPipelineMI[input_t]( + TosaPipelineFP[input_t]( MeanDim(dim, keep_dim), (test_data,), MeanDim.torch_op, @@ -245,9 +245,9 @@ def test_mean_dim_tosa_MI(test_data): @common.parametrize("test_data", MeanDim.test_data_suite) -def test_mean_dim_tosa_BI(test_data): +def test_mean_dim_tosa_INT(test_data): test_data, dim, keep_dim = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( MeanDim(dim, keep_dim), (test_data,), [], # Might be sum, avgpool, or both @@ -266,9 +266,9 @@ def test_mean_dim_tosa_BI(test_data): @common.parametrize("test_data", MeanDim.test_data_suite, xfails=xfails, strict=False) @common.XfailIfNoCorstone300 -def test_mean_dim_u55_BI(test_data): +def test_mean_dim_u55_INT(test_data): test_data, dim, keep_dim = test_data() - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( MeanDim(dim, keep_dim), (test_data,), [], # Might be sum, avgpool, or both @@ -286,9 +286,9 @@ def test_mean_dim_u55_BI(test_data): @common.parametrize("test_data", MeanDim.test_data_suite, xfails=xfails, strict=False) @common.XfailIfNoCorstone320 -def test_mean_dim_u85_BI(test_data): +def test_mean_dim_u85_INT(test_data): test_data, dim, keep_dim = test_data() - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( MeanDim(dim, keep_dim), (test_data,), [], # Might be sum, avgpool, or both diff --git a/backends/arm/test/ops/test_minimum.py b/backends/arm/test/ops/test_minimum.py index 27922cda5e0..273dee31adc 100644 --- a/backends/arm/test/ops/test_minimum.py +++ b/backends/arm/test/ops/test_minimum.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_t = tuple[torch.Tensor, torch.Tensor] @@ -44,19 +44,19 @@ def forward(self, x, y): @common.parametrize("test_data", Minimum.test_parameters) -def test_minimum_tosa_MI(test_data: Tuple): - TosaPipelineMI[test_t](Minimum(), test_data(), aten_op).run() +def test_minimum_tosa_FP(test_data: Tuple): + TosaPipelineFP[test_t](Minimum(), test_data(), aten_op).run() @common.parametrize("test_data", Minimum.test_parameters) -def test_minimum_tosa_BI(test_data: Tuple): - TosaPipelineBI[test_t](Minimum(), test_data(), aten_op).run() +def test_minimum_tosa_INT(test_data: Tuple): + TosaPipelineINT[test_t](Minimum(), test_data(), aten_op).run() @common.parametrize("test_data", Minimum.test_parameters) @common.XfailIfNoCorstone300 -def test_minimum_u55_BI(test_data: Tuple): - EthosU55PipelineBI[test_t]( +def test_minimum_u55_INT(test_data: Tuple): + EthosU55PipelineINT[test_t]( Minimum(), test_data(), aten_op, @@ -66,8 +66,8 @@ def test_minimum_u55_BI(test_data: Tuple): @common.parametrize("test_data", Minimum.test_parameters) @common.XfailIfNoCorstone320 -def test_minimum_u85_BI(test_data: Tuple): - EthosU85PipelineBI[test_t]( +def test_minimum_u85_INT(test_data: Tuple): + EthosU85PipelineINT[test_t]( Minimum(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_mm.py b/backends/arm/test/ops/test_mm.py index 9c3ce443bfd..6a73ca3db59 100644 --- a/backends/arm/test/ops/test_mm.py +++ b/backends/arm/test/ops/test_mm.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) test_t = tuple[torch.Tensor, torch.Tensor] @@ -35,20 +35,20 @@ def forward(self, x, y): @common.parametrize("test_data", MM.test_data_generators) -def test_mm_tosa_MI(test_data: Tuple): - TosaPipelineMI[test_t](MM(), test_data(), MM.aten_op).run() +def test_mm_tosa_FP(test_data: Tuple): + TosaPipelineFP[test_t](MM(), test_data(), MM.aten_op).run() @common.parametrize("test_data", MM.test_data_generators) -def test_mm_tosa_BI(test_data: Tuple): - TosaPipelineBI[test_t](MM(), test_data(), MM.aten_op, MM.exir_op, qtol=1).run() +def test_mm_tosa_INT(test_data: Tuple): + TosaPipelineINT[test_t](MM(), test_data(), MM.aten_op, MM.exir_op, qtol=1).run() @common.parametrize("test_data", MM.test_data_generators) @common.XfailIfNoCorstone300 @pytest.mark.flaky # Investigate flakiness (MLETORCH-870) -def test_mm_u55_BI(test_data: Tuple): - EthosU55PipelineBI[test_t]( +def test_mm_u55_INT(test_data: Tuple): + EthosU55PipelineINT[test_t]( MM(), test_data(), MM.aten_op, @@ -58,8 +58,8 @@ def test_mm_u55_BI(test_data: Tuple): @common.parametrize("test_data", MM.test_data_generators) @common.XfailIfNoCorstone320 -def test_mm_u85_BI(test_data: Tuple): - EthosU85PipelineBI[test_t]( +def test_mm_u85_INT(test_data: Tuple): + EthosU85PipelineINT[test_t]( MM(), test_data(), MM.aten_op, diff --git a/backends/arm/test/ops/test_mul.py b/backends/arm/test/ops/test_mul.py index b061e57287a..122b44cf154 100644 --- a/backends/arm/test/ops/test_mul.py +++ b/backends/arm/test/ops/test_mul.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor, torch.Tensor] # Input x @@ -107,8 +107,8 @@ def forward( @common.parametrize("test_data", test_data_suite) -def test_mul_tensor_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_mul_tensor_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Mul(), test_data(), aten_op, @@ -118,8 +118,8 @@ def test_mul_tensor_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_2) -def test_mul_tensor_tosa_MI_diff_input_ranks(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_mul_tensor_tosa_FP_diff_input_ranks(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Mul(), test_data(), aten_op, @@ -129,8 +129,8 @@ def test_mul_tensor_tosa_MI_diff_input_ranks(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_int32) -def test_mul_tensor_tosa_MI_int32(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_mul_tensor_tosa_FP_int32(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Mul(), test_data(), aten_op, @@ -140,8 +140,8 @@ def test_mul_tensor_tosa_MI_int32(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_2) -def test_mul_tensor_tosa_BI_diff_input_ranks(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_mul_tensor_tosa_INT_diff_input_ranks(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -151,8 +151,8 @@ def test_mul_tensor_tosa_BI_diff_input_ranks(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_mul_tensor_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_mul_tensor_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -162,8 +162,8 @@ def test_mul_tensor_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_int32) -def test_mul_tensor_tosa_BI_int32(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_mul_tensor_tosa_INT_int32(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -175,8 +175,8 @@ def test_mul_tensor_tosa_BI_int32(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_mul_tensor_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_mul_tensor_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -188,8 +188,8 @@ def test_mul_tensor_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_mul_tensor_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_mul_tensor_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -209,8 +209,8 @@ def test_mul_tensor_u85_BI(test_data: torch.Tensor): }, ) @common.XfailIfNoCorstone300 -def test_mul_tensor_u55_BI_int32(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_mul_tensor_u55_INT_int32(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Mul(), test_data(), aten_op, @@ -231,8 +231,8 @@ def test_mul_tensor_u55_BI_int32(test_data: torch.Tensor): }, ) @common.XfailIfNoCorstone320 -def test_mul_tensor_u85_BI_int32(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_mul_tensor_u85_INT_int32(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Mul(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_multihead_attention.py b/backends/arm/test/ops/test_multihead_attention.py index 8a704ec333c..71cf076a157 100644 --- a/backends/arm/test/ops/test_multihead_attention.py +++ b/backends/arm/test/ops/test_multihead_attention.py @@ -7,10 +7,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, VgfPipeline, ) @@ -42,9 +42,9 @@ def forward(self, *args, **kwargs): "test_data", test_suite, ) -def test_multihead_attention_tosa_MI(test_data: input_t1): +def test_multihead_attention_tosa_FP(test_data: input_t1): test_data, module = test_data() - pipeline = TosaPipelineMI(module, (*test_data, *test_data, *test_data), [], []) + pipeline = TosaPipelineFP(module, (*test_data, *test_data, *test_data), [], []) pipeline.run() @@ -52,9 +52,9 @@ def test_multihead_attention_tosa_MI(test_data: input_t1): "test_data", test_suite, ) -def test_multihead_attention_tosa_BI(test_data): +def test_multihead_attention_tosa_INT(test_data): test_data, module = test_data() - pipeline = TosaPipelineBI( + pipeline = TosaPipelineINT( module, (*test_data, *test_data, *test_data), [], @@ -71,9 +71,9 @@ def test_multihead_attention_tosa_BI(test_data): ) @pytest.mark.xfail(reason="MLETORCH-1102: Numerical issues on FVP") @common.XfailIfNoCorstone300 -def test_multihead_attention_u55_BI(test_data: input_t1): +def test_multihead_attention_u55_INT(test_data: input_t1): test_data, module = test_data() - pipeline = EthosU55PipelineBI( + pipeline = EthosU55PipelineINT( module, (*test_data, *test_data, *test_data), [], @@ -93,9 +93,9 @@ def test_multihead_attention_u55_BI(test_data: input_t1): ) @pytest.mark.xfail(reason="MLETORCH-1102: Numerical issues on FVP") @common.XfailIfNoCorstone320 -def test_multihead_attention_u85_BI(test_data: input_t1): +def test_multihead_attention_u85_INT(test_data: input_t1): test_data, module = test_data() - pipeline = EthosU85PipelineBI( + pipeline = EthosU85PipelineINT( module, (*test_data, *test_data, *test_data), [], diff --git a/backends/arm/test/ops/test_ne.py b/backends/arm/test/ops/test_ne.py index 2ceacdb31b9..356886837e2 100644 --- a/backends/arm/test/ops/test_ne.py +++ b/backends/arm/test/ops/test_ne.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -85,16 +85,16 @@ def get_inputs(self): @common.parametrize("test_module", test_data_tensor) -def test_ne_tensor_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_ne_tensor_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module, test_module.get_inputs(), NotEqual.aten_op_Tensor, NotEqual.exir_op ) pipeline.run() @common.parametrize("test_module", test_data_scalar) -def test_ne_scalar_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +def test_ne_scalar_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module, test_module.get_inputs(), NotEqual.aten_op_Scalar, @@ -104,16 +104,16 @@ def test_ne_scalar_tosa_MI(test_module): @common.parametrize("test_module", test_data_tensor) -def test_ne_tensor_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_ne_tensor_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module, test_module.get_inputs(), NotEqual.decomposed_ops, NotEqual.exir_op ) pipeline.run() @common.parametrize("test_module", test_data_scalar) -def test_ne_scalar_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +def test_ne_scalar_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module, test_module.get_inputs(), NotEqual.decomposed_ops, NotEqual.exir_op ) pipeline.run() @@ -121,7 +121,7 @@ def test_ne_scalar_tosa_BI(test_module): @common.parametrize("test_module", test_data_tensor) @common.XfailIfNoCorstone300 -def test_ne_tensor_u55_BI(test_module): +def test_ne_tensor_u55_INT(test_module): # EQUAL is not supported on U55. pipeline = OpNotSupportedPipeline[input_t]( test_module, @@ -138,7 +138,7 @@ def test_ne_tensor_u55_BI(test_module): @common.parametrize("test_module", test_data_scalar) @common.XfailIfNoCorstone300 -def test_ne_scalar_u55_BI(test_module): +def test_ne_scalar_u55_INT(test_module): # Not equal (ne) is decomposed into the TOSA ops EQUAL and LOGICAL_NOT, both of # which are unsupported on U55. pipeline = OpNotSupportedPipeline[input_t]( @@ -164,8 +164,8 @@ def test_ne_scalar_u55_BI(test_module): strict=False, ) @common.XfailIfNoCorstone320 -def test_ne_tensor_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_ne_tensor_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module, test_module.get_inputs(), NotEqual.decomposed_ops, @@ -185,8 +185,8 @@ def test_ne_tensor_u85_BI(test_module): strict=False, ) @common.XfailIfNoCorstone320 -def test_ne_scalar_u85_BI(test_module): - pipeline = EthosU85PipelineBI[input_t]( +def test_ne_scalar_u85_INT(test_module): + pipeline = EthosU85PipelineINT[input_t]( test_module, test_module.get_inputs(), NotEqual.decomposed_ops, diff --git a/backends/arm/test/ops/test_neg.py b/backends/arm/test/ops/test_neg.py index e4d705dfba9..272e79e6403 100644 --- a/backends/arm/test/ops/test_neg.py +++ b/backends/arm/test/ops/test_neg.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] @@ -37,21 +37,21 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Neg.test_data) -def test_neg_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1](Neg(), test_data, Neg.aten_op, Neg.exir_op) +def test_neg_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1](Neg(), test_data, Neg.aten_op, Neg.exir_op) pipeline.run() @common.parametrize("test_data", Neg.test_data) -def test_neg_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1](Neg(), test_data, Neg.aten_op, Neg.exir_op) +def test_neg_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1](Neg(), test_data, Neg.aten_op, Neg.exir_op) pipeline.run() @common.parametrize("test_data", Neg.test_data) @common.XfailIfNoCorstone300 -def test_neg_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_neg_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( Neg(), test_data, Neg.aten_op, Neg.exir_op, run_on_fvp=True ) pipeline.run() @@ -59,8 +59,8 @@ def test_neg_u55_BI(test_data: input_t1): @common.parametrize("test_data", Neg.test_data) @common.XfailIfNoCorstone320 -def test_neg_u85_BI(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( +def test_neg_u85_INT(test_data: input_t1): + pipeline = EthosU85PipelineINT[input_t1]( Neg(), test_data, Neg.aten_op, Neg.exir_op, run_on_fvp=True ) pipeline.run() diff --git a/backends/arm/test/ops/test_ones.py b/backends/arm/test/ops/test_ones.py index d3b7528c4d0..c115e34d595 100644 --- a/backends/arm/test/ops/test_ones.py +++ b/backends/arm/test/ops/test_ones.py @@ -7,11 +7,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -49,9 +49,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", OnesAdd.test_data) -def test_ones_tosa_MI(test_data: test_data_t): +def test_ones_tosa_FP(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( OnesAdd(*init_data), input_data(), OnesAdd.aten_op, @@ -60,9 +60,9 @@ def test_ones_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", OnesAdd.test_data) -def test_ones_tosa_BI(test_data: test_data_t): +def test_ones_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( OnesAdd(*init_data), input_data(), OnesAdd.aten_op, @@ -73,9 +73,9 @@ def test_ones_tosa_BI(test_data: test_data_t): @common.parametrize("test_data", OnesAdd.test_data) @common.XfailIfNoCorstone300 -def test_ones_u55_BI(test_data: test_data_t): +def test_ones_u55_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( OnesAdd(*init_data), input_data(), OnesAdd.aten_op, @@ -87,9 +87,9 @@ def test_ones_u55_BI(test_data: test_data_t): @common.parametrize("test_data", OnesAdd.test_data) @common.XfailIfNoCorstone320 -def test_ones_u85_BI(test_data: test_data_t): +def test_ones_u85_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( OnesAdd(*init_data), input_data(), OnesAdd.aten_op, @@ -108,7 +108,7 @@ def test_ones_u85_BI(test_data: test_data_t): "int32_int64": "MLETORCG-716: Do not delegate empty networks to vela", }, ) -def test_ones_tosa_BI_not_delegated(test_data: test_data_t): +def test_ones_tosa_INT_not_delegated(test_data: test_data_t): input_data, init_data = test_data pipeline = OpNotSupportedPipeline[input_t]( OnesAdd(*init_data), input_data(), non_delegated_ops={}, quantize=True diff --git a/backends/arm/test/ops/test_permute.py b/backends/arm/test/ops/test_permute.py index ef91c794379..1e043db550f 100644 --- a/backends/arm/test/ops/test_permute.py +++ b/backends/arm/test/ops/test_permute.py @@ -13,10 +13,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) from torchvision.ops import Permute @@ -48,9 +48,9 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_permute_tosa_MI(test_data: torch.Tensor): +def test_permute_tosa_FP(test_data: torch.Tensor): test_data, dims = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( SimplePermute(dims=dims), (test_data,), aten_op, @@ -60,9 +60,9 @@ def test_permute_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_permute_tosa_BI(test_data: torch.Tensor): +def test_permute_tosa_INT(test_data: torch.Tensor): test_data, dims = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( SimplePermute(dims=dims), (test_data,), aten_op, @@ -79,9 +79,9 @@ def test_permute_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone300 -def test_permute_u55_BI(test_data): +def test_permute_u55_INT(test_data): test_data, dims = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( SimplePermute(dims=dims), (test_data,), aten_op, @@ -94,9 +94,9 @@ def test_permute_u55_BI(test_data): # Fails since on FVP since N > 1 is not supported. MLETORCH-517 @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone320 -def test_permute_u85_BI(test_data: torch.Tensor): +def test_permute_u85_INT(test_data: torch.Tensor): test_data, dims = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( SimplePermute(dims=dims), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_pow.py b/backends/arm/test/ops/test_pow.py index c1014d4a5d6..74c37195733 100644 --- a/backends/arm/test/ops/test_pow.py +++ b/backends/arm/test/ops/test_pow.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -92,8 +92,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Pow_TensorTensor.test_data, x_fail, strict=False) -def test_pow_tensor_tensor_tosa_MI(test_data: Pow_TensorTensor.input_t): - pipeline = TosaPipelineMI[Pow_TensorTensor.input_t]( +def test_pow_tensor_tensor_tosa_FP(test_data: Pow_TensorTensor.input_t): + pipeline = TosaPipelineFP[Pow_TensorTensor.input_t]( Pow_TensorTensor(), test_data(), Pow_TensorTensor.aten_op, @@ -113,9 +113,9 @@ def test_pow_tensor_tensor_tosa_MI(test_data: Pow_TensorTensor.input_t): @common.parametrize("test_data", Pow_TensorScalar.test_data, x_fail, strict=False) -def test_pow_tensor_scalar_tosa_MI(test_data: Pow_TensorScalar.input_t): +def test_pow_tensor_scalar_tosa_FP(test_data: Pow_TensorScalar.input_t): base, exp = test_data() - pipeline = TosaPipelineMI[Pow_TensorScalar.input_t]( + pipeline = TosaPipelineFP[Pow_TensorScalar.input_t]( Pow_TensorScalar(exp), (base,), Pow_TensorScalar.aten_op, @@ -125,9 +125,9 @@ def test_pow_tensor_scalar_tosa_MI(test_data: Pow_TensorScalar.input_t): @common.parametrize("test_data", Pow_TensorScalar.test_data, x_fail, strict=False) -def test_pow_tensor_scalar_tosa_BI(test_data: Pow_TensorScalar.input_t): +def test_pow_tensor_scalar_tosa_INT(test_data: Pow_TensorScalar.input_t): base, exp = test_data() - pipeline = TosaPipelineBI[Pow_TensorScalar.input_t]( + pipeline = TosaPipelineINT[Pow_TensorScalar.input_t]( Pow_TensorScalar(exp), (base,), Pow_TensorScalar.aten_op, @@ -138,9 +138,9 @@ def test_pow_tensor_scalar_tosa_BI(test_data: Pow_TensorScalar.input_t): @common.parametrize("test_data", Pow_TensorScalar.test_data) @common.XfailIfNoCorstone300 -def test_pow_tensor_scalar_u55_BI(test_data: Pow_TensorScalar.input_t): +def test_pow_tensor_scalar_u55_INT(test_data: Pow_TensorScalar.input_t): base, exp = test_data() - pipeline = EthosU55PipelineBI[Pow_TensorScalar.input_t]( + pipeline = EthosU55PipelineINT[Pow_TensorScalar.input_t]( Pow_TensorScalar(exp), (base,), Pow_TensorScalar.aten_op, @@ -152,9 +152,9 @@ def test_pow_tensor_scalar_u55_BI(test_data: Pow_TensorScalar.input_t): @common.parametrize("test_data", Pow_TensorScalar.test_data) @common.XfailIfNoCorstone320 -def test_pow_tensor_scalar_u85_BI(test_data: Pow_TensorScalar.input_t): +def test_pow_tensor_scalar_u85_INT(test_data: Pow_TensorScalar.input_t): base, exp = test_data() - pipeline = EthosU85PipelineBI[Pow_TensorScalar.input_t]( + pipeline = EthosU85PipelineINT[Pow_TensorScalar.input_t]( Pow_TensorScalar(exp), (base,), Pow_TensorScalar.aten_op, diff --git a/backends/arm/test/ops/test_reciprocal.py b/backends/arm/test/ops/test_reciprocal.py index 48d7e516aaa..dbc489aef2e 100644 --- a/backends/arm/test/ops/test_reciprocal.py +++ b/backends/arm/test/ops/test_reciprocal.py @@ -11,10 +11,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x, Input y @@ -41,8 +41,8 @@ def forward(self, input_: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_reciprocal_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_reciprocal_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Reciprocal(), (test_data(),), aten_op, @@ -52,8 +52,8 @@ def test_reciprocal_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_reciprocal_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_reciprocal_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Reciprocal(), (test_data(),), aten_op, @@ -64,8 +64,8 @@ def test_reciprocal_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 -def test_reciprocal_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_reciprocal_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Reciprocal(), (test_data(),), aten_op, @@ -77,8 +77,8 @@ def test_reciprocal_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_reciprocal_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_reciprocal_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Reciprocal(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_relu.py b/backends/arm/test/ops/test_relu.py index 00527a6c314..2babf8963f7 100644 --- a/backends/arm/test/ops/test_relu.py +++ b/backends/arm/test/ops/test_relu.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -43,8 +43,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_relu_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_relu_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Relu(), (test_data(),), aten_op, @@ -54,8 +54,8 @@ def test_relu_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_relu_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_relu_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Relu(), (test_data(),), aten_op, @@ -65,8 +65,8 @@ def test_relu_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_relu_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_relu_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Relu(), (test_data(),), aten_op, @@ -77,8 +77,8 @@ def test_relu_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_relu_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_relu_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Relu(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_repeat.py b/backends/arm/test/ops/test_repeat.py index 556e27be23d..e80f381786e 100644 --- a/backends/arm/test/ops/test_repeat.py +++ b/backends/arm/test/ops/test_repeat.py @@ -14,10 +14,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor, torch.Tensor] # Input x, Input y @@ -63,9 +63,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_repeat_tosa_MI(test_data: Tuple): +def test_repeat_tosa_FP(test_data: Tuple): module, test_data = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, test_data, module.aten_op, @@ -75,9 +75,9 @@ def test_repeat_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_repeat_tosa_BI(test_data: Tuple): +def test_repeat_tosa_INT(test_data: Tuple): module, test_data = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( module, test_data, module.aten_op, @@ -87,9 +87,9 @@ def test_repeat_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_repeat_u55_BI(test_data: Tuple): +def test_repeat_u55_INT(test_data: Tuple): module, test_data = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( module, test_data, module.aten_op, @@ -100,9 +100,9 @@ def test_repeat_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_repeat_u85_BI(test_data: Tuple): +def test_repeat_u85_INT(test_data: Tuple): module, test_data = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( module, test_data, module.aten_op, diff --git a/backends/arm/test/ops/test_round.py b/backends/arm/test/ops/test_round.py index 3480076a3e1..391c05a0962 100644 --- a/backends/arm/test/ops/test_round.py +++ b/backends/arm/test/ops/test_round.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -38,8 +38,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_round_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_round_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Round(), (test_data(),), aten_op, @@ -49,8 +49,8 @@ def test_round_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_round_tosa_BI(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_round_tosa_INT(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Round(), (test_data(),), [], @@ -62,8 +62,8 @@ def test_round_tosa_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone300 @pytest.mark.xfail(reason="where.self not supported on U55") -def test_round_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_round_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Round(), (test_data(),), [], @@ -74,8 +74,8 @@ def test_round_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_round_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_round_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Round(), (test_data(),), [], diff --git a/backends/arm/test/ops/test_rshift.py b/backends/arm/test/ops/test_rshift.py index 2e11cee5183..ac4c3337980 100644 --- a/backends/arm/test/ops/test_rshift.py +++ b/backends/arm/test/ops/test_rshift.py @@ -10,18 +10,18 @@ XfailIfNoCorstone320, ) from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) scalar_input_t = tuple[torch.Tensor, int] class RshiftScalar(torch.nn.Module): - torch_op_MI = "torch.ops.aten.__rshift__.Scalar" - torch_op_BI = "torch.ops.aten.bitwise_right_shift.Tensor" + torch_op_FP = "torch.ops.aten.__rshift__.Scalar" + torch_op_INT = "torch.ops.aten.bitwise_right_shift.Tensor" exir_op = "executorch_exir_dialects_edge__ops_aten_bitwise_right_shift_Tensor" test_data = { "randint_neg_100_int8": lambda: ( @@ -68,21 +68,21 @@ def forward(self, x: torch.Tensor, shift: torch.Tensor): @common.parametrize("test_data", RshiftScalar.test_data) -def test_rshift_scalar_tosa_MI_scalar(test_data): - TosaPipelineMI[scalar_input_t]( +def test_rshift_scalar_tosa_FP_scalar(test_data): + TosaPipelineFP[scalar_input_t]( RshiftScalar(), test_data(), - RshiftScalar.torch_op_MI, + RshiftScalar.torch_op_FP, RshiftScalar.exir_op, ).run() @common.parametrize("test_data", RshiftScalar.test_data) -def test_bitwise_right_shift_tensor_tosa_BI_scalar(test_data): - pipeline = TosaPipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_tosa_INT_scalar(test_data): + pipeline = TosaPipelineINT[scalar_input_t]( RshiftScalar(), test_data(), - RshiftScalar.torch_op_BI, + RshiftScalar.torch_op_INT, RshiftScalar.exir_op, ) pipeline.pop_stage("check.quant_nodes") @@ -91,11 +91,11 @@ def test_bitwise_right_shift_tensor_tosa_BI_scalar(test_data): @common.parametrize("test_data", RshiftScalar.test_data) @XfailIfNoCorstone300 -def test_bitwise_right_shift_tensor_u55_BI_scalar(test_data): - pipeline = EthosU55PipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_u55_INT_scalar(test_data): + pipeline = EthosU55PipelineINT[scalar_input_t]( RshiftScalar(), test_data(), - RshiftScalar.torch_op_BI, + RshiftScalar.torch_op_INT, RshiftScalar.exir_op, run_on_fvp=True, ) @@ -108,11 +108,11 @@ def test_bitwise_right_shift_tensor_u55_BI_scalar(test_data): @common.parametrize("test_data", RshiftScalar.test_data) @XfailIfNoCorstone320 -def test_bitwise_right_shift_tensor_u85_BI_scalar(test_data): - pipeline = EthosU85PipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_u85_INT_scalar(test_data): + pipeline = EthosU85PipelineINT[scalar_input_t]( RshiftScalar(), test_data(), - RshiftScalar.torch_op_BI, + RshiftScalar.torch_op_INT, RshiftScalar.exir_op, run_on_fvp=True, ) @@ -121,8 +121,8 @@ def test_bitwise_right_shift_tensor_u85_BI_scalar(test_data): @common.parametrize("test_data", RshiftTensor.test_data) -def test_rshift_scalar_tosa_MI(test_data): - TosaPipelineMI[scalar_input_t]( +def test_rshift_scalar_tosa_FP(test_data): + TosaPipelineFP[scalar_input_t]( RshiftTensor(), test_data(), RshiftTensor.torch_op, @@ -131,8 +131,8 @@ def test_rshift_scalar_tosa_MI(test_data): @common.parametrize("test_data", RshiftTensor.test_data) -def test_bitwise_right_shift_tensor_tosa_BI(test_data): - pipeline = TosaPipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_tosa_INT(test_data): + pipeline = TosaPipelineINT[scalar_input_t]( RshiftTensor(), test_data(), RshiftTensor.torch_op, @@ -144,8 +144,8 @@ def test_bitwise_right_shift_tensor_tosa_BI(test_data): @common.parametrize("test_data", RshiftTensor.test_data) @XfailIfNoCorstone300 -def test_bitwise_right_shift_tensor_u55_BI(test_data): - pipeline = EthosU55PipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_u55_INT(test_data): + pipeline = EthosU55PipelineINT[scalar_input_t]( RshiftTensor(), test_data(), RshiftTensor.torch_op, @@ -161,8 +161,8 @@ def test_bitwise_right_shift_tensor_u55_BI(test_data): @common.parametrize("test_data", RshiftTensor.test_data) @XfailIfNoCorstone320 -def test_bitwise_right_shift_tensor_u85_BI(test_data): - pipeline = EthosU85PipelineBI[scalar_input_t]( +def test_bitwise_right_shift_tensor_u85_INT(test_data): + pipeline = EthosU85PipelineINT[scalar_input_t]( RshiftTensor(), test_data(), RshiftTensor.torch_op, diff --git a/backends/arm/test/ops/test_rsqrt.py b/backends/arm/test/ops/test_rsqrt.py index 0a9e95d890e..65ea46f247c 100644 --- a/backends/arm/test/ops/test_rsqrt.py +++ b/backends/arm/test/ops/test_rsqrt.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -36,8 +36,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_tensor", Rsqrt.test_parameters) -def test_rsqrt_tosa_MI(test_tensor: torch.Tensor): - pipeline = TosaPipelineMI[input_t1]( +def test_rsqrt_tosa_FP(test_tensor: torch.Tensor): + pipeline = TosaPipelineFP[input_t1]( Rsqrt(), test_tensor(), aten_op, @@ -47,8 +47,8 @@ def test_rsqrt_tosa_MI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Rsqrt.test_parameters) -def test_rsqrt_tosa_BI(test_tensor: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_rsqrt_tosa_INT(test_tensor: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Rsqrt(), test_tensor(), aten_op, @@ -59,8 +59,8 @@ def test_rsqrt_tosa_BI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Rsqrt.test_parameters) @common.XfailIfNoCorstone300 -def test_rsqrt_u55_BI(test_tensor: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_rsqrt_u55_INT(test_tensor: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Rsqrt(), test_tensor(), aten_op, @@ -72,8 +72,8 @@ def test_rsqrt_u55_BI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Rsqrt.test_parameters) @common.XfailIfNoCorstone320 -def test_rsqrt_u85_BI(test_tensor: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_rsqrt_u85_INT(test_tensor: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Rsqrt(), test_tensor(), aten_op, diff --git a/backends/arm/test/ops/test_scalar_tensor.py b/backends/arm/test/ops/test_scalar_tensor.py index 6658f06a884..cf3d0818dbc 100644 --- a/backends/arm/test/ops/test_scalar_tensor.py +++ b/backends/arm/test/ops/test_scalar_tensor.py @@ -7,10 +7,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) float_test_data_suite = { @@ -53,9 +53,9 @@ def forward(self, x: torch.Tensor): "test_data", int_test_data_suite | float_test_data_suite, ) -def test_scalar_tensor_tosa_MI(test_data): # Note TOSA MI supports all types +def test_scalar_tensor_tosa_FP(test_data): # Note TOSA FP supports all types scalar, dtype, data = test_data() - TosaPipelineMI( + TosaPipelineFP( ScalarTensor(scalar, dtype), tuple(data), ScalarTensor.aten_op, @@ -66,9 +66,9 @@ def test_scalar_tensor_tosa_MI(test_data): # Note TOSA MI supports all types "test_data", int_test_data_suite | float_test_data_suite, ) -def test_scalar_tensor_tosa_BI(test_data): +def test_scalar_tensor_tosa_INT(test_data): scalar, dtype, data = test_data() - pipeline: TosaPipelineBI = TosaPipelineBI( + pipeline: TosaPipelineINT = TosaPipelineINT( ScalarTensor(scalar, dtype), tuple(data), ScalarTensor.aten_op, @@ -79,9 +79,9 @@ def test_scalar_tensor_tosa_BI(test_data): @common.parametrize("test_data", float_test_data_suite) @common.XfailIfNoCorstone300 -def test_scalar_tensor_u55_BI(test_data): +def test_scalar_tensor_u55_INT(test_data): scalar, dtype, data = test_data() - EthosU55PipelineBI( + EthosU55PipelineINT( ScalarTensor(scalar, dtype), tuple(data), ScalarTensor.aten_op, @@ -91,9 +91,9 @@ def test_scalar_tensor_u55_BI(test_data): @common.parametrize("test_data", float_test_data_suite) @common.XfailIfNoCorstone320 -def test_scalar_tensor_u85_BI(test_data): +def test_scalar_tensor_u85_INT(test_data): scalar, dtype, data = test_data() - EthosU85PipelineBI( + EthosU85PipelineINT( ScalarTensor(scalar, dtype), tuple(data), ScalarTensor.aten_op, diff --git a/backends/arm/test/ops/test_scalars.py b/backends/arm/test/ops/test_scalars.py index 3ede947b218..1243a522526 100644 --- a/backends/arm/test/ops/test_scalars.py +++ b/backends/arm/test/ops/test_scalars.py @@ -12,13 +12,13 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) """ Summary of non-working cases. -MI: +FP: Op(scalar, tensor): One issue is that lift_constant_tensor_pass looks for a fake_tensor in the meta of the first node which does not work the first node is a scalar. @@ -170,253 +170,255 @@ def forward(self, x): } -# ADD MI ------------------------------------------------------ +# ADD FP ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_add_tensor_tosa_MI_scalar(test_data): +def test_add_tensor_tosa_FP_scalar(test_data): """Tests regular add with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](Add(), test_data, aten_op=Add.aten_op) + pipeline = TosaPipelineFP[input_t1](Add(), test_data, aten_op=Add.aten_op) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_add_tensor_tosa_MI_inplace(test_data): +def test_add_tensor_tosa_FP_inplace(test_data): """Tests inplace add with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](AddInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineFP[input_t1](AddInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_const_tests, xfails=xfails) -def test_add_tensor_tosa_MI_const(test_data): +def test_add_tensor_tosa_FP_const(test_data): """Tests regular add with one scalar input, with one of inputs constant.""" - pipeline = TosaPipelineMI[input_t1](AddConst(), test_data, aten_op=AddConst.aten_op) + pipeline = TosaPipelineFP[input_t1](AddConst(), test_data, aten_op=AddConst.aten_op) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_add_scalar_tosa_MI(test_data): +def test_add_scalar_tosa_FP(test_data): """Tests a scalar add with one scalar input.""" - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( AddScalar(), test_data, aten_op=AddScalar.aten_op ) pipeline.run() -# ADD BI ------------------------------------------------------ +# ADD INT ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests) -def test_add_tensor_tosa_BI_scalar(test_data): +def test_add_tensor_tosa_INT_scalar(test_data): """Tests regular add with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](Add(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](Add(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests) -def test_add_tensor_tosa_BI_inplace(test_data): +def test_add_tensor_tosa_INT_inplace(test_data): """Tests inplace add with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](AddInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](AddInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_const_tests) -def test_add_tensor_tosa_BI_const(test_data): +def test_add_tensor_tosa_INT_const(test_data): """Tests regular add with one scalar input, with one of inputs constant.""" - pipeline = TosaPipelineBI[input_t1](AddConst(), test_data, aten_op=AddConst.aten_op) + pipeline = TosaPipelineINT[input_t1]( + AddConst(), test_data, aten_op=AddConst.aten_op + ) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_add_scalar_tosa_BI(test_data): +def test_add_scalar_tosa_INT(test_data): """Tests a scalar add with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](AddScalar(), test_data, aten_op=Add.aten_op) + pipeline = TosaPipelineINT[input_t1](AddScalar(), test_data, aten_op=Add.aten_op) pipeline.run() # ADD ETHOS-U ------------------------------------------------------ -@pytest.mark.skip(reason="This is tested in test_add_scalar_tosa_BI") -def test_add_scalar_u55_BI(): +@pytest.mark.skip(reason="This is tested in test_add_scalar_tosa_INT") +def test_add_scalar_u55_INT(): pass -@pytest.mark.skip(reason="This is tested in test_add_scalar_tosa_BI") -def test_add_scalar_u85_BI(): +@pytest.mark.skip(reason="This is tested in test_add_scalar_tosa_INT") +def test_add_scalar_u85_INT(): pass -# SUB MI ------------------------------------------------------ +# SUB FP ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_sub_tensor_tosa_MI_scalar(test_data): +def test_sub_tensor_tosa_FP_scalar(test_data): """Tests regular sub with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](Sub(), test_data, aten_op=Sub.aten_op) + pipeline = TosaPipelineFP[input_t1](Sub(), test_data, aten_op=Sub.aten_op) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_sub_tensor_tosa_MI_inplace(test_data): +def test_sub_tensor_tosa_FP_inplace(test_data): """Tests inplace sub with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](SubInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineFP[input_t1](SubInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_sub_scalar_tosa_MI(test_data): +def test_sub_scalar_tosa_FP(test_data): """Tests a scalar sub with one scalar input.""" - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( SubScalar(), test_data, aten_op=SubScalar.aten_op ) pipeline.run() -# SUB BI ------------------------------------------------------ +# SUB INT ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests) -def test_sub_tensor_tosa_BI_scalar(test_data): +def test_sub_tensor_tosa_INT_scalar(test_data): """Tests regular sub with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](Sub(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](Sub(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests) -def test_sub_tensor_tosa_BI_inplace(test_data): +def test_sub_tensor_tosa_INT_inplace(test_data): """Tests inplace sub with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](SubInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](SubInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_sub_scalar_tosa_BI(test_data): +def test_sub_scalar_tosa_INT(test_data): """Tests a scalar sub with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](SubScalar(), test_data, aten_op=Sub.aten_op) + pipeline = TosaPipelineINT[input_t1](SubScalar(), test_data, aten_op=Sub.aten_op) pipeline.run() # SUB ETHOS-U ------------------------------------------------------ -@pytest.mark.skip(reason="This is tested in test_sub_scalar_tosa_BI") -def test_sub_scalar_u55_BI(): +@pytest.mark.skip(reason="This is tested in test_sub_scalar_tosa_INT") +def test_sub_scalar_u55_INT(): pass -@pytest.mark.skip(reason="This is tested in test_sub_scalar_tosa_BI") -def test_sub_scalar_u85_BI(): +@pytest.mark.skip(reason="This is tested in test_sub_scalar_tosa_INT") +def test_sub_scalar_u85_INT(): pass -# MUL MI ------------------------------------------------------ +# MUL FP ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_mul_tensor_tosa_MI_scalar(test_data): +def test_mul_tensor_tosa_FP_scalar(test_data): """Tests regular mul with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](Mul(), test_data, aten_op=Mul.aten_op) + pipeline = TosaPipelineFP[input_t1](Mul(), test_data, aten_op=Mul.aten_op) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_mul_tensor_tosa_MI_inplace(test_data): +def test_mul_tensor_tosa_FP_inplace(test_data): """Tests inplace mul with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](MulInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineFP[input_t1](MulInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_mul_scalar_tosa_MI(test_data): +def test_mul_scalar_tosa_FP(test_data): """Tests a scalar mul with one scalar input.""" - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( MulScalar(), test_data, aten_op=MulScalar.aten_op ) pipeline.run() -# MUL BI ------------------------------------------------------ +# MUL INT ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests) -def test_mul_tensor_tosa_BI_scalar(test_data): +def test_mul_tensor_tosa_INT_scalar(test_data): """Tests regular mul with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](Mul(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](Mul(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests) -def test_mul_tensor_tosa_BI_inplace(test_data): +def test_mul_tensor_tosa_INT_inplace(test_data): """Tests inplace mul with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](MulInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](MulInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_mul_scalar_tosa_BI(test_data): +def test_mul_scalar_tosa_INT(test_data): """Tests a scalar mul with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](MulScalar(), test_data, aten_op=Mul.aten_op) + pipeline = TosaPipelineINT[input_t1](MulScalar(), test_data, aten_op=Mul.aten_op) pipeline.run() # MUL ETHOS-U ------------------------------------------------------ -@pytest.mark.skip(reason="This is tested in test_mul_scalar_tosa_BI") -def test_mul_scalar_u55_BI(): +@pytest.mark.skip(reason="This is tested in test_mul_scalar_tosa_INT") +def test_mul_scalar_u55_INT(): pass -@pytest.mark.skip(reason="This is tested in test_mul_scalar_tosa_BI") -def test_mul_scalar_u85_BI(): +@pytest.mark.skip(reason="This is tested in test_mul_scalar_tosa_INT") +def test_mul_scalar_u85_INT(): pass -# DIV MI ------------------------------------------------------ +# DIV FP ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_div_tensor_tosa_MI_scalar(test_data): +def test_div_tensor_tosa_FP_scalar(test_data): """Tests regular div with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](Div(), test_data, aten_op=Div.aten_op) + pipeline = TosaPipelineFP[input_t1](Div(), test_data, aten_op=Div.aten_op) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_div_tensor_tosa_MI_inplace(test_data): +def test_div_tensor_tosa_FP_inplace(test_data): """Tests inplace div with one scalar input.""" - pipeline = TosaPipelineMI[input_t1](DivInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineFP[input_t1](DivInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_div_scalar_tosa_MI(test_data): +def test_div_scalar_tosa_FP(test_data): """Tests a scalar div with one scalar input.""" - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( DivScalar(), test_data, aten_op=DivScalar.aten_op ) pipeline.run() -# DIV BI ------------------------------------------------------ +# DIV INT ------------------------------------------------------ @common.parametrize("test_data", tensor_scalar_tests) -def test_div_tensor_tosa_BI_scalar(test_data): +def test_div_tensor_tosa_INT_scalar(test_data): """Tests regular div with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](Div(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](Div(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests) -def test_div_tensor_tosa_BI_inplace(test_data): +def test_div_tensor_tosa_INT_inplace(test_data): """Tests inplace div with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](DivInplace(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](DivInplace(), test_data, aten_op=[]) pipeline.run() @common.parametrize("test_data", tensor_scalar_tests, xfails=xfails) -def test_div_scalar_tosa_BI(test_data): +def test_div_scalar_tosa_INT(test_data): """Tests a scalar div with one scalar input.""" - pipeline = TosaPipelineBI[input_t1](DivScalar(), test_data, aten_op=[]) + pipeline = TosaPipelineINT[input_t1](DivScalar(), test_data, aten_op=[]) pipeline.run() # DIV ETHOS-U ------------------------------------------------------ -@pytest.mark.skip(reason="This is tested in test_div_scalar_tosa_BI") -def test_div_scalar_u55_BI(): +@pytest.mark.skip(reason="This is tested in test_div_scalar_tosa_INT") +def test_div_scalar_u55_INT(): pass -@pytest.mark.skip(reason="This is tested in test_div_scalar_tosa_BI") -def test_div_scalar_u85_BI(): +@pytest.mark.skip(reason="This is tested in test_div_scalar_tosa_INT") +def test_div_scalar_u85_INT(): pass # SHIFT ETHOS-U ------------------------------------------------------ -def test_bitwise_right_shift_tensor_tosa_MI_inplace(): - pipeline = TosaPipelineMI[input_t1]( +def test_bitwise_right_shift_tensor_tosa_FP_inplace(): + pipeline = TosaPipelineFP[input_t1]( ShiftInplaceSub(), (torch.IntTensor(5),), aten_op="torch.ops.aten.__rshift__.Scalar", @@ -424,8 +426,8 @@ def test_bitwise_right_shift_tensor_tosa_MI_inplace(): pipeline.run() -def test_bitwise_right_shift_tensor_tosa_BI_inplace(): - pipeline = TosaPipelineBI[input_t1]( +def test_bitwise_right_shift_tensor_tosa_INT_inplace(): + pipeline = TosaPipelineINT[input_t1]( ShiftInplaceSub(), (torch.IntTensor(5),), aten_op="torch.ops.aten.bitwise_right_shift.Tensor", diff --git a/backends/arm/test/ops/test_sdpa.py b/backends/arm/test/ops/test_sdpa.py index 470030f67fd..c4b05972f76 100644 --- a/backends/arm/test/ops/test_sdpa.py +++ b/backends/arm/test/ops/test_sdpa.py @@ -9,8 +9,8 @@ import torch from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) @@ -27,16 +27,16 @@ def forward(self, query, key, value): input_t = Tuple[torch.Tensor, torch.Tensor, torch.Tensor] -def test_sdpa_MI(): +def test_sdpa_FP(): test_input = tuple(torch.randn(1, 3, 197, 64) for x in range(3)) - pipeline = TosaPipelineMI[input_t](SDPA(), test_input, [], []) + pipeline = TosaPipelineFP[input_t](SDPA(), test_input, [], []) pipeline.pop_stage("check_count.exir") pipeline.run() -def test_sdpa_BI(): +def test_sdpa_INT(): test_input = tuple(torch.randn(1, 3, 197, 64) for x in range(3)) - pipeline = TosaPipelineBI[input_t](SDPA(), test_input, [], []) + pipeline = TosaPipelineINT[input_t](SDPA(), test_input, [], []) pipeline.pop_stage("check.quant_nodes") pipeline.pop_stage("check_count.exir") pipeline.pop_stage( diff --git a/backends/arm/test/ops/test_select.py b/backends/arm/test/ops/test_select.py index 72ab637ddfb..9cd3cf6f3b7 100644 --- a/backends/arm/test/ops/test_select.py +++ b/backends/arm/test/ops/test_select.py @@ -11,11 +11,11 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor, int, int] @@ -58,8 +58,8 @@ def forward(self, x, dim: int, index: int): @common.parametrize("test_data", test_data_suite) -def test_select_int_tosa_MI_copy(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_select_int_tosa_FP_copy(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( SelectCopy(), test_data(), aten_op=aten_op_copy, @@ -69,8 +69,8 @@ def test_select_int_tosa_MI_copy(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_select_int_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_select_int_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( SelectInt(), test_data(), aten_op=aten_op_int, @@ -80,8 +80,8 @@ def test_select_int_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_select_int_tosa_BI_copy(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_select_int_tosa_INT_copy(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( SelectCopy(), test_data(), aten_op=aten_op_copy, @@ -91,8 +91,8 @@ def test_select_int_tosa_BI_copy(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_select_int_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_select_int_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( SelectInt(), test_data(), aten_op=aten_op_int, @@ -108,8 +108,8 @@ def test_select_int_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone300 -def test_select_int_u55_BI_copy(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_select_int_u55_INT_copy(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( SelectCopy(), test_data(), aten_op_copy, @@ -122,8 +122,8 @@ def test_select_int_u55_BI_copy(test_data: Tuple): @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone300 -def test_select_int_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_select_int_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( SelectInt(), test_data(), aten_op_int, @@ -135,7 +135,7 @@ def test_select_int_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_not_delegated) -def test_select_int_u55_BI_not_delegated(test_data: Tuple): +def test_select_int_u55_INT_not_delegated(test_data: Tuple): pipeline = OpNotSupportedPipeline[input_t1]( SelectInt(), test_data(), @@ -149,8 +149,8 @@ def test_select_int_u55_BI_not_delegated(test_data: Tuple): @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone320 -def test_select_int_u85_BI_copy(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_select_int_u85_INT_copy(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( SelectCopy(), test_data(), aten_op_copy, @@ -163,8 +163,8 @@ def test_select_int_u85_BI_copy(test_data: Tuple): @common.parametrize("test_data", test_data_suite, x_fails) @common.XfailIfNoCorstone320 -def test_select_int_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_select_int_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( SelectInt(), test_data(), aten_op_int, diff --git a/backends/arm/test/ops/test_sigmoid.py b/backends/arm/test/ops/test_sigmoid.py index b5ee68b987b..b4f8458574e 100644 --- a/backends/arm/test/ops/test_sigmoid.py +++ b/backends/arm/test/ops/test_sigmoid.py @@ -9,12 +9,12 @@ from typing import Tuple import torch -from executorch.backends.arm.test import common, conftest +from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sigmoid.default" # Used for checking that we do not have softmax in the graph after decompose @@ -69,78 +69,72 @@ def forward(self, x, y): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_tosa_MI(test_data: torch.Tensor): - TosaPipelineMI[input_t1](Sigmoid(), (test_data(),), aten_op, exir_op).run() +def test_sigmoid_tosa_FP(test_data: torch.Tensor): + TosaPipelineFP[input_t1](Sigmoid(), (test_data(),), aten_op, exir_op).run() @common.parametrize("test_data", test_data_suite) -def test_sigmoid_tosa_BI(test_data: torch.Tensor): - TosaPipelineBI[input_t1](Sigmoid(), (test_data(),), aten_op, exir_op).run() +def test_sigmoid_tosa_INT(test_data: torch.Tensor): + TosaPipelineINT[input_t1](Sigmoid(), (test_data(),), aten_op, exir_op).run() -def test_sigmoid_tosa_MI_add(): - TosaPipelineMI[input_t1]( +def test_sigmoid_tosa_FP_add(): + TosaPipelineFP[input_t1]( AddSigmoid(), (test_data_suite["zeros"](),), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() -def test_sigmoid_tosa_BI_add(): - TosaPipelineBI[input_t1]( +def test_sigmoid_tosa_INT_add(): + TosaPipelineINT[input_t1]( AddSigmoid(), (test_data_suite["ramp"](),), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() -def test_sigmoid_tosa_MI_add_2(): - TosaPipelineMI[input_t1]( +def test_sigmoid_tosa_FP_add_2(): + TosaPipelineFP[input_t1]( SigmoidAdd(), (test_data_suite["zeros"](),), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() -def test_sigmoid_tosa_BI_add_2(): - TosaPipelineBI[input_t1]( +def test_sigmoid_tosa_INT_add_2(): + TosaPipelineINT[input_t1]( SigmoidAdd(), (test_data_suite["zeros"](),), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() -def test_sigmoid_tosa_MI_add_3(): - TosaPipelineMI[input_t1]( +def test_sigmoid_tosa_FP_add_3(): + TosaPipelineFP[input_t1]( SigmoidAddSigmoid(), (test_data_suite["randn_neg"](), test_data_suite["randn_pos"]()), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() -def test_sigmoid_tosa_BI_3(): - TosaPipelineBI[input_t1]( +def test_sigmoid_tosa_INT_3(): + TosaPipelineINT[input_t1]( SigmoidAddSigmoid(), (test_data_suite["randn_neg"](), test_data_suite["randn_pos"]()), aten_op, exir_op, - tosa_version=conftest.get_option("tosa_version"), ).run() @common.parametrize("test_data", test_data_suite) -def test_sigmoid_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_sigmoid_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sigmoid(), (test_data(),), aten_op, @@ -151,8 +145,8 @@ def test_sigmoid_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_sigmoid_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Sigmoid(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_sigmoid_16bit.py b/backends/arm/test/ops/test_sigmoid_16bit.py index 56b5822f8f4..a41681675ce 100644 --- a/backends/arm/test/ops/test_sigmoid_16bit.py +++ b/backends/arm/test/ops/test_sigmoid_16bit.py @@ -12,9 +12,9 @@ from executorch.backends.arm.quantizer.quantization_config import QuantizationConfig from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, + TosaPipelineINT, ) from executorch.backends.arm.tosa_specification import TosaSpecification from executorch.backends.xnnpack.test.tester import Quantize @@ -40,9 +40,6 @@ def _get_16_bit_quant_config(): def get_16bit_sigmoid_quantizer(u55_config=False): tosa_version = conftest.get_option("tosa_version") tosa_profiles = { - "0.80": TosaSpecification.create_from_string( - "TOSA-0.80+BI" + ("+u55" if u55_config else "") - ), "1.0": TosaSpecification.create_from_string( "TOSA-1.0+INT" + ("+u55" if u55_config else "") ), @@ -90,8 +87,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_tosa_BI(test_data): - pipeline = TosaPipelineBI( +def test_sigmoid_tosa_INT(test_data): + pipeline = TosaPipelineINT( Sigmoid(), (test_data(),), Sigmoid.aten_op, @@ -110,8 +107,8 @@ def test_sigmoid_tosa_BI(test_data): }, strict=False, ) -def test_sigmoid_tosa_BI_add_sigmoid(test_data): - pipeline = TosaPipelineBI( +def test_sigmoid_tosa_INT_add_sigmoid(test_data): + pipeline = TosaPipelineINT( SigmoidAddSigmoid(), (test_data(),), Sigmoid.aten_op, @@ -133,7 +130,7 @@ def test_sigmoid_tosa_BI_add_sigmoid(test_data): "test_data", test_data_suite, ) -def test_sigmoid_u55_BI(test_data): +def test_sigmoid_u55_INT(test_data): pipeline = OpNotSupportedPipeline( Sigmoid(), (test_data(),), @@ -149,7 +146,7 @@ def test_sigmoid_u55_BI(test_data): "test_data", test_data_suite, ) -def test_sigmoid_u55_BI_add_sigmoid(test_data): +def test_sigmoid_u55_INT_add_sigmoid(test_data): pipeline = OpNotSupportedPipeline( SigmoidAddSigmoid(), (test_data(),), @@ -164,8 +161,8 @@ def test_sigmoid_u55_BI_add_sigmoid(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_sigmoid_u85_BI(test_data): - pipeline = EthosU85PipelineBI( +def test_sigmoid_u85_INT(test_data): + pipeline = EthosU85PipelineINT( Sigmoid(), (test_data(),), Sigmoid.aten_op, @@ -185,8 +182,8 @@ def test_sigmoid_u85_BI(test_data): ) @pytest.mark.flaky(reruns=5) # MLETORCH-787: Investigate int16-int8 rescaling precision @common.XfailIfNoCorstone320 -def test_sigmoid_u85_BI_add_sigmoid(test_data): - pipeline = EthosU85PipelineBI( +def test_sigmoid_u85_INT_add_sigmoid(test_data): + pipeline = EthosU85PipelineINT( SigmoidAddSigmoid(), (test_data(),), Sigmoid.aten_op, diff --git a/backends/arm/test/ops/test_sigmoid_32bit.py b/backends/arm/test/ops/test_sigmoid_32bit.py index 9cbfe89a31a..7d2e649bcd8 100644 --- a/backends/arm/test/ops/test_sigmoid_32bit.py +++ b/backends/arm/test/ops/test_sigmoid_32bit.py @@ -8,9 +8,9 @@ from executorch.backends.arm.quantizer.quantization_config import QuantizationConfig from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, + TosaPipelineINT, ) from executorch.backends.arm.tosa_specification import TosaSpecification from executorch.backends.xnnpack.test.tester import Quantize @@ -56,9 +56,6 @@ def _get_32_bit_quant_config(): def get_32bit_sigmoid_quantizer(u55_config=False): tosa_version = conftest.get_option("tosa_version") tosa_profiles = { - "0.80": TosaSpecification.create_from_string( - "TOSA-0.80+BI" + ("+u55" if u55_config else "") - ), "1.0": TosaSpecification.create_from_string( "TOSA-1.0+INT" + ("+u55" if u55_config else "") ), @@ -106,8 +103,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_tosa_BI(test_data): - pipeline = TosaPipelineBI( +def test_sigmoid_tosa_INT(test_data): + pipeline = TosaPipelineINT( Sigmoid(), (test_data(),), Sigmoid.aten_op, @@ -119,8 +116,8 @@ def test_sigmoid_tosa_BI(test_data): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_tosa_BI_add_sigmoid(test_data): - pipeline = TosaPipelineBI( +def test_sigmoid_tosa_INT_add_sigmoid(test_data): + pipeline = TosaPipelineINT( SigmoidAddSigmoid(), (test_data(),), Sigmoid.aten_op, @@ -132,7 +129,7 @@ def test_sigmoid_tosa_BI_add_sigmoid(test_data): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_u55_BI(test_data): +def test_sigmoid_u55_INT(test_data): pipeline = OpNotSupportedPipeline( Sigmoid(), (test_data(),), @@ -145,7 +142,7 @@ def test_sigmoid_u55_BI(test_data): @common.parametrize("test_data", test_data_suite) -def test_sigmoid_u55_BI_add_sigmoid(test_data): +def test_sigmoid_u55_INT_add_sigmoid(test_data): pipeline = OpNotSupportedPipeline( SigmoidAddSigmoid(), (test_data(),), @@ -160,8 +157,8 @@ def test_sigmoid_u55_BI_add_sigmoid(test_data): @common.parametrize("test_data", test_data_suite) @common.XfailIfNoCorstone320 -def test_sigmoid_u85_BI(test_data): - pipeline = EthosU85PipelineBI( +def test_sigmoid_u85_INT(test_data): + pipeline = EthosU85PipelineINT( Sigmoid(), (test_data(),), Sigmoid.aten_op, @@ -177,8 +174,8 @@ def test_sigmoid_u85_BI(test_data): test_data_suite, ) @common.XfailIfNoCorstone320 -def test_sigmoid_u85_BI_add_sigmoid(test_data): - pipeline = EthosU85PipelineBI( +def test_sigmoid_u85_INT_add_sigmoid(test_data): + pipeline = EthosU85PipelineINT( SigmoidAddSigmoid(), (test_data(),), Sigmoid.aten_op, diff --git a/backends/arm/test/ops/test_sign.py b/backends/arm/test/ops/test_sign.py index 1747570e35f..5e9a5c679b6 100644 --- a/backends/arm/test/ops/test_sign.py +++ b/backends/arm/test/ops/test_sign.py @@ -9,10 +9,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sign.default" @@ -40,8 +40,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_sign_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_sign_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Sign(), (test_data,), aten_op=aten_op, @@ -51,8 +51,8 @@ def test_sign_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sign_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_sign_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Sign(), (test_data,), aten_op=[], @@ -64,8 +64,8 @@ def test_sign_tosa_BI(test_data: Tuple): @common.XfailIfNoCorstone300 @common.parametrize("test_data", test_data_suite) @pytest.mark.xfail(reason="where.self not supported on U55") -def test_sign_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_sign_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sign(), (test_data,), aten_ops=[], @@ -76,8 +76,8 @@ def test_sign_u55_BI(test_data: Tuple): @common.XfailIfNoCorstone320 @common.parametrize("test_data", test_data_suite) -def test_sign_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_sign_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Sign(), (test_data,), aten_ops=[], diff --git a/backends/arm/test/ops/test_silu.py b/backends/arm/test/ops/test_silu.py index e1736bf10e6..c938d2b707e 100644 --- a/backends/arm/test/ops/test_silu.py +++ b/backends/arm/test/ops/test_silu.py @@ -11,10 +11,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) @@ -40,74 +40,74 @@ def forward( "op_silu_rank4_large_randn": lambda: 200 * torch.randn(1, 10, 25, 20) + 1, } - aten_op_MI = "torch.ops.aten.silu.default" - aten_op_inplace_MI = "torch.ops.aten.silu_.default" - aten_op_BI = ["torch.ops.aten.sigmoid.default", "torch.ops.aten.mul.Tensor"] + aten_op_FP = "torch.ops.aten.silu.default" + aten_op_inplace_FP = "torch.ops.aten.silu_.default" + aten_op_INT = ["torch.ops.aten.sigmoid.default", "torch.ops.aten.mul.Tensor"] @common.parametrize("test_data", Silu.test_data) -def test_silu_tosa_MI(test_data: input_t): +def test_silu_tosa_FP(test_data: input_t): silu_data = (test_data(), False) - pipeline = TosaPipelineMI[input_t](Silu(), silu_data, Silu.aten_op_MI) + pipeline = TosaPipelineFP[input_t](Silu(), silu_data, Silu.aten_op_FP) pipeline.run() @common.parametrize("test_data", Silu.test_data) -def test_silu_tosa_MI_inplace(test_data: input_t): +def test_silu_tosa_FP_inplace(test_data: input_t): silu_data = (test_data(), True) - pipeline = TosaPipelineMI[input_t](Silu(), silu_data, Silu.aten_op_inplace_MI) + pipeline = TosaPipelineFP[input_t](Silu(), silu_data, Silu.aten_op_inplace_FP) pipeline.run() @common.parametrize("test_data", Silu.test_data) -def test_silu_tosa_BI(test_data: input_t): +def test_silu_tosa_INT(test_data: input_t): silu_data = (test_data(), False) - pipeline = TosaPipelineBI[input_t](Silu(), silu_data, Silu.aten_op_BI) + pipeline = TosaPipelineINT[input_t](Silu(), silu_data, Silu.aten_op_INT) pipeline.run() @common.parametrize("test_data", Silu.test_data) -def test_silu_tosa_BI_inplace(test_data: input_t): +def test_silu_tosa_INT_inplace(test_data: input_t): silu_data = (test_data(), True) - pipeline = TosaPipelineBI[input_t](Silu(), silu_data, Silu.aten_op_BI) + pipeline = TosaPipelineINT[input_t](Silu(), silu_data, Silu.aten_op_INT) pipeline.run() @common.parametrize("test_data", Silu.test_data) @common.XfailIfNoCorstone300 -def test_silu_u55_BI(test_data: input_t): +def test_silu_u55_INT(test_data: input_t): silu_data = (test_data(), False) - pipeline = EthosU55PipelineBI[input_t]( - Silu(), silu_data, Silu.aten_op_BI, run_on_fvp=True + pipeline = EthosU55PipelineINT[input_t]( + Silu(), silu_data, Silu.aten_op_INT, run_on_fvp=True ) pipeline.run() @common.parametrize("test_data", Silu.test_data) @common.XfailIfNoCorstone300 -def test_silu_u55_BI_inplace(test_data: input_t): +def test_silu_u55_INT_inplace(test_data: input_t): silu_data = (test_data(), True) - pipeline = EthosU55PipelineBI[input_t]( - Silu(), silu_data, Silu.aten_op_BI, run_on_fvp=True + pipeline = EthosU55PipelineINT[input_t]( + Silu(), silu_data, Silu.aten_op_INT, run_on_fvp=True ) pipeline.run() @common.parametrize("test_data", Silu.test_data) @common.XfailIfNoCorstone320 -def test_silu_u85_BI(test_data: input_t): +def test_silu_u85_INT(test_data: input_t): silu_data = (test_data(), False) - pipeline = EthosU85PipelineBI[input_t]( - Silu(), silu_data, Silu.aten_op_BI, run_on_fvp=True + pipeline = EthosU85PipelineINT[input_t]( + Silu(), silu_data, Silu.aten_op_INT, run_on_fvp=True ) pipeline.run() @common.parametrize("test_data", Silu.test_data) @common.XfailIfNoCorstone320 -def test_silu_u85_BI_inplace(test_data: input_t): +def test_silu_u85_INT_inplace(test_data: input_t): silu_data = (test_data(), True) - pipeline = EthosU85PipelineBI[input_t]( - Silu(), silu_data, Silu.aten_op_BI, run_on_fvp=True + pipeline = EthosU85PipelineINT[input_t]( + Silu(), silu_data, Silu.aten_op_INT, run_on_fvp=True ) pipeline.run() diff --git a/backends/arm/test/ops/test_sin.py b/backends/arm/test/ops/test_sin.py index 7f1f9f569af..6f9037e1021 100644 --- a/backends/arm/test/ops/test_sin.py +++ b/backends/arm/test/ops/test_sin.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sin.default" @@ -37,8 +37,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_sin_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_sin_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Sin(), (test_data,), aten_op, @@ -49,8 +49,8 @@ def test_sin_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sin_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_sin_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Sin(), (test_data,), aten_op, @@ -60,8 +60,8 @@ def test_sin_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sin_tosa_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_sin_tosa_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sin(), (test_data,), aten_op, @@ -72,8 +72,8 @@ def test_sin_tosa_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sin_tosa_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_sin_tosa_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Sin(), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_sinh.py b/backends/arm/test/ops/test_sinh.py index fd6cbf2b65b..ff486e6a4b8 100644 --- a/backends/arm/test/ops/test_sinh.py +++ b/backends/arm/test/ops/test_sinh.py @@ -8,10 +8,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sinh.default" @@ -42,8 +42,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_sinh_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_sinh_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Sinh(), (test_data,), aten_op, @@ -53,8 +53,8 @@ def test_sinh_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_sinh_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_sinh_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Sinh(), (test_data,), aten_op=aten_op, exir_op=exir_op ) pipeline.run() @@ -62,8 +62,8 @@ def test_sinh_tosa_BI(test_data: Tuple): @common.XfailIfNoCorstone300 @common.parametrize("test_data", test_data_suite) -def test_sinh_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_sinh_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sinh(), (test_data,), aten_ops=aten_op, exir_ops=exir_op ) pipeline.run() @@ -71,8 +71,8 @@ def test_sinh_u55_BI(test_data: Tuple): @common.XfailIfNoCorstone320 @common.parametrize("test_data", test_data_suite) -def test_sinh_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_sinh_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Sinh(), (test_data,), aten_ops=aten_op, exir_ops=exir_op ) pipeline.run() diff --git a/backends/arm/test/ops/test_slice.py b/backends/arm/test/ops/test_slice.py index 6ae12c41657..8fcf343dd57 100644 --- a/backends/arm/test/ops/test_slice.py +++ b/backends/arm/test/ops/test_slice.py @@ -12,10 +12,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.slice.Tensor" @@ -43,14 +43,14 @@ def forward(self, x: torch.Tensor, s: list[tuple[int, int]]): @common.parametrize("test_data", test_data_suite) -def test_slice_tensor_tosa_MI(test_data: torch.Tensor): - pipeline = TosaPipelineMI[input_t1](Slice(), test_data(), aten_op, exir_op) +def test_slice_tensor_tosa_FP(test_data: torch.Tensor): + pipeline = TosaPipelineFP[input_t1](Slice(), test_data(), aten_op, exir_op) pipeline.run() @common.parametrize("test_data", test_data_suite) -def test_slice_tensor_tosa_BI_nchw(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_slice_tensor_tosa_INT_nchw(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Slice(), test_data(), aten_op, @@ -60,8 +60,8 @@ def test_slice_tensor_tosa_BI_nchw(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_slice_tensor_tosa_BI_nhwc(test_data: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_slice_tensor_tosa_INT_nhwc(test_data: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Slice(), test_data(), aten_op, @@ -71,8 +71,8 @@ def test_slice_tensor_tosa_BI_nhwc(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_slice_tensor_u55_BI(test_data: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_slice_tensor_u55_INT(test_data: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Slice(), test_data(), aten_ops=[], @@ -83,8 +83,8 @@ def test_slice_tensor_u55_BI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_slice_tensor_u85_BI(test_data: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_slice_tensor_u85_INT(test_data: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Slice(), test_data(), aten_ops=[], diff --git a/backends/arm/test/ops/test_softmax.py b/backends/arm/test/ops/test_softmax.py index 5ab616c0eea..db309ca1ab9 100644 --- a/backends/arm/test/ops/test_softmax.py +++ b/backends/arm/test/ops/test_softmax.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.softmax.default" # Used for checking that we do not have softmax in the graph after decompose @@ -42,9 +42,9 @@ def forward(self, x): @common.parametrize("test_data", Softmax.test_data) -def test_softmax_tosa_MI(test_data): +def test_softmax_tosa_FP(test_data): data, dim = test_data() - pipeline = TosaPipelineMI[input_t1](Softmax(dim), data, []) + pipeline = TosaPipelineFP[input_t1](Softmax(dim), data, []) pipeline.add_stage_after( "to_edge_transform_and_lower", pipeline.tester.check_not, [exir_op] ) @@ -52,9 +52,9 @@ def test_softmax_tosa_MI(test_data): @common.parametrize("test_data", Softmax.test_data) -def test_softmax_tosa_BI(test_data): +def test_softmax_tosa_INT(test_data): data, dim = test_data() - pipeline = TosaPipelineBI[input_t1](Softmax(dim), data, []) + pipeline = TosaPipelineINT[input_t1](Softmax(dim), data, []) pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op]) pipeline.change_args("run_method_and_compare_outputs", qtol=1) pipeline.run() @@ -68,9 +68,9 @@ def test_softmax_tosa_BI(test_data): }, ) @common.XfailIfNoCorstone300 -def test_softmax_u55_BI(test_data): +def test_softmax_u55_INT(test_data): data, dim = test_data() - pipeline = EthosU55PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=True) + pipeline = EthosU55PipelineINT[input_t1](Softmax(dim), data, [], run_on_fvp=True) pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op]) pipeline.change_args("run_method_and_compare_outputs", qtol=1) pipeline.run() @@ -84,9 +84,9 @@ def test_softmax_u55_BI(test_data): }, ) @common.XfailIfNoCorstone320 -def test_softmax_u85_BI(test_data): +def test_softmax_u85_INT(test_data): data, dim = test_data() - pipeline = EthosU85PipelineBI[input_t1](Softmax(dim), data, [], run_on_fvp=True) + pipeline = EthosU85PipelineINT[input_t1](Softmax(dim), data, [], run_on_fvp=True) pipeline.add_stage_after("quantize", pipeline.tester.check_not, [aten_op]) pipeline.change_args("run_method_and_compare_outputs", qtol=1) pipeline.run() diff --git a/backends/arm/test/ops/test_split.py b/backends/arm/test/ops/test_split.py index 90458584995..330f37b35e6 100644 --- a/backends/arm/test/ops/test_split.py +++ b/backends/arm/test/ops/test_split.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) exir_op = "executorch_exir_dialects_edge__ops_aten_split_with_sizes_copy_default" @@ -63,9 +63,9 @@ def forward( "test_data", (Split.test_data | Split.test_data_list), ) -def test_split_with_sizes_tosa_MI(test_data: input_t1): +def test_split_with_sizes_tosa_FP(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Split(), test_data(), aten_op=[], @@ -75,9 +75,9 @@ def test_split_with_sizes_tosa_MI(test_data: input_t1): @common.parametrize("test_data", Split.test_data_list) -def test_split_with_sizes_tosa_MI_2(test_data: input_t1): +def test_split_with_sizes_tosa_FP_2(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( SplitWithSizes(), test_data(), aten_op=[], @@ -90,9 +90,9 @@ def test_split_with_sizes_tosa_MI_2(test_data: input_t1): "test_data", (Split.test_data | Split.test_data_list), ) -def test_split_with_sizes_tosa_MI_one_out(test_data: input_t1): +def test_split_with_sizes_tosa_FP_one_out(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( SplitSingleOut(), test_data(), aten_op=[], @@ -105,9 +105,9 @@ def test_split_with_sizes_tosa_MI_one_out(test_data: input_t1): "test_data", (Split.test_data | Split.test_data_list), ) -def test_split_with_sizes_tosa_BI(test_data: input_t1): +def test_split_with_sizes_tosa_INT(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Split(), test_data(), aten_op=[], @@ -120,8 +120,8 @@ def test_split_with_sizes_tosa_BI(test_data: input_t1): "test_data", (Split.test_data | Split.test_data_list), ) -def test_split_with_sizes_u55_BI(test_data: input_t1): - pipeline = EthosU55PipelineBI[input_t1]( +def test_split_with_sizes_u55_INT(test_data: input_t1): + pipeline = EthosU55PipelineINT[input_t1]( Split(), test_data(), aten_ops=[], @@ -135,9 +135,9 @@ def test_split_with_sizes_u55_BI(test_data: input_t1): "test_data", (Split.test_data | Split.test_data_list), ) -def test_split_with_sizes_u85_BI(test_data: input_t1): +def test_split_with_sizes_u85_INT(test_data: input_t1): - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( Split(), test_data(), aten_ops=[], diff --git a/backends/arm/test/ops/test_sqrt.py b/backends/arm/test/ops/test_sqrt.py index 0c79f534656..ee554ce4fd2 100644 --- a/backends/arm/test/ops/test_sqrt.py +++ b/backends/arm/test/ops/test_sqrt.py @@ -9,20 +9,20 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) class Sqrt(torch.nn.Module): input_t = Tuple[torch.Tensor] - aten_op_MI = "torch.ops.aten.sqrt.default" - exir_op_MI = "executorch_exir_dialects_edge__ops_aten_pow_Tensor_Tensor" + aten_op_FP = "torch.ops.aten.sqrt.default" + exir_op_FP = "executorch_exir_dialects_edge__ops_aten_pow_Tensor_Tensor" - aten_op_BI = "torch.ops.aten.pow.Tensor_Scalar" - exir_op_BI = "executorch_exir_dialects_edge__ops_aten_pow_Tensor_Scalar" + aten_op_INT = "torch.ops.aten.pow.Tensor_Scalar" + exir_op_INT = "executorch_exir_dialects_edge__ops_aten_pow_Tensor_Scalar" def __init__(self): super().__init__() @@ -45,35 +45,35 @@ def forward(self, x): @common.parametrize("test_data", Sqrt.test_data) -def test_sqrt_tosa_MI(test_data: Sqrt.input_t): - pipeline = TosaPipelineMI[Sqrt.input_t]( +def test_sqrt_tosa_FP(test_data: Sqrt.input_t): + pipeline = TosaPipelineFP[Sqrt.input_t]( Sqrt(), test_data(), - Sqrt.aten_op_MI, - Sqrt.exir_op_MI, + Sqrt.aten_op_FP, + Sqrt.exir_op_FP, ) pipeline.run() @common.parametrize("test_data", Sqrt.test_data) -def test_sqrt_tosa_BI(test_data: Sqrt.input_t): - pipeline = TosaPipelineBI[Sqrt.input_t]( +def test_sqrt_tosa_INT(test_data: Sqrt.input_t): + pipeline = TosaPipelineINT[Sqrt.input_t]( Sqrt(), test_data(), - Sqrt.aten_op_BI, - Sqrt.exir_op_BI, + Sqrt.aten_op_INT, + Sqrt.exir_op_INT, ) pipeline.run() @common.parametrize("test_data", Sqrt.test_data, fvp_xfails) @common.XfailIfNoCorstone300 -def test_sqrt_u55_BI(test_data: Sqrt.input_t): - pipeline = EthosU55PipelineBI[Sqrt.input_t]( +def test_sqrt_u55_INT(test_data: Sqrt.input_t): + pipeline = EthosU55PipelineINT[Sqrt.input_t]( Sqrt(), test_data(), - Sqrt.aten_op_BI, - Sqrt.exir_op_BI, + Sqrt.aten_op_INT, + Sqrt.exir_op_INT, run_on_fvp=True, ) pipeline.run() @@ -81,12 +81,12 @@ def test_sqrt_u55_BI(test_data: Sqrt.input_t): @common.parametrize("test_data", Sqrt.test_data, fvp_xfails) @common.XfailIfNoCorstone320 -def test_sqrt_u85_BI(test_data: Sqrt.input_t): - pipeline = EthosU85PipelineBI[Sqrt.input_t]( +def test_sqrt_u85_INT(test_data: Sqrt.input_t): + pipeline = EthosU85PipelineINT[Sqrt.input_t]( Sqrt(), test_data(), - Sqrt.aten_op_BI, - Sqrt.exir_op_BI, + Sqrt.aten_op_INT, + Sqrt.exir_op_INT, run_on_fvp=True, ) pipeline.run() diff --git a/backends/arm/test/ops/test_squeeze.py b/backends/arm/test/ops/test_squeeze.py index e5f606c887e..10600169441 100644 --- a/backends/arm/test/ops/test_squeeze.py +++ b/backends/arm/test/ops/test_squeeze.py @@ -14,10 +14,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -57,8 +57,8 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Squeeze.test_parameters) -def test_squeeze_dim_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_squeeze_dim_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Squeeze(), test_data(), aten_op="torch.ops.aten.squeeze.default", @@ -68,8 +68,8 @@ def test_squeeze_dim_tosa_MI(test_data: Tuple): @common.parametrize("test_data", Squeeze.test_parameters) -def test_squeeze_dim_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_squeeze_dim_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Squeeze(), test_data(), aten_op="torch.ops.aten.squeeze.default", @@ -80,8 +80,8 @@ def test_squeeze_dim_tosa_BI(test_data: Tuple): @common.parametrize("test_data", Squeeze.test_parameters) @common.XfailIfNoCorstone300 -def test_squeeze_dim_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_squeeze_dim_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Squeeze(), test_data(), aten_ops="torch.ops.aten.squeeze.default", @@ -93,8 +93,8 @@ def test_squeeze_dim_u55_BI(test_data: Tuple): @common.parametrize("test_data", Squeeze.test_parameters) @common.XfailIfNoCorstone320 -def test_squeeze_dim_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_squeeze_dim_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Squeeze(), test_data(), aten_ops="torch.ops.aten.squeeze.default", @@ -105,8 +105,8 @@ def test_squeeze_dim_u85_BI(test_data: Tuple): @common.parametrize("test_data", SqueezeDim.test_parameters) -def test_squeeze_dim_tosa_MI_2(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_squeeze_dim_tosa_FP_2(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( SqueezeDim(), test_data(), aten_op="torch.ops.aten.squeeze.dim", @@ -116,8 +116,8 @@ def test_squeeze_dim_tosa_MI_2(test_data: Tuple): @common.parametrize("test_data", SqueezeDim.test_parameters) -def test_squeeze_dim_tosa_BI_2(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_squeeze_dim_tosa_INT_2(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( SqueezeDim(), test_data(), aten_op="torch.ops.aten.squeeze.dim", @@ -128,8 +128,8 @@ def test_squeeze_dim_tosa_BI_2(test_data: Tuple): @common.parametrize("test_data", SqueezeDim.test_parameters) @common.XfailIfNoCorstone300 -def test_squeeze_dim_u55_BI_2(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_squeeze_dim_u55_INT_2(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( SqueezeDim(), test_data(), aten_ops="torch.ops.aten.squeeze.dim", @@ -141,8 +141,8 @@ def test_squeeze_dim_u55_BI_2(test_data: Tuple): @common.parametrize("test_data", SqueezeDim.test_parameters) @common.XfailIfNoCorstone320 -def test_squeeze_dim_u85_BI_2(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_squeeze_dim_u85_INT_2(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( SqueezeDim(), test_data(), aten_ops="torch.ops.aten.squeeze.dim", @@ -153,8 +153,8 @@ def test_squeeze_dim_u85_BI_2(test_data: Tuple): @common.parametrize("test_data", SqueezeDims.test_parameters) -def test_squeeze_dims_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_squeeze_dims_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( SqueezeDims(), test_data(), aten_op="torch.ops.aten.squeeze.dims", @@ -164,8 +164,8 @@ def test_squeeze_dims_tosa_MI(test_data: Tuple): @common.parametrize("test_data", SqueezeDims.test_parameters) -def test_squeeze_dims_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_squeeze_dims_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( SqueezeDims(), test_data(), aten_op="torch.ops.aten.squeeze.dims", @@ -176,8 +176,8 @@ def test_squeeze_dims_tosa_BI(test_data: Tuple): @common.parametrize("test_data", SqueezeDims.test_parameters) @common.XfailIfNoCorstone300 -def test_squeeze_dims_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_squeeze_dims_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( SqueezeDims(), test_data(), aten_ops="torch.ops.aten.squeeze.dims", @@ -189,8 +189,8 @@ def test_squeeze_dims_u55_BI(test_data: Tuple): @common.parametrize("test_data", SqueezeDims.test_parameters) @common.XfailIfNoCorstone320 -def test_squeeze_dims_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_squeeze_dims_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( SqueezeDims(), test_data(), aten_ops="torch.ops.aten.squeeze.dims", diff --git a/backends/arm/test/ops/test_sub.py b/backends/arm/test/ops/test_sub.py index 5957e27d5a9..09f5884b1c4 100644 --- a/backends/arm/test/ops/test_sub.py +++ b/backends/arm/test/ops/test_sub.py @@ -10,10 +10,10 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sub.Tensor" @@ -63,9 +63,9 @@ def forward(self, x: torch.Tensor, y: torch.Tensor): @common.parametrize("test_data", sub_test_data) -def test_sub_tensor_tosa_MI(test_data): - """Test Subtraction (TOSA MI)""" - pipeline = TosaPipelineMI[input_t1]( +def test_sub_tensor_tosa_FP(test_data): + """Test Subtraction (TOSA FP)""" + pipeline = TosaPipelineFP[input_t1]( Sub(), test_data(), aten_op, @@ -75,9 +75,9 @@ def test_sub_tensor_tosa_MI(test_data): @common.parametrize("test_data", sub2_test_data) -def test_sub_tensor_tosa_MI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): - """Test Two-Operand Subtraction (TOSA MI)""" - pipeline = TosaPipelineMI[input_t2]( +def test_sub_tensor_tosa_FP_2(test_data: Tuple[torch.Tensor, torch.Tensor]): + """Test Two-Operand Subtraction (TOSA FP)""" + pipeline = TosaPipelineFP[input_t2]( Sub2(), test_data(), aten_op, @@ -87,9 +87,9 @@ def test_sub_tensor_tosa_MI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): @common.parametrize("test_data", sub_test_data) -def test_sub_tensor_tosa_BI(test_data): - """Test Subtraction (TOSA BI)""" - pipeline = TosaPipelineBI[input_t1]( +def test_sub_tensor_tosa_INT(test_data): + """Test Subtraction (TOSA INT)""" + pipeline = TosaPipelineINT[input_t1]( Sub(), test_data(), aten_op, @@ -99,9 +99,9 @@ def test_sub_tensor_tosa_BI(test_data): @common.parametrize("test_data", sub2_test_data) -def test_sub_tensor_tosa_BI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): - """Test Two-Operand Subtraction (TOSA BI)""" - pipeline = TosaPipelineBI[input_t2]( +def test_sub_tensor_tosa_INT_2(test_data: Tuple[torch.Tensor, torch.Tensor]): + """Test Two-Operand Subtraction (TOSA INT)""" + pipeline = TosaPipelineINT[input_t2]( Sub2(), test_data(), aten_op, @@ -112,9 +112,9 @@ def test_sub_tensor_tosa_BI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): @common.parametrize("test_data", sub_test_data, fvp_sub_xfails) @common.XfailIfNoCorstone300 -def test_sub_tensor_u55_BI(test_data): +def test_sub_tensor_u55_INT(test_data): """Test Subtraction on Ethos-U55 (FVP Mode)""" - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( Sub(), test_data(), aten_op, @@ -126,9 +126,9 @@ def test_sub_tensor_u55_BI(test_data): @common.parametrize("test_data", sub2_test_data, fvp_sub2_xfails) @common.XfailIfNoCorstone300 -def test_sub_tensor_u55_BI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): +def test_sub_tensor_u55_INT_2(test_data: Tuple[torch.Tensor, torch.Tensor]): """Test Two-Operand Subtraction on Ethos-U55 (FVP Mode)""" - pipeline = EthosU55PipelineBI[input_t2]( + pipeline = EthosU55PipelineINT[input_t2]( Sub2(), test_data(), aten_op, @@ -140,9 +140,9 @@ def test_sub_tensor_u55_BI_2(test_data: Tuple[torch.Tensor, torch.Tensor]): @common.parametrize("test_data", sub_test_data, fvp_sub_xfails) @common.XfailIfNoCorstone320 -def test_sub_tensor_u85_BI_2(test_data): +def test_sub_tensor_u85_INT_2(test_data): """Test Subtraction on Ethos-U85 (FVP Mode)""" - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( Sub(), test_data(), aten_op, @@ -154,9 +154,9 @@ def test_sub_tensor_u85_BI_2(test_data): @common.parametrize("test_data", sub2_test_data, fvp_sub2_xfails) @common.XfailIfNoCorstone320 -def test_sub_tensor_u85_BI(test_data: Tuple[torch.Tensor, torch.Tensor]): +def test_sub_tensor_u85_INT(test_data: Tuple[torch.Tensor, torch.Tensor]): """Test Two-Operand Subtraction on Ethos-U85 (FVP Mode)""" - pipeline = EthosU85PipelineBI[input_t2]( + pipeline = EthosU85PipelineINT[input_t2]( Sub2(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_sum.py b/backends/arm/test/ops/test_sum.py index c1e958174cf..13e92fabb9b 100644 --- a/backends/arm/test/ops/test_sum.py +++ b/backends/arm/test/ops/test_sum.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.sum.dim_IntList" @@ -41,8 +41,8 @@ def forward(self, x: torch.Tensor, dim: int, keepdim: bool): @common.parametrize("test_data", Sum.test_parameters) -def test_sum_dim_intlist_tosa_MI(test_data: input_t1): - pipeline = TosaPipelineMI[input_t1]( +def test_sum_dim_intlist_tosa_FP(test_data: input_t1): + pipeline = TosaPipelineFP[input_t1]( Sum(), test_data(), aten_op, @@ -52,8 +52,8 @@ def test_sum_dim_intlist_tosa_MI(test_data: input_t1): @common.parametrize("test_data", Sum.test_parameters) -def test_sum_dim_intlist_tosa_BI(test_data: input_t1): - pipeline = TosaPipelineBI[input_t1]( +def test_sum_dim_intlist_tosa_INT(test_data: input_t1): + pipeline = TosaPipelineINT[input_t1]( Sum(), test_data(), aten_op, @@ -64,8 +64,8 @@ def test_sum_dim_intlist_tosa_BI(test_data: input_t1): @common.parametrize("test_data", Sum.test_parameters) @common.XfailIfNoCorstone300 -def test_view_u55_BI_1_0(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_view_u55_INT_1_0(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sum(), test_data(), aten_op, @@ -77,8 +77,8 @@ def test_view_u55_BI_1_0(test_data: Tuple): @common.parametrize("test_data", Sum.test_parameters) @common.XfailIfNoCorstone320 -def test_view_u85_BI_1_0(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_view_u85_INT_1_0(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Sum(), test_data(), aten_op, @@ -96,8 +96,8 @@ def test_view_u85_BI_1_0(test_data: Tuple): @common.parametrize("test_data", reject_inputs) -def test_view_u55_BI_not_delegated(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_view_u55_INT_not_delegated(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Sum(), test_data(), aten_op, diff --git a/backends/arm/test/ops/test_tanh.py b/backends/arm/test/ops/test_tanh.py index 73d51cb8c3e..1bd746d7b24 100644 --- a/backends/arm/test/ops/test_tanh.py +++ b/backends/arm/test/ops/test_tanh.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.tanh.default" @@ -40,8 +40,8 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_tanh_tosa_MI(test_data: Tuple): - pipeline = TosaPipelineMI[input_t1]( +def test_tanh_tosa_FP(test_data: Tuple): + pipeline = TosaPipelineFP[input_t1]( Tanh(), (test_data(),), aten_op, @@ -51,8 +51,8 @@ def test_tanh_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_tanh_tosa_BI(test_data: Tuple): - pipeline = TosaPipelineBI[input_t1]( +def test_tanh_tosa_INT(test_data: Tuple): + pipeline = TosaPipelineINT[input_t1]( Tanh(), (test_data(),), aten_op, @@ -62,8 +62,8 @@ def test_tanh_tosa_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_tanh_u55_BI(test_data: Tuple): - pipeline = EthosU55PipelineBI[input_t1]( +def test_tanh_u55_INT(test_data: Tuple): + pipeline = EthosU55PipelineINT[input_t1]( Tanh(), (test_data(),), aten_op, @@ -74,8 +74,8 @@ def test_tanh_u55_BI(test_data: Tuple): @common.parametrize("test_data", test_data_suite) -def test_tanh_u85_BI(test_data: Tuple): - pipeline = EthosU85PipelineBI[input_t1]( +def test_tanh_u85_INT(test_data: Tuple): + pipeline = EthosU85PipelineINT[input_t1]( Tanh(), (test_data(),), aten_op, diff --git a/backends/arm/test/ops/test_to_copy.py b/backends/arm/test/ops/test_to_copy.py index 9fcd65dc957..f63909c41d0 100644 --- a/backends/arm/test/ops/test_to_copy.py +++ b/backends/arm/test/ops/test_to_copy.py @@ -14,7 +14,7 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( OpNotSupportedPipeline, - TosaPipelineMI, + TosaPipelineFP, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -36,12 +36,12 @@ def forward(self, x: torch.Tensor): quantization. However, the model being exported may have some explicit casting to floating point dtypes. The casting or their decomposition should be rejected during -partition. This test will be coveraged by class TestToCopy_BI. +partition. This test will be coveraged by class TestToCopy_INT. Note: This is also covered by test_scalars.py. """ -_TO_COPY_TEST_DATA_MI = { +_TO_COPY_TEST_DATA_FP = { "rand_fp16": lambda: (torch.rand((1, 2, 3, 4), dtype=torch.float16), torch.float32), "rand_fp32": lambda: (torch.rand((1, 2, 3, 4), dtype=torch.float32), torch.float16), "rand_int8": lambda: ( @@ -59,11 +59,11 @@ def forward(self, x: torch.Tensor): } -@common.parametrize("test_data", _TO_COPY_TEST_DATA_MI) -def test_copy_tosa_MI(test_data: Tuple): +@common.parametrize("test_data", _TO_COPY_TEST_DATA_FP) +def test_copy_tosa_FP(test_data: Tuple): test_tensor, new_dtype = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Cast(new_dtype), (test_tensor,), aten_op=[], @@ -73,13 +73,13 @@ def test_copy_tosa_MI(test_data: Tuple): """ -Casting operations that output floating-point dtypes should be rejected under BI profile, +Casting operations that output floating-point dtypes should be rejected under INT profile, rather than introducing an invalid dtype into the tosa graph. For example, x.to(dtype=torch.float32) will be eventually lowered to exir_ops.edge.dim_order_ops._to_dim_order_copy.default. We should reject this operation in ToCopySupported::is_node_tosa_supported() before it goes into the delegated graph. """ -_TO_COPY_TEST_DATA_BI = { +_TO_COPY_TEST_DATA_INT = { "rand_int8_fp32": lambda: ( torch.randint(-127, 128, (1, 2, 3, 4), dtype=torch.int8), torch.float32, @@ -103,8 +103,8 @@ def test_copy_tosa_MI(test_data: Tuple): } -@common.parametrize("test_data", _TO_COPY_TEST_DATA_BI) -def test_copy_tosa_BI(test_data: Tuple): +@common.parametrize("test_data", _TO_COPY_TEST_DATA_INT) +def test_copy_tosa_INT(test_data: Tuple): test_tensor, new_dtype = test_data() pipeline = OpNotSupportedPipeline[input_t1]( diff --git a/backends/arm/test/ops/test_unbind.py b/backends/arm/test/ops/test_unbind.py index 5de9db9a5ab..d1425719b0b 100644 --- a/backends/arm/test/ops/test_unbind.py +++ b/backends/arm/test/ops/test_unbind.py @@ -9,8 +9,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -34,9 +34,9 @@ def forward(self, x: torch.Tensor) -> Tuple[torch.Tensor]: @common.parametrize("test_data", Unbind.test_data) -def test_unbind_int_tosa_MI(test_data: test_data_t): +def test_unbind_int_tosa_FP(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( Unbind(*init_data), input_data(), Unbind.aten_op, @@ -45,9 +45,9 @@ def test_unbind_int_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", Unbind.test_data) -def test_unbind_int_tosa_BI(test_data: test_data_t): +def test_unbind_int_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( Unbind(*init_data), input_data(), Unbind.aten_op, diff --git a/backends/arm/test/ops/test_unflatten.py b/backends/arm/test/ops/test_unflatten.py index 8a540a8040e..e3bcb32375d 100644 --- a/backends/arm/test/ops/test_unflatten.py +++ b/backends/arm/test/ops/test_unflatten.py @@ -9,8 +9,8 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -35,9 +35,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", Unflatten.test_data) -def test_unflatten_int_tosa_MI(test_data: test_data_t): +def test_unflatten_int_tosa_FP(test_data: test_data_t): module, inputs = test_data() - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( module, inputs, Unflatten.aten_op, @@ -46,9 +46,9 @@ def test_unflatten_int_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", Unflatten.test_data) -def test_unflatten_int_tosa_BI(test_data: test_data_t): +def test_unflatten_int_tosa_INT(test_data: test_data_t): module, inputs = test_data() - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, inputs, Unflatten.aten_op, diff --git a/backends/arm/test/ops/test_unsqueeze.py b/backends/arm/test/ops/test_unsqueeze.py index 4ad238a099a..d192d5289fd 100644 --- a/backends/arm/test/ops/test_unsqueeze.py +++ b/backends/arm/test/ops/test_unsqueeze.py @@ -13,10 +13,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.unsqueeze.default" @@ -34,9 +34,9 @@ def forward(self, x: torch.Tensor, dim): @common.parametrize("test_tensor", Unsqueeze.test_parameters) -def test_unsqueeze_tosa_MI(test_tensor: torch.Tensor): +def test_unsqueeze_tosa_FP(test_tensor: torch.Tensor): for i in range(-test_tensor[0].dim() - 1, test_tensor[0].dim() + 1): - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Unsqueeze(), (*test_tensor, i), aten_op, @@ -46,8 +46,8 @@ def test_unsqueeze_tosa_MI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Unsqueeze.test_parameters) -def test_unsqueeze_tosa_BI(test_tensor: torch.Tensor): - pipeline = TosaPipelineBI[input_t1]( +def test_unsqueeze_tosa_INT(test_tensor: torch.Tensor): + pipeline = TosaPipelineINT[input_t1]( Unsqueeze(), (*test_tensor, 0), aten_op, @@ -58,8 +58,8 @@ def test_unsqueeze_tosa_BI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Unsqueeze.test_parameters) @common.XfailIfNoCorstone300 -def test_unsqueeze_u55_BI(test_tensor: torch.Tensor): - pipeline = EthosU55PipelineBI[input_t1]( +def test_unsqueeze_u55_INT(test_tensor: torch.Tensor): + pipeline = EthosU55PipelineINT[input_t1]( Unsqueeze(), (*test_tensor, 0), aten_op, @@ -71,8 +71,8 @@ def test_unsqueeze_u55_BI(test_tensor: torch.Tensor): @common.parametrize("test_tensor", Unsqueeze.test_parameters) @common.XfailIfNoCorstone320 -def test_unsqueeze_u85_BI(test_tensor: torch.Tensor): - pipeline = EthosU85PipelineBI[input_t1]( +def test_unsqueeze_u85_INT(test_tensor: torch.Tensor): + pipeline = EthosU85PipelineINT[input_t1]( Unsqueeze(), (*test_tensor, 0), aten_op, diff --git a/backends/arm/test/ops/test_upsample_bilinear2d.py b/backends/arm/test/ops/test_upsample_bilinear2d.py index d1c07c3ab0f..d3b3ce1e303 100644 --- a/backends/arm/test/ops/test_upsample_bilinear2d.py +++ b/backends/arm/test/ops/test_upsample_bilinear2d.py @@ -9,10 +9,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.upsample_bilinear2d.vec" @@ -110,12 +110,12 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite_tosa) -def test_upsample_bilinear2d_vec_tosa_MI_UpsamplingBilinear2d( +def test_upsample_bilinear2d_vec_tosa_FP_UpsamplingBilinear2d( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( UpsamplingBilinear2d(size, scale_factor), (test_data,), aten_op, @@ -127,12 +127,12 @@ def test_upsample_bilinear2d_vec_tosa_MI_UpsamplingBilinear2d( @common.parametrize("test_data", test_data_suite_tosa) -def test_upsample_bilinear2d_vec_tosa_MI_Upsample( +def test_upsample_bilinear2d_vec_tosa_FP_Upsample( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -145,12 +145,12 @@ def test_upsample_bilinear2d_vec_tosa_MI_Upsample( @common.parametrize("test_data", test_data_suite_tosa) -def test_upsample_bilinear2d_vec_tosa_MI_Interpolate( +def test_upsample_bilinear2d_vec_tosa_FP_Interpolate( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Interpolate(size, scale_factor), (test_data,), aten_op, @@ -162,12 +162,12 @@ def test_upsample_bilinear2d_vec_tosa_MI_Interpolate( @common.parametrize("test_data", test_data_suite_tosa) -def test_upsample_bilinear2d_vec_tosa_BI_intropolate( +def test_upsample_bilinear2d_vec_tosa_INT_intropolate( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( UpsamplingBilinear2d(size, scale_factor), (test_data,), aten_op, @@ -179,12 +179,12 @@ def test_upsample_bilinear2d_vec_tosa_BI_intropolate( @common.parametrize("test_data", test_data_suite_tosa) -def test_upsample_bilinear2d_vec_tosa_BI_Upsample( +def test_upsample_bilinear2d_vec_tosa_INT_Upsample( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -197,7 +197,7 @@ def test_upsample_bilinear2d_vec_tosa_BI_Upsample( @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_bilinear2d_vec_U55_BI_Upsample_not_delegated( +def test_upsample_bilinear2d_vec_U55_INT_Upsample_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data @@ -215,7 +215,7 @@ def test_upsample_bilinear2d_vec_U55_BI_Upsample_not_delegated( @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_bilinear2d_vec_U55_BI_Interpolate_not_delegated( +def test_upsample_bilinear2d_vec_U55_INT_Interpolate_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data @@ -233,7 +233,7 @@ def test_upsample_bilinear2d_vec_U55_BI_Interpolate_not_delegated( @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_bilinear2d_vec_U55_BI_UpsamplingBilinear2d_not_delegated( +def test_upsample_bilinear2d_vec_U55_INT_UpsamplingBilinear2d_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data @@ -251,10 +251,10 @@ def test_upsample_bilinear2d_vec_U55_BI_UpsamplingBilinear2d_not_delegated( @common.parametrize("test_data", test_data_suite_Uxx) @common.XfailIfNoCorstone320 -def test_upsample_bilinear2d_vec_U85_BI_Upsample(test_data: input_t1): +def test_upsample_bilinear2d_vec_U85_INT_Upsample(test_data: input_t1): test_data, size, scale_factor, compare_outputs = test_data - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -269,12 +269,12 @@ def test_upsample_bilinear2d_vec_U85_BI_Upsample(test_data: input_t1): @common.parametrize("test_data", test_data_suite_Uxx) @common.XfailIfNoCorstone320 -def test_upsample_bilinear2d_vec_U85_BI_Interpolate( +def test_upsample_bilinear2d_vec_U85_INT_Interpolate( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( Interpolate(size, scale_factor), (test_data,), aten_op, @@ -289,12 +289,12 @@ def test_upsample_bilinear2d_vec_U85_BI_Interpolate( @common.parametrize("test_data", test_data_suite_Uxx) @common.XfailIfNoCorstone320 -def test_upsample_bilinear2d_vec_U85_BI_UpsamplingBilinear2d( +def test_upsample_bilinear2d_vec_U85_INT_UpsamplingBilinear2d( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( UpsamplingBilinear2d(size, scale_factor), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_upsample_nearest2d.py b/backends/arm/test/ops/test_upsample_nearest2d.py index dee32249a39..d0a13b3036d 100644 --- a/backends/arm/test/ops/test_upsample_nearest2d.py +++ b/backends/arm/test/ops/test_upsample_nearest2d.py @@ -10,8 +10,8 @@ from executorch.backends.arm.test.tester.test_pipeline import ( OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.upsample_nearest2d.vec" @@ -104,10 +104,10 @@ def forward(self, x): @common.parametrize("test_data", test_data_suite) -def test_upsample_nearest2d_vec_tosa_MI(test_data: torch.Tensor): +def test_upsample_nearest2d_vec_tosa_FP(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( UpsamplingNearest2d(size, scale_factor), (test_data,), aten_op, @@ -119,10 +119,10 @@ def test_upsample_nearest2d_vec_tosa_MI(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_upsample_nearest2d_vec_tosa_MI_nearest(test_data: torch.Tensor): +def test_upsample_nearest2d_vec_tosa_FP_nearest(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -135,10 +135,10 @@ def test_upsample_nearest2d_vec_tosa_MI_nearest(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_upsample_nearest2d_vec_tosa_MI_interpolate(test_data: torch.Tensor): +def test_upsample_nearest2d_vec_tosa_FP_interpolate(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Interpolate(size, scale_factor), (test_data,), aten_op, @@ -150,10 +150,10 @@ def test_upsample_nearest2d_vec_tosa_MI_interpolate(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_upsample_nearest2d_vec_tosa_BI_interpolate(test_data: torch.Tensor): +def test_upsample_nearest2d_vec_tosa_INT_interpolate(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( UpsamplingNearest2d(size, scale_factor), (test_data,), aten_op, @@ -165,10 +165,10 @@ def test_upsample_nearest2d_vec_tosa_BI_interpolate(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite) -def test_upsample_nearest2d_vec_tosa_BI_nearest(test_data: torch.Tensor): +def test_upsample_nearest2d_vec_tosa_INT_nearest(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -181,7 +181,7 @@ def test_upsample_nearest2d_vec_tosa_BI_nearest(test_data: torch.Tensor): @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_nearest2d_vec_U55_BI_Upsample_not_delegated( +def test_upsample_nearest2d_vec_U55_INT_Upsample_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data() @@ -199,7 +199,7 @@ def test_upsample_nearest2d_vec_U55_BI_Upsample_not_delegated( @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_nearest2d_vec_U55_BI_Interpolate_not_delegated( +def test_upsample_nearest2d_vec_U55_INT_Interpolate_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data() @@ -217,7 +217,7 @@ def test_upsample_nearest2d_vec_U55_BI_Interpolate_not_delegated( @common.parametrize("test_data", test_data_u55) @common.XfailIfNoCorstone300 -def test_upsample_nearest2d_vec_U55_BI_UpsamplingBilinear2d_not_delegated( +def test_upsample_nearest2d_vec_U55_INT_UpsamplingBilinear2d_not_delegated( test_data: torch.Tensor, ): test_data, size, scale_factor, compare_outputs = test_data() @@ -234,7 +234,7 @@ def test_upsample_nearest2d_vec_U55_BI_UpsamplingBilinear2d_not_delegated( @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_MI_nearest(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_FP_nearest(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=1000) @@ -243,7 +243,7 @@ def test_upsample_nearest2d_dynamic_MI_nearest(test_data: torch.Tensor): dynamic_shapes = {"x": {0: batch_size, 2: input_height, 3: input_width}} - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( UpsamplingNearest2d(size, scale_factor), (test_data,), aten_op, @@ -256,7 +256,7 @@ def test_upsample_nearest2d_dynamic_MI_nearest(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_BI_nearest(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_INT_nearest(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=2) @@ -265,7 +265,7 @@ def test_upsample_nearest2d_dynamic_BI_nearest(test_data: torch.Tensor): dynamic_shapes = {"x": {0: batch_size, 2: input_height, 3: input_width}} - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( UpsamplingNearest2d(size, scale_factor), (test_data,), aten_op, @@ -278,7 +278,7 @@ def test_upsample_nearest2d_dynamic_BI_nearest(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_MI_interpolate(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_FP_interpolate(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=2) @@ -293,7 +293,7 @@ def test_upsample_nearest2d_dynamic_MI_interpolate(test_data: torch.Tensor): } } - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Interpolate(size, scale_factor), (test_data,), aten_op, @@ -306,7 +306,7 @@ def test_upsample_nearest2d_dynamic_MI_interpolate(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_BI_interpolate(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_INT_interpolate(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=2) @@ -321,7 +321,7 @@ def test_upsample_nearest2d_dynamic_BI_interpolate(test_data: torch.Tensor): } } - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Interpolate(size, scale_factor), (test_data,), aten_op, @@ -334,7 +334,7 @@ def test_upsample_nearest2d_dynamic_BI_interpolate(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_MI_upsample(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_FP_upsample(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=1000) @@ -349,7 +349,7 @@ def test_upsample_nearest2d_dynamic_MI_upsample(test_data: torch.Tensor): } } - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, @@ -362,7 +362,7 @@ def test_upsample_nearest2d_dynamic_MI_upsample(test_data: torch.Tensor): @common.parametrize("test_data", test_data_suite_dynamic) -def test_upsample_nearest2d_dynamic_BI_upsample(test_data: torch.Tensor): +def test_upsample_nearest2d_dynamic_INT_upsample(test_data: torch.Tensor): test_data, size, scale_factor, compare_outputs = test_data() batch_size = torch.export.Dim("batch", min=0, max=2) @@ -377,7 +377,7 @@ def test_upsample_nearest2d_dynamic_BI_upsample(test_data: torch.Tensor): } } - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Upsample(size, scale_factor), (test_data,), aten_op, diff --git a/backends/arm/test/ops/test_var.py b/backends/arm/test/ops/test_var.py index ef073a6387f..6e71dca557a 100644 --- a/backends/arm/test/ops/test_var.py +++ b/backends/arm/test/ops/test_var.py @@ -10,10 +10,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, - TosaPipelineMI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineFP, + TosaPipelineINT, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -156,9 +156,9 @@ def forward( @common.parametrize("test_data", Var.test_parameters) -def test_var_dim_tosa_MI_no_dim(test_data: Tuple): +def test_var_dim_tosa_FP_no_dim(test_data: Tuple): test_data, keepdim, correction = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( Var(keepdim, correction), (test_data,), aten_op=[], @@ -168,9 +168,9 @@ def test_var_dim_tosa_MI_no_dim(test_data: Tuple): @common.parametrize("test_data", Var.test_parameters) -def test_var_dim_tosa_BI_no_dim(test_data: Tuple): +def test_var_dim_tosa_INT_no_dim(test_data: Tuple): test_data, keepdim, correction = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( Var(keepdim, correction), (test_data,), aten_op=[], @@ -181,9 +181,9 @@ def test_var_dim_tosa_BI_no_dim(test_data: Tuple): @common.parametrize("test_data", Var.test_parameters) @common.XfailIfNoCorstone300 -def test_var_dim_u55_BI_no_dim(test_data: Tuple): +def test_var_dim_u55_INT_no_dim(test_data: Tuple): test_data, keepdim, correction = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( Var(keepdim, correction), (test_data,), aten_ops=[], @@ -195,9 +195,9 @@ def test_var_dim_u55_BI_no_dim(test_data: Tuple): @common.parametrize("test_data", Var.test_parameters) @common.XfailIfNoCorstone320 -def test_var_dim_u85_BI_no_dim(test_data: Tuple): +def test_var_dim_u85_INT_no_dim(test_data: Tuple): test_data, keepdim, correction = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( Var(keepdim, correction), (test_data,), aten_ops=[], @@ -208,9 +208,9 @@ def test_var_dim_u85_BI_no_dim(test_data: Tuple): @common.parametrize("test_data", VarDim.test_parameters) -def test_var_dim_tosa_MI(test_data: Tuple): +def test_var_dim_tosa_FP(test_data: Tuple): test_data, dim, keepdim, unbiased = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( VarDim(dim, keepdim, unbiased), (test_data,), aten_op=[], @@ -220,10 +220,10 @@ def test_var_dim_tosa_MI(test_data: Tuple): @common.parametrize("test_data", VarDim.test_parameters) -def test_var_dim_tosa_BI(test_data: Tuple): +def test_var_dim_tosa_INT(test_data: Tuple): test_data, dim, keepdim, unbiased = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( VarDim(dim, keepdim, unbiased), (test_data,), aten_op=[], @@ -234,9 +234,9 @@ def test_var_dim_tosa_BI(test_data: Tuple): @common.parametrize("test_data", VarDim.test_parameters_u55) @common.XfailIfNoCorstone300 -def test_var_dim_u55_BI(test_data: Tuple): +def test_var_dim_u55_INT(test_data: Tuple): test_data, dim, keepdim, unbiased = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( VarDim(dim, keepdim, unbiased), (test_data,), aten_ops=[], @@ -248,9 +248,9 @@ def test_var_dim_u55_BI(test_data: Tuple): @common.parametrize("test_data", VarDim.test_parameters) @common.XfailIfNoCorstone320 -def test_var_dim_u85_BI(test_data: Tuple): +def test_var_dim_u85_INT(test_data: Tuple): test_data, dim, keepdim, unbiased = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( VarDim(dim, keepdim, unbiased), (test_data,), aten_ops=[], @@ -261,9 +261,9 @@ def test_var_dim_u85_BI(test_data: Tuple): @common.parametrize("test_data", VarCorrection.test_parameters) -def test_var_dim_tosa_MI_correction(test_data: Tuple): +def test_var_dim_tosa_FP_correction(test_data: Tuple): test_data, dim, keepdim, correction = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( VarCorrection(dim, keepdim, correction), (test_data,), aten_op=[], @@ -273,9 +273,9 @@ def test_var_dim_tosa_MI_correction(test_data: Tuple): @common.parametrize("test_data", VarCorrection.test_parameters) -def test_var_dim_tosa_BI_correction(test_data: Tuple): +def test_var_dim_tosa_INT_correction(test_data: Tuple): test_data, dim, keepdim, correction = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( VarCorrection(dim, keepdim, correction), (test_data,), aten_op=[], @@ -286,9 +286,9 @@ def test_var_dim_tosa_BI_correction(test_data: Tuple): @common.parametrize("test_data", VarCorrection.test_parameters) @common.XfailIfNoCorstone300 -def test_var_dim_u55_BI_correction(test_data: Tuple): +def test_var_dim_u55_INT_correction(test_data: Tuple): test_data, dim, keepdim, correction = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( VarCorrection(dim, keepdim, correction), (test_data,), aten_ops=[], @@ -300,9 +300,9 @@ def test_var_dim_u55_BI_correction(test_data: Tuple): @common.parametrize("test_data", VarCorrection.test_parameters) @common.XfailIfNoCorstone320 -def test_var_dim_u85_BI_correction(test_data: Tuple): +def test_var_dim_u85_INT_correction(test_data: Tuple): test_data, dim, keepdim, correction = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( VarCorrection(dim, keepdim, correction), (test_data,), aten_ops=[], diff --git a/backends/arm/test/ops/test_view.py b/backends/arm/test/ops/test_view.py index fc780b1d32c..0f8024c32dc 100644 --- a/backends/arm/test/ops/test_view.py +++ b/backends/arm/test/ops/test_view.py @@ -13,11 +13,11 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) aten_op = "torch.ops.aten.view.default" @@ -58,9 +58,9 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", View.needs_transpose_tests) -def test_view_tosa_MI(test_data: Tuple): +def test_view_tosa_FP(test_data: Tuple): test_tensor, new_shape = test_data() - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( View(new_shape), (test_tensor,), aten_op, @@ -70,9 +70,9 @@ def test_view_tosa_MI(test_data: Tuple): @common.parametrize("test_data", View.needs_transpose_tests) -def test_view_tosa_BI(test_data: Tuple): +def test_view_tosa_INT(test_data: Tuple): test_tensor, new_shape = test_data() - pipeline = TosaPipelineBI[input_t1]( + pipeline = TosaPipelineINT[input_t1]( View(new_shape), (test_tensor,), aten_op, @@ -98,9 +98,9 @@ def test_view_tosa_BI(test_data: Tuple): @common.parametrize("test_data", View.needs_transpose_tests, xfails=xfails) @common.XfailIfNoCorstone300 -def test_view_u55_BI(test_data: Tuple): +def test_view_u55_INT(test_data: Tuple): test_tensor, new_shape = test_data() - pipeline = EthosU55PipelineBI[input_t1]( + pipeline = EthosU55PipelineINT[input_t1]( View(new_shape), (test_tensor,), aten_op, @@ -111,7 +111,7 @@ def test_view_u55_BI(test_data: Tuple): @common.parametrize("test_data", View.rank_product_too_large, xfails=xfails) @common.XfailIfNoCorstone300 -def test_view_u55_BI_not_delegated(test_data: Tuple): +def test_view_u55_INT_not_delegated(test_data: Tuple): test_tensor, new_shape = test_data() pipeline = OpNotSupportedPipeline[input_t1]( View(new_shape), @@ -126,9 +126,9 @@ def test_view_u55_BI_not_delegated(test_data: Tuple): @common.parametrize("test_data", View.needs_transpose_tests, xfails=xfails) @common.XfailIfNoCorstone320 -def test_view_u85_BI(test_data: Tuple): +def test_view_u85_INT(test_data: Tuple): test_tensor, new_shape = test_data() - pipeline = EthosU85PipelineBI[input_t1]( + pipeline = EthosU85PipelineINT[input_t1]( View(new_shape), (test_tensor,), aten_op, diff --git a/backends/arm/test/ops/test_where.py b/backends/arm/test/ops/test_where.py index a60cf587a3e..c6b65612d59 100644 --- a/backends/arm/test/ops/test_where.py +++ b/backends/arm/test/ops/test_where.py @@ -14,10 +14,10 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU85PipelineBI, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) from executorch.backends.xnnpack.test.tester.tester import Quantize @@ -136,23 +136,23 @@ def scalar_condition(input: torch.Tensor): "float32_scalar_cond": lambda: float32_scalar_cond, } -test_modules_MI = { +test_modules_FP = { **test_modules_common, "float32_tensor_cond_tuple_dtype": lambda: float32_tensor_cond_tuple_dtype, "float32_tensor_cond_tuple_dtype_bool": lambda: float32_tensor_cond_tuple_dtype_bool, "int32_scalar_cond": lambda: int32_scalar_cond, } -test_modules_BI = { +test_modules_INT = { **test_modules_common, } input_t = Tuple[torch.Tensor] -@common.parametrize("test_module", test_modules_MI) -def test_where_self_tosa_MI(test_module): - pipeline = TosaPipelineMI[input_t]( +@common.parametrize("test_module", test_modules_FP) +def test_where_self_tosa_FP(test_module): + pipeline = TosaPipelineFP[input_t]( test_module(), test_module().get_inputs(), aten_op, @@ -161,9 +161,9 @@ def test_where_self_tosa_MI(test_module): pipeline.run() -@common.parametrize("test_module", test_modules_BI) -def test_where_self_tosa_BI(test_module): - pipeline = TosaPipelineBI[input_t]( +@common.parametrize("test_module", test_modules_INT) +def test_where_self_tosa_INT(test_module): + pipeline = TosaPipelineINT[input_t]( test_module(), test_module().get_inputs(), aten_op, @@ -173,9 +173,9 @@ def test_where_self_tosa_BI(test_module): pipeline.run() -@common.parametrize("test_module", test_modules_BI) +@common.parametrize("test_module", test_modules_INT) @common.XfailIfNoCorstone300 -def test_where_self_u55_BI_not_delegated(test_module): +def test_where_self_u55_INT_not_delegated(test_module): # There will be one full_like op which will be delegated. num_delegates = 1 num_exir = 0 @@ -202,11 +202,11 @@ def test_where_self_u55_BI_not_delegated(test_module): pipeline.run() -@common.parametrize("test_module", test_modules_BI) +@common.parametrize("test_module", test_modules_INT) @common.XfailIfNoCorstone320 -def test_where_self_u85_BI(test_module): +def test_where_self_u85_INT(test_module): - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( test_module(), test_module().get_inputs(), aten_op, diff --git a/backends/arm/test/ops/test_zeros.py b/backends/arm/test/ops/test_zeros.py index d8f9dcbee29..c93ba0802f1 100644 --- a/backends/arm/test/ops/test_zeros.py +++ b/backends/arm/test/ops/test_zeros.py @@ -7,11 +7,11 @@ import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, OpNotSupportedPipeline, - TosaPipelineBI, - TosaPipelineMI, + TosaPipelineFP, + TosaPipelineINT, ) input_t = tuple[torch.Tensor] @@ -49,9 +49,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("test_data", ZerosAdd.test_data) -def test_zeros_tosa_MI(test_data: test_data_t): +def test_zeros_tosa_FP(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( ZerosAdd(*init_data), input_data(), ZerosAdd.aten_op, @@ -60,9 +60,9 @@ def test_zeros_tosa_MI(test_data: test_data_t): @common.parametrize("test_data", ZerosAdd.test_data) -def test_zeros_tosa_BI(test_data: test_data_t): +def test_zeros_tosa_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( ZerosAdd(*init_data), input_data(), ZerosAdd.aten_op, @@ -73,9 +73,9 @@ def test_zeros_tosa_BI(test_data: test_data_t): @common.parametrize("test_data", ZerosAdd.test_data) @common.XfailIfNoCorstone300 -def test_zeros_u55_BI(test_data: test_data_t): +def test_zeros_u55_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( ZerosAdd(*init_data), input_data(), ZerosAdd.aten_op, @@ -87,9 +87,9 @@ def test_zeros_u55_BI(test_data: test_data_t): @common.parametrize("test_data", ZerosAdd.test_data) @common.XfailIfNoCorstone320 -def test_zeros_u85_BI(test_data: test_data_t): +def test_zeros_u85_INT(test_data: test_data_t): input_data, init_data = test_data - pipeline = EthosU85PipelineBI[input_t]( + pipeline = EthosU85PipelineINT[input_t]( ZerosAdd(*init_data), input_data(), ZerosAdd.aten_op, @@ -108,7 +108,7 @@ def test_zeros_u85_BI(test_data: test_data_t): "int32_int64": "MLETORCG-716: Do not delegate empty networks to vela", }, ) -def test_zeros_tosa_BI_not_delegated(test_data: test_data_t): +def test_zeros_tosa_INT_not_delegated(test_data: test_data_t): input_data, init_data = test_data pipeline = OpNotSupportedPipeline[input_t]( ZerosAdd(*init_data), input_data(), non_delegated_ops={}, quantize=True diff --git a/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py b/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py index 38c1cf3296e..aa877c355bd 100644 --- a/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py +++ b/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py @@ -30,7 +30,7 @@ def get_inputs(self) -> input_t: return (torch.rand(3, 1),) -def test_expand_to_repeat_tosa_BI(): +def test_expand_to_repeat_tosa_INT(): module = Expand() pipeline = PassPipeline[input_t]( module, diff --git a/backends/arm/test/passes/test_convert_split_to_slice.py b/backends/arm/test/passes/test_convert_split_to_slice.py index 7ca6b71236f..fba52308ff0 100644 --- a/backends/arm/test/passes/test_convert_split_to_slice.py +++ b/backends/arm/test/passes/test_convert_split_to_slice.py @@ -45,7 +45,7 @@ def forward(self, x): @common.parametrize("module", modules) -def test_split_to_slice_tosa_BI(module): +def test_split_to_slice_tosa_INT(module): pipeline = PassPipeline[input_t]( module, module.get_inputs(), diff --git a/backends/arm/test/passes/test_convert_to_clamp.py b/backends/arm/test/passes/test_convert_to_clamp.py index c35dd1c72a5..cc854eeacd7 100644 --- a/backends/arm/test/passes/test_convert_to_clamp.py +++ b/backends/arm/test/passes/test_convert_to_clamp.py @@ -45,7 +45,7 @@ def forward(self, x): @common.parametrize("test_data", HardTanh.test_data) -def test_tosa_MI_hardtahn(test_data: input_t): +def test_tosa_FP_hardtahn(test_data: input_t): module = HardTanh() op_checks_before_pass = { "executorch_exir_dialects_edge__ops_aten_hardtanh_default": 1, @@ -69,7 +69,7 @@ def test_tosa_MI_hardtahn(test_data: input_t): @common.parametrize("test_data", ReLU.test_data) -def test_tosa_MI_relu(test_data: input_t): +def test_tosa_FP_relu(test_data: input_t): module = ReLU() op_checks_before_pass = { "executorch_exir_dialects_edge__ops_aten_relu_default": 1, diff --git a/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py b/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py index 4ae413ce456..80a328f39c6 100644 --- a/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py +++ b/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py @@ -28,7 +28,7 @@ def forward(self, x1: torch.Tensor, x2: torch.Tensor) -> torch.Tensor: @common.parametrize("module", modules) -def test_decompose_cosine_similarity_tosa_BI(module): +def test_decompose_cosine_similarity_tosa_INT(module): ops_after_pass = { "executorch_exir_dialects_edge__ops_aten_mul_Tensor": 5, diff --git a/backends/arm/test/passes/test_decompose_div_pass.py b/backends/arm/test/passes/test_decompose_div_pass.py index 24e18b4f523..b52e264bf11 100644 --- a/backends/arm/test/passes/test_decompose_div_pass.py +++ b/backends/arm/test/passes/test_decompose_div_pass.py @@ -43,7 +43,7 @@ def forward(self, x): @common.parametrize("module", modules) -def test_decompose_div_tosa_MI(module): +def test_decompose_div_tosa_FP(module): pipeline = PassPipeline[input_t]( module, module.get_inputs(), diff --git a/backends/arm/test/passes/test_decompose_layernorm_pass.py b/backends/arm/test/passes/test_decompose_layernorm_pass.py index 9c375ceaf8f..d3c2cd6efd7 100644 --- a/backends/arm/test/passes/test_decompose_layernorm_pass.py +++ b/backends/arm/test/passes/test_decompose_layernorm_pass.py @@ -32,7 +32,7 @@ def get_inputs(self) -> input_t: return (torch.rand(10),) -def test_decompose_layernorm_tosa_MI(): +def test_decompose_layernorm_tosa_FP(): module = LayerNorm() pipeline = PassPipeline[input_t]( module, diff --git a/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py b/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py index de605f666ac..5b4c84edbfd 100644 --- a/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py +++ b/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py @@ -55,7 +55,7 @@ def get_inputs(self) -> input_t: @common.parametrize("module", modules) -def test_decompose_vector_norm_tosa_BI(module): +def test_decompose_vector_norm_tosa_INT(module): """ This test creates a PassPipeline that applies the DecomposeLinearVectorNormPass. The expected primitive ops vary depending on the norm order: diff --git a/backends/arm/test/passes/test_decompose_meandim_pass.py b/backends/arm/test/passes/test_decompose_meandim_pass.py index 84aa954118d..22dda5d9244 100644 --- a/backends/arm/test/passes/test_decompose_meandim_pass.py +++ b/backends/arm/test/passes/test_decompose_meandim_pass.py @@ -10,8 +10,8 @@ from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - TosaPipelineBI, + EthosU55PipelineINT, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor] # Input x @@ -84,10 +84,10 @@ def get_inputs(self) -> input_t: @common.parametrize("module", modules) -def test_decompose_meandim_tosa_BI(module): +def test_decompose_meandim_tosa_INT(module): # Decompose meandim_pass requires initiating the pas with args, which is not supported # by RunPasses in the arm_tester -> PassPipeline cannot be used. - pipeline = TosaPipelineBI[input_t]( + pipeline = TosaPipelineINT[input_t]( module, module.get_inputs(), [], @@ -106,10 +106,10 @@ def test_decompose_meandim_tosa_BI(module): @common.parametrize("module", modules) -def test_decompose_meandim_u55_BI(module): +def test_decompose_meandim_u55_INT(module): # Decompose meandim_pass requires initiating the pas with args, which is not supported # by RunPasses in the arm_tester -> PassPipeline cannot be used. - pipeline = EthosU55PipelineBI[input_t]( + pipeline = EthosU55PipelineINT[input_t]( module, module.get_inputs(), [], run_on_fvp=False ) pipeline.pop_stage("check_not.exir") diff --git a/backends/arm/test/passes/test_decompose_softmax_pass.py b/backends/arm/test/passes/test_decompose_softmax_pass.py index 6c7ed7cfb60..3af1976e3f3 100644 --- a/backends/arm/test/passes/test_decompose_softmax_pass.py +++ b/backends/arm/test/passes/test_decompose_softmax_pass.py @@ -47,7 +47,7 @@ def get_inputs(self) -> input_t: return (torch.rand(2, 3),) -def test_softmax_basic_tosa_MI(): +def test_softmax_basic_tosa_FP(): module = Softmax() pipeline = PassPipeline[input_t]( module, @@ -74,7 +74,7 @@ def test_softmax_basic_tosa_MI(): pipeline.run() -def test_softmax_log_tosa_MI(): +def test_softmax_log_tosa_FP(): module = SoftmaxLog() pipeline = PassPipeline[input_t]( module, diff --git a/backends/arm/test/passes/test_decompose_var_pass.py b/backends/arm/test/passes/test_decompose_var_pass.py index 65357fc2212..c347a2f667c 100644 --- a/backends/arm/test/passes/test_decompose_var_pass.py +++ b/backends/arm/test/passes/test_decompose_var_pass.py @@ -56,7 +56,7 @@ def get_inputs(self) -> input_t: @common.parametrize("module", modules) -def test_decompose_var_tosa_MI(module): +def test_decompose_var_tosa_FP(module): pipeline = PassPipeline[input_t]( module, module.get_inputs(), diff --git a/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py b/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py index bc4b66e5f72..84573878aef 100644 --- a/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py +++ b/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py @@ -10,7 +10,7 @@ from executorch.backends.arm.test.tester.test_pipeline import ( OpNotSupportedPipeline, - TosaPipelineMI, + TosaPipelineFP, ) input_t1 = Tuple[torch.Tensor] # Input x @@ -46,11 +46,11 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", test_data_fp32_input) -def test_decorate_fp32_to_int32_casting_tosa_MI(test_data: Tuple): +def test_decorate_fp32_to_int32_casting_tosa_FP(test_data: Tuple): test_tensor, target_dtype = test_data() module = FP32ToINT32Casting(target_dtype) - pipeline = TosaPipelineMI[input_t1]( + pipeline = TosaPipelineFP[input_t1]( module, (test_tensor,), aten_op=[], @@ -61,11 +61,11 @@ def test_decorate_fp32_to_int32_casting_tosa_MI(test_data: Tuple): @common.parametrize("test_data", test_data_fp32_input) -def test_decorate_fp32_to_int32_casting_tosa_BI(test_data: Tuple): +def test_decorate_fp32_to_int32_casting_tosa_INT(test_data: Tuple): """ - Casting operation involving floating-point dtypes will be rejected in BI/INT profile. + Casting operation involving floating-point dtypes will be rejected in INT/INT profile. Therefore, the DecorateFp32toInt32CastingPass is not required in this profile. - Add a BI test to ensure that such casting is rejected as expected. + Add a INT test to ensure that such casting is rejected as expected. """ test_tensor, target_dtype = test_data() module = FP32ToINT32Casting(target_dtype) diff --git a/backends/arm/test/passes/test_fold_qdq_pass.py b/backends/arm/test/passes/test_fold_qdq_pass.py index 86324d523c6..994676ff442 100644 --- a/backends/arm/test/passes/test_fold_qdq_pass.py +++ b/backends/arm/test/passes/test_fold_qdq_pass.py @@ -24,7 +24,7 @@ def forward(self, x, y): @common.parametrize("test_data", SimpleQuantizeModel.test_data) -def test_fold_qdq_pass_tosa_BI(test_data: input_t): +def test_fold_qdq_pass_tosa_INT(test_data: input_t): """ Tests the FoldAndAnnotateQParamsPass which folds dq/q nodes into the node and stores the quantization parameters in meta. diff --git a/backends/arm/test/passes/test_fuse_batchnorm_pass.py b/backends/arm/test/passes/test_fuse_batchnorm_pass.py index f91c8245270..59fae7cafbd 100644 --- a/backends/arm/test/passes/test_fuse_batchnorm_pass.py +++ b/backends/arm/test/passes/test_fuse_batchnorm_pass.py @@ -138,7 +138,7 @@ def forward(self, x): @common.parametrize("module", modules) -def test_fuse_batchnorm_tosa_MI(module: torch.nn.Module): +def test_fuse_batchnorm_tosa_FP(module: torch.nn.Module): """Test various cases where the batchnorm should either be fused with a previous conv, or converted to a new conv.""" pipeline = PassPipeline[input_t]( diff --git a/backends/arm/test/passes/test_fuse_constant_ops_pass.py b/backends/arm/test/passes/test_fuse_constant_ops_pass.py index 4ec6942430f..5d3160be0a7 100644 --- a/backends/arm/test/passes/test_fuse_constant_ops_pass.py +++ b/backends/arm/test/passes/test_fuse_constant_ops_pass.py @@ -94,7 +94,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: @common.parametrize("module", modules) -def test_fuse_const_ops_tosa_MI(module: torch.nn.Module): +def test_fuse_const_ops_tosa_FP(module: torch.nn.Module): pipeline = PassPipeline[input_t]( module=module, test_data=(torch.rand(1),), @@ -108,7 +108,7 @@ def test_fuse_const_ops_tosa_MI(module: torch.nn.Module): @common.parametrize("module", modules) -def test_fuse_const_ops_tosa_BI(module: torch.nn.Module): +def test_fuse_const_ops_tosa_INT(module: torch.nn.Module): pipeline = PassPipeline[input_t]( module, (torch.rand(10, 10),), diff --git a/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py b/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py index 9a26157ed7e..f6e437ba034 100644 --- a/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py +++ b/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py @@ -12,7 +12,7 @@ ) from executorch.backends.arm.test.tester.test_pipeline import ( PassPipeline, - TosaPipelineMI, + TosaPipelineFP, ) input_t = Tuple[torch.Tensor] # Input x @@ -76,7 +76,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor): return m, n -def test_fuse_equal_placeholders_constants_tosa_MI(): +def test_fuse_equal_placeholders_constants_tosa_FP(): module = FuseWeightsConstants() data = (torch.rand(1, 2, 8),) pipeline = PassPipeline[input_t]( @@ -97,7 +97,7 @@ def test_fuse_equal_placeholders_constants_tosa_MI(): assert "_common" in constant_keys[1], "FuseEqualPlaceholders constants failed" -def test_fuse_equal_placeholders_state_dict_tosa_MI(): +def test_fuse_equal_placeholders_state_dict_tosa_FP(): module = FuseWeightsStateDict() data = (torch.rand(1, 2, 8),) pipeline = PassPipeline[input_t]( @@ -118,7 +118,7 @@ def test_fuse_equal_placeholders_state_dict_tosa_MI(): assert "_common" in state_dict_keys[1], "FuseEqualPlaceholders state_dict failed" -def test_not_fuse_tensor_with_different_type_MI(): +def test_not_fuse_tensor_with_different_type_FP(): module = NotFuseTensorWithDifferentType() data = ( torch.rand( @@ -131,7 +131,7 @@ def test_not_fuse_tensor_with_different_type_MI(): dtype=torch.int, ), ) - pipeline = TosaPipelineMI[input_t]( + pipeline = TosaPipelineFP[input_t]( module, data, aten_op=[], diff --git a/backends/arm/test/passes/test_insert_int64_to_int32_cast_pass.py b/backends/arm/test/passes/test_insert_int64_to_int32_cast_pass.py index d3b8fcc4640..da6eeb59459 100644 --- a/backends/arm/test/passes/test_insert_int64_to_int32_cast_pass.py +++ b/backends/arm/test/passes/test_insert_int64_to_int32_cast_pass.py @@ -25,7 +25,7 @@ def get_inputs(self) -> input_t: ) -def test_int64_model_tosa_MI(): +def test_int64_model_tosa_FP(): module = Int64InputModel() op_checks_before = { "executorch_exir_dialects_edge__ops_aten_embedding_default": 1, diff --git a/backends/arm/test/passes/test_insert_table_ops_pass.py b/backends/arm/test/passes/test_insert_table_ops_pass.py index 88ef96d71ab..029942dd659 100644 --- a/backends/arm/test/passes/test_insert_table_ops_pass.py +++ b/backends/arm/test/passes/test_insert_table_ops_pass.py @@ -27,7 +27,7 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Sigmoid.test_data) -def test_insert_table_tosa_BI(test_data: input_t): +def test_insert_table_tosa_INT(test_data: input_t): module = Sigmoid() pipeline = PassPipeline[input_t]( module, diff --git a/backends/arm/test/passes/test_int32_cast_embedding_pass.py b/backends/arm/test/passes/test_int32_cast_embedding_pass.py index c822b361428..7adca527d75 100644 --- a/backends/arm/test/passes/test_int32_cast_embedding_pass.py +++ b/backends/arm/test/passes/test_int32_cast_embedding_pass.py @@ -25,7 +25,7 @@ def get_inputs(self) -> input_t: ) -def test_int64_model_tosa_MI(): +def test_int64_model_tosa_FP(): module = Int32Embedding() op_checks_before = { "executorch_exir_dialects_edge__ops_aten_embedding_default": 1, diff --git a/backends/arm/test/passes/test_ioquantization_pass.py b/backends/arm/test/passes/test_ioquantization_pass.py index b9599aeffcc..da3b81aa096 100644 --- a/backends/arm/test/passes/test_ioquantization_pass.py +++ b/backends/arm/test/passes/test_ioquantization_pass.py @@ -10,7 +10,7 @@ from executorch.backends.arm.test import common -from executorch.backends.arm.test.tester.test_pipeline import EthosU55PipelineBI +from executorch.backends.arm.test.tester.test_pipeline import EthosU55PipelineINT from executorch.exir.passes.quantize_io_pass import QuantizeInputs, QuantizeOutputs @@ -27,12 +27,12 @@ def forward(self, x, y): @common.parametrize("test_data", SimpleModel.test_data) -def test_ioquantisation_pass_u55_BI(test_data: input_t): +def test_ioquantisation_pass_u55_INT(test_data: input_t): """ Test the executorch/exir/passes/quanize_io_pass pass works(meaning we don't get Q/DQ nodes) on a simple model """ model = SimpleModel() - pipeline = EthosU55PipelineBI( + pipeline = EthosU55PipelineINT( model, test_data, aten_ops=[], diff --git a/backends/arm/test/passes/test_remove_clone_pass.py b/backends/arm/test/passes/test_remove_clone_pass.py index 9f317b44043..dea0bb06f5e 100755 --- a/backends/arm/test/passes/test_remove_clone_pass.py +++ b/backends/arm/test/passes/test_remove_clone_pass.py @@ -28,7 +28,7 @@ def get_inputs(self) -> input_t: return (torch.rand(3, 1),) -def test_remove_clone_tosa_BI(): +def test_remove_clone_tosa_INT(): module = Clone() pipeline = PassPipeline[input_t]( module, diff --git a/backends/arm/test/passes/test_rescale_pass.py b/backends/arm/test/passes/test_rescale_pass.py index 420fdab5f45..0fe72f6d1fe 100644 --- a/backends/arm/test/passes/test_rescale_pass.py +++ b/backends/arm/test/passes/test_rescale_pass.py @@ -12,9 +12,9 @@ import torch.library from executorch.backends.arm.test import common, conftest from executorch.backends.arm.test.tester.test_pipeline import ( - EthosU55PipelineBI, - EthosU85PipelineBI, - TosaPipelineBI, + EthosU55PipelineINT, + EthosU85PipelineINT, + TosaPipelineINT, ) input_t = Tuple[torch.Tensor, torch.Tensor] # Input x @@ -120,7 +120,7 @@ def test_quantized_rescale_tosa_bi(test_data: tuple[torch.Tensor, torch.Tensor]) """Tests a model with many ops that requires rescales. As more ops are quantized to int32 and need the InsertRescalesPass, make sure that they play nicely together.""" module = RescaleNetwork() - pipeline = TosaPipelineBI( + pipeline = TosaPipelineINT( module=module, test_data=test_data, aten_op=[], @@ -137,7 +137,7 @@ def test_quantized_rescale_u55(test_data: tuple[torch.Tensor, torch.Tensor]): """Tests a model with many ops that requires rescales. As more ops are quantized to int32 and need the InsertRescalesPass, make sure that they play nicely together.""" module = RescaleNetwork() - pipeline = EthosU55PipelineBI( + pipeline = EthosU55PipelineINT( module=module, test_data=test_data, aten_ops=[], @@ -153,7 +153,7 @@ def test_quantized_rescale_u85(test_data: tuple[torch.Tensor, torch.Tensor]): """Tests a model with many ops that requires rescales. As more ops are quantized to int32 and need the InsertRescalesPass, make sure that they play nicely together.""" module = RescaleNetwork() - pipeline = EthosU85PipelineBI( + pipeline = EthosU85PipelineINT( module=module, test_data=test_data, aten_ops=[], diff --git a/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py b/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py index a12ac38b866..fc405e21f2a 100644 --- a/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py +++ b/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py @@ -38,7 +38,7 @@ def forward(self, x: torch.Tensor): @common.parametrize("test_data", Repeat.test_data) -def test_unsqueeze_before_repeat_tosa_MI(test_data: input_t): +def test_unsqueeze_before_repeat_tosa_FP(test_data: input_t): """ When rank(input) != number of repeated dimensions (=4 in Repeat module), insert view. diff --git a/backends/arm/test/quantizer/test_generic_annotater.py b/backends/arm/test/quantizer/test_generic_annotater.py index 4a4a333084c..4eaf1c205cc 100644 --- a/backends/arm/test/quantizer/test_generic_annotater.py +++ b/backends/arm/test/quantizer/test_generic_annotater.py @@ -8,7 +8,7 @@ import torch from executorch.backends.arm.quantizer import is_annotated -from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineBI +from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineINT from executorch.backends.test.harness.stages import StageType from torch.fx.passes.utils.source_matcher_utils import get_source_partitions @@ -32,7 +32,7 @@ def example_inputs(self): def check_annotation(model): - pipeline = TosaPipelineBI[input_t1](model, model.example_inputs(), [], []) + pipeline = TosaPipelineINT[input_t1](model, model.example_inputs(), [], []) pipeline.pop_stage("check_count.exir") pipeline.pop_stage("run_method_and_compare_outputs") pipeline.run() diff --git a/backends/arm/test/runner_utils.py b/backends/arm/test/runner_utils.py index 34959e1ed6d..bd06e817d8f 100644 --- a/backends/arm/test/runner_utils.py +++ b/backends/arm/test/runner_utils.py @@ -20,11 +20,8 @@ from executorch.backends.arm.arm_backend import get_tosa_spec, is_tosa from executorch.backends.arm.test.conftest import is_option_enabled -from executorch.backends.arm.tosa_specification import ( - Tosa_0_80, - Tosa_1_00, - TosaSpecification, -) +from executorch.backends.arm.tosa_specification import Tosa_1_00, TosaSpecification + from executorch.exir import ExecutorchProgramManager, ExportedProgram from executorch.exir.backend.compile_spec_schema import CompileSpec from executorch.exir.lowered_backend_module import LoweredBackendModule @@ -467,7 +464,7 @@ def dbg_tosa_fb_to_json(tosa_fb: bytes) -> Dict: major = version._Major() minor = version._Minor() patch = version._Patch() - if not ((major == 1 and minor == 0) or (major == 0 and minor == 80)): + if not ((major == 1 and minor == 0)): raise RuntimeError( f"Unsupported version in TOSA flatbuffer: version={major}.{minor}.{patch}" ) @@ -590,21 +587,7 @@ def run_tosa_graph( inputs_np = [input.numpy() for input in inputs] transpose_data_format(inputs_np, to="NHWC") - if isinstance(tosa_version, Tosa_0_80): - import tosa_tools.v0_80.tosa_reference_model as reference_model - - # tosa_profile: 0 = Base Inference, 1 = Main Inference, 2 = Main Training. - tosa_profile = 1 if tosa_version.support_float() else 0 - debug_mode = "ALL" if logger.level <= logging.DEBUG else None - outputs_np, status = reference_model.run( - graph, - inputs_np, - verbosity=_tosa_refmodel_loglevel(logger.level), - tosa_profile=tosa_profile, - initialize_variable_tensor_from_numpy=True, - debug_mode=debug_mode, - ) - elif isinstance(tosa_version, Tosa_1_00): + if isinstance(tosa_version, Tosa_1_00): import tosa_reference_model as reference_model debug_mode = "ALL" if logger.level <= logging.DEBUG else None diff --git a/backends/arm/test/tester/arm_tester.py b/backends/arm/test/tester/arm_tester.py index 60081ac8145..219f9715ea5 100644 --- a/backends/arm/test/tester/arm_tester.py +++ b/backends/arm/test/tester/arm_tester.py @@ -25,10 +25,11 @@ import executorch.backends.xnnpack.test.tester.tester as tester +import serializer.tosa_serializer as ts # type: ignore[import-untyped] + import torch.fx import torch.utils._pytree as pytree -import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore[import-untyped] from executorch.backends.arm._passes.arm_pass_manager import ArmPassManager from executorch.backends.arm.arm_backend import ( diff --git a/backends/arm/test/tester/test_pipeline.py b/backends/arm/test/tester/test_pipeline.py index 678de81d38d..fb9f05444e5 100644 --- a/backends/arm/test/tester/test_pipeline.py +++ b/backends/arm/test/tester/test_pipeline.py @@ -271,9 +271,9 @@ def run(self): raise e -class TosaPipelineBI(BasePipelineMaker, Generic[T]): +class TosaPipelineINT(BasePipelineMaker, Generic[T]): """ - Lowers a graph to BI TOSA spec (with quantization) and tests it with the TOSA reference model. + Lowers a graph to INT TOSA spec (with quantization) and tests it with the TOSA reference model. Attributes: module: The module which the pipeline is applied to. @@ -298,7 +298,6 @@ def __init__( aten_op: str | List[str], exir_op: Optional[str | List[str]] = None, run_on_tosa_ref_model: bool = True, - tosa_version: str = "TOSA-0.80+BI", symmetric_io_quantization: bool = False, per_channel_quantization: bool = True, use_to_edge_transform_and_lower: bool = True, @@ -309,7 +308,6 @@ def __init__( dynamic_shapes: Optional[Tuple[Any]] = None, ): tosa_profiles = { - "0.80": TosaSpecification.create_from_string("TOSA-0.80+BI"), "1.0": TosaSpecification.create_from_string("TOSA-1.0+INT"), } tosa_version = conftest.get_option("tosa_version") @@ -372,9 +370,9 @@ def __init__( ) -class TosaPipelineMI(BasePipelineMaker, Generic[T]): +class TosaPipelineFP(BasePipelineMaker, Generic[T]): """ - Lowers a graph to MI TOSA spec and tests it with the TOSA reference model. + Lowers a graph to FP TOSA spec and tests it with the TOSA reference model. Attributes: module: The module which the pipeline is applied to. @@ -399,7 +397,6 @@ def __init__( aten_op: str | List[str], exir_op: Optional[str | List[str]] = None, run_on_tosa_ref_model: bool = True, - tosa_version: str = "TOSA-0.80+MI", use_to_edge_transform_and_lower: bool = True, custom_path: str = None, atol: float = 1e-03, @@ -411,7 +408,6 @@ def __init__( ] = None, ): tosa_profiles = { - "0.80": TosaSpecification.create_from_string("TOSA-0.80+MI"), "1.0": TosaSpecification.create_from_string("TOSA-1.0+FP"), } tosa_version = conftest.get_option("tosa_version") @@ -449,9 +445,9 @@ def __init__( ) -class EthosU55PipelineBI(BasePipelineMaker, Generic[T]): +class EthosU55PipelineINT(BasePipelineMaker, Generic[T]): """ - Lowers a graph to u55 BI TOSA spec and tests it on the Corstone300 FVP, if run_on_fvp is true. + Lowers a graph to u55 INT TOSA spec and tests it on the Corstone300 FVP, if run_on_fvp is true. Attributes: module: The module which the pipeline is applied to. @@ -536,9 +532,9 @@ def __init__( ) -class EthosU85PipelineBI(BasePipelineMaker, Generic[T]): +class EthosU85PipelineINT(BasePipelineMaker, Generic[T]): """ - Lowers a graph to u85 BI TOSA spec and tests it on the Corstone320 FVP, if run_on_fvp is true. + Lowers a graph to u85 INT TOSA spec and tests it on the Corstone320 FVP, if run_on_fvp is true. Attributes: module: The module which the pipeline is applied to. @@ -661,9 +657,6 @@ def __init__( custom_path: str = None, ): tosa_profiles = { - "0.80": TosaSpecification.create_from_string( - "TOSA-0.80+" + ("BI" if quantize else "MI") - ), "1.0": TosaSpecification.create_from_string( "TOSA-1.0+" + ("INT" if quantize else "FP") ), @@ -730,7 +723,6 @@ def __init__( custom_path: str = None, ): tosa_profiles = { - "0.80": TosaSpecification.create_from_string("TOSA-0.80+BI"), "1.0": TosaSpecification.create_from_string("TOSA-1.0+INT"), } tosa_version = conftest.get_option("tosa_version") @@ -789,7 +781,6 @@ def __init__( u55_subset: Optional[bool] = False, ): tosa_profiles = { - "0.80": "TOSA-0.80+" + ("BI" if quantize else "MI"), "1.0": "TOSA-1.0+" + ("INT" if quantize else "FP"), } tosa_version = tosa_profiles[conftest.get_option("tosa_version")] @@ -808,7 +799,7 @@ def __init__( [], ) - if "INT" in tosa_version or "BI" in tosa_version: + if "INT" in tosa_version: self.add_stage(self.tester.quantize, pos=0) self.change_args("check_not.exir", []) From dd2d9f23ae728ca5d49844a95d9960a959cbc44e Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Tue, 24 Jun 2025 16:03:37 +0100 Subject: [PATCH 5/6] Arm backend: Remove TOSA 0.80 from tosa specification and utils Change-Id: I183a1475ace4c4fe73ab325d615974464d3520d3 --- backends/arm/process_node.py | 10 +--- backends/arm/tosa_backend.py | 4 +- backends/arm/tosa_mapping.py | 14 +---- backends/arm/tosa_quant_utils.py | 89 +----------------------------- backends/arm/tosa_specification.py | 58 ------------------- backends/arm/tosa_utils.py | 24 ++------ 6 files changed, 13 insertions(+), 186 deletions(-) diff --git a/backends/arm/process_node.py b/backends/arm/process_node.py index 0994079c4ab..edbd2ca2a29 100644 --- a/backends/arm/process_node.py +++ b/backends/arm/process_node.py @@ -12,11 +12,7 @@ import torch.fx from executorch.backends.arm.operators.node_visitor import NodeVisitor from executorch.backends.arm.tosa_mapping import TosaArg -from executorch.backends.arm.tosa_specification import ( - Tosa_0_80, - Tosa_1_00, - TosaSpecification, -) +from executorch.backends.arm.tosa_specification import Tosa_1_00, TosaSpecification from executorch.backends.arm.tosa_utils import getNodeArgs, tosa_shape from torch._export.utils import ( get_buffer, @@ -85,9 +81,7 @@ def process_inputs( "Is the original torch function supported?" ) from e - if isinstance(tosa_spec, Tosa_0_80): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - elif isinstance(tosa_spec, Tosa_1_00): + if isinstance(tosa_spec, Tosa_1_00): import serializer.tosa_serializer as ts else: raise ValueError(f"Unsupported TOSA spec: {tosa_spec}") diff --git a/backends/arm/tosa_backend.py b/backends/arm/tosa_backend.py index 0f03e12c916..00eda8ed2df 100644 --- a/backends/arm/tosa_backend.py +++ b/backends/arm/tosa_backend.py @@ -85,9 +85,7 @@ def preprocess( # noqa: C901 # Converted output for this subgraph, serializer needs path early as it emits # const data directly. Path created and data written only in debug builds. - if isinstance(tosa_spec, tosa_specification.Tosa_0_80): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - elif isinstance(tosa_spec, tosa_specification.Tosa_1_00): + if isinstance(tosa_spec, tosa_specification.Tosa_1_00): import serializer.tosa_serializer as ts # type: ignore else: raise RuntimeError( diff --git a/backends/arm/tosa_mapping.py b/backends/arm/tosa_mapping.py index 7d662b72328..6704499a0d3 100644 --- a/backends/arm/tosa_mapping.py +++ b/backends/arm/tosa_mapping.py @@ -14,11 +14,7 @@ from typing import Any, Optional, Sequence import torch -from executorch.backends.arm.tosa_specification import ( - Tosa_0_80, - Tosa_1_00, - TosaSpecification, -) +from executorch.backends.arm.tosa_specification import Tosa_1_00, TosaSpecification UNSUPPORTED_DTYPES = ( torch.float64, @@ -36,9 +32,7 @@ def map_dtype(data_type: torch.dtype, tosa_spec: TosaSpecification) -> Any: if data_type in UNSUPPORTED_DTYPES: raise ValueError(f"Unsupported type: {data_type}") - if isinstance(tosa_spec, Tosa_0_80): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - elif isinstance(tosa_spec, Tosa_1_00): + if isinstance(tosa_spec, Tosa_1_00): import serializer.tosa_serializer as ts # type: ignore else: raise RuntimeError(f"Unsupported tosa_spec: {tosa_spec}") @@ -140,9 +134,7 @@ def __repr__(self): if self.name is not None: attrs.append(f"name={self.name!r}") if self.dtype is not None: - if isinstance(self.tosa_spec, Tosa_0_80): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - elif isinstance(self.tosa_spec, Tosa_1_00): + if isinstance(self.tosa_spec, Tosa_1_00): import serializer.tosa_serializer as ts # type: ignore else: raise RuntimeError(f"Unsupported tosa_spec: {self.tosa_spec}") diff --git a/backends/arm/tosa_quant_utils.py b/backends/arm/tosa_quant_utils.py index 7246ee74b74..f6324efb401 100644 --- a/backends/arm/tosa_quant_utils.py +++ b/backends/arm/tosa_quant_utils.py @@ -290,45 +290,6 @@ def compute_multiplier_and_shift( return multipliers, shifts -def build_rescale_v0_80( - tosa_fb: Any, - scale: list[float], - input_node: Any, - output_name: str, - output_type: Any, - input_zp: list[int], - output_zp: list[int], - is_double_round: bool = False, - per_channel=False, -): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - import tosa_tools.v0_80.tosa.Op as TosaOp # type: ignore - - # Check if scale32 mode is used for given output element type - is_scale32 = output_type == ts.DType.INT8 - scale_width = 32 if is_scale32 else 16 - multipliers, shifts = compute_multiplier_and_shift(scale, scale_width) - - attr_rescale = ts.TosaSerializerAttribute() - attr_rescale.RescaleAttribute( - input_zp=input_zp[0], - output_zp=output_zp[0], - multiplier=multipliers, - shift=shifts, - scale32=is_scale32, - double_round=is_double_round, - per_channel=per_channel, - input_unsigned=False, - output_unsigned=False, - ) - - tosa_fb.addOperator( - TosaOp.Op().RESCALE, [input_node.name], [output_name], attr_rescale - ) - - return - - # For TOSA spec v1.0 RESCALE operator requires multipler, shifts, input_zp and output_zp to be # const inputs. Create constant operators from the data already initialized. def create_const_ops_for_rescale( @@ -422,25 +383,8 @@ def build_rescale_to_int32( tosa_spec=None, ) -> Any: input_A_rescaled_to_int32 = None - if not tosa_spec or isinstance(tosa_spec, tosa_specification.Tosa_0_80): - # default to TOSA v0.80 until we switch to v1.0 - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - input_A_rescaled_to_int32 = tosa_fb.addIntermediate( - input_arg.shape, ts.DType.INT32 - ) - - build_rescale_v0_80( - tosa_fb=tosa_fb, - scale=[rescale_scale], - input_node=input_arg, - output_name=input_A_rescaled_to_int32.name, - output_type=ts.DType.INT32, - input_zp=[input_zp], - output_zp=[0], - ) # type: ignore[call-arg] - - elif isinstance(tosa_spec, tosa_specification.Tosa_1_00): + if isinstance(tosa_spec, tosa_specification.Tosa_1_00): # For TOSA v1.0 multipliers, shifts, input_zp and output_zp are now inputs # to the RESCALE op see: https://www.mlplatform.org/tosa/tosa_spec.html#_rescale import serializer.tosa_serializer as ts # type: ignore @@ -474,21 +418,7 @@ def build_rescale_from_int32( per_channel: bool = False, tosa_spec=None, ) -> None: - if not tosa_spec or isinstance(tosa_spec, tosa_specification.Tosa_0_80): - # default to TOSA v0.80 until we switch to v1.0 - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - - build_rescale_v0_80( - tosa_fb=tosa_fb, - scale=[rescale_scale], - input_node=input_node, - output_name=output_name, - output_type=ts.DType.INT8, - input_zp=[0], - output_zp=[output_zp], - ) # type: ignore[call-arg] - - elif isinstance(tosa_spec, tosa_specification.Tosa_1_00): + if isinstance(tosa_spec, tosa_specification.Tosa_1_00): import serializer.tosa_serializer as ts # type: ignore # For TOSA v1.0 multipliers, shifts, input_zp and output_zp are now inputs @@ -525,20 +455,7 @@ def build_rescale_conv_output( (inp * w) / out for inp, w, out in zip(input_scale, weight_scale, output_scale) ] - # Since we assume the input tensor that is being rescaled is int32 date type, zero point must be 0. - if not tosa_spec or isinstance(tosa_spec, tosa_specification.Tosa_0_80): - # default to TOSA v0.80 until we switch to v1.0 - build_rescale_v0_80( - tosa_fb=tosa_fb, - scale=post_conv2d_scale, - input_node=op, - output_name=output_name, - output_type=output_type, - input_zp=[0], - output_zp=output_zp, - per_channel=isinstance(weight_scale, torch.Tensor), - ) # type: ignore[call-arg] - elif isinstance(tosa_spec[0], tosa_specification.Tosa_1_00): + if isinstance(tosa_spec[0], tosa_specification.Tosa_1_00): # For TOSA v1.0 multipliers, shifts, input_zp and output_zp are now inputs # to the RESCALE op see: https://www.mlplatform.org/tosa/tosa_spec.html#_rescale build_rescale( diff --git a/backends/arm/tosa_specification.py b/backends/arm/tosa_specification.py index 36fa5daf2f7..5f16605aa56 100644 --- a/backends/arm/tosa_specification.py +++ b/backends/arm/tosa_specification.py @@ -23,7 +23,6 @@ class TosaSpecification: This class implements a representation of TOSA specification (https://www.mlplatform.org/tosa/tosa_spec.html) with a version, a profile (with extension) and a level (8k). - For 0.80 releases the profile is BI or MI, with u55 handled as an inofficial extension For 1.00 releases the profile is INT or FP, and the extensions are for INT: int16, int4, var, cf FP: bf16, fp8e4m3, fp8e5m2, fft, var, cf @@ -31,8 +30,6 @@ class TosaSpecification: The TOSA specification is encoded in the string represenatation TOSA-major.minor.patch+profile[+level][+extensions] - For 0.80 MI implies BI, while for 1.0 the profiles has to explicitely be specified. - Profiles are uppercase letters and extensions and level is lowercase. """ @@ -62,10 +59,6 @@ def __init__(self, version: Version, extras: List[str]): def create_from_string(repr: str) -> "TosaSpecification": """ Creates a TOSA specification class from a string representation: - TOSA-0.80+MI - TOSA-0.80+BI+8k - TOSA-0.80+BI+u55 # Ethos-U55 extension to handle TOSA subset - TOSA-0.90.0+MI TOSA-1.00.0+INT+FP+int4+cf """ @@ -78,8 +71,6 @@ def create_from_string(repr: str) -> "TosaSpecification": if name != "TOSA": raise ValueError(f"Malformed TOSA specification representation: {repr}") match version: - case _ if version.major == 0 and version.minor == 80: - return Tosa_0_80(version, extras) case _ if version.major == 1 and version.minor == 0: return Tosa_1_00(version, extras) case _: @@ -88,55 +79,6 @@ def create_from_string(repr: str) -> "TosaSpecification": raise ValueError(f"Failed to parse TOSA specification representation: {repr}") -class Tosa_0_80(TosaSpecification): - profile: str - level_8k: bool - available_profiles = ["BI", "MI"] # MT is not defined - - def __init__(self, version: Version, extras: List[str]): - super().__init__(version, extras) - assert version >= Version("0.80") and version < Version("0.90") - - # Check that we only have one profile in the extensions list - if [e in Tosa_0_80.available_profiles for e in extras].count(True) != 1: - raise ValueError( - f"Bad combination of extras: {extras}, more than one of {Tosa_0_80.available_profiles} found." - ) - - # The list contains one profile at most, so pick it - self.profile = [e for e in extras if e in Tosa_0_80.available_profiles][0] - extras.remove(self.profile) - - self.level_8k = "8k" in extras - if self.level_8k: - extras.remove("8k") - - if len(extras) > 0: - raise ValueError(f"Unhandled extras found: {extras}") - - def __repr__(self) -> str: - extensions = "" - if self.level_8k: - extensions += "+8k" - if self.is_U55_subset: - extensions += "+u55" - return f"TOSA-{str(self.version)}+{self.profile}{extensions}" - - def __hash__(self) -> int: - return hash(str(self.version) + self.profile) - - def __eq__(self, other: object) -> bool: - if isinstance(other, Tosa_0_80): - return (self.version == other.version) and (self.profile == other.profile) - return False - - def support_integer(self): - return True - - def support_float(self): - return self.profile == "MI" - - class Tosa_1_00(TosaSpecification): profiles: List[str] level_8k: bool diff --git a/backends/arm/tosa_utils.py b/backends/arm/tosa_utils.py index 3b56fdd1cbf..e7102526f01 100644 --- a/backends/arm/tosa_utils.py +++ b/backends/arm/tosa_utils.py @@ -10,19 +10,15 @@ from typing import Any, Optional import numpy as np +import serializer.tosa_serializer as ts # type: ignore import sympy # type: ignore import torch -import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore from executorch.backends.arm.tosa_mapping import extract_tensor_meta, TosaArg -from executorch.backends.arm.tosa_specification import ( - Tosa_0_80, - Tosa_1_00, - TosaSpecification, -) +from executorch.backends.arm.tosa_specification import Tosa_1_00, TosaSpecification from executorch.exir.dialects._ops import ops as exir_ops from executorch.exir.print_program import inspect_node @@ -187,11 +183,8 @@ def broadcast_tensors( for broadcast. However this function also performs the broadcast and does not have a limit on only two input tensors. """ - if isinstance(tosa_spec, Tosa_0_80): - import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore - reshape_helper = build_reshape - elif isinstance(tosa_spec, Tosa_1_00): + if isinstance(tosa_spec, Tosa_1_00): import serializer.tosa_serializer as ts reshape_helper = build_reshape_tosa_1_0 @@ -225,16 +218,7 @@ def broadcast_tensors( multipliers = [ comm if curr == 1 else 1 for comm, curr in zip(common_shape, new_shape) ] - if isinstance(tosa_spec, Tosa_0_80): - attr = ts.TosaSerializerAttribute() - attr.TileAttribute(multipliers) - tosa_fb.addOperator( - ts.TosaOp.Op().TILE, - [reshaped.name], - [tiled.name], - attr, - ) - elif isinstance(tosa_spec, Tosa_1_00): + if isinstance(tosa_spec, Tosa_1_00): multiple_shapes = tosa_fb.addConst( (len(multipliers),), ts.DType.SHAPE, From 8c2af87e5e9e1049c4c6f3ae9f2fea8563260150 Mon Sep 17 00:00:00 2001 From: Saoirse Stewart Date: Wed, 25 Jun 2025 12:12:56 +0100 Subject: [PATCH 6/6] Arm backend: Remove install of TOSA 0.80 - Update README - Remove tosa 0.80 schema - Remove tosa 0.80 patches Change-Id: I81f88d5af6e14681ac09c2c6d51f4adbfd081aeb --- backends/arm/README.md | 4 +- .../arm/scripts/install_reference_model.sh | 20 -- ...to-be-namespaced-into-tosa-tools.v0_.patch | 154 --------- ...-serializer-lib-to-be-self-contained.patch | 283 ---------------- backends/arm/tosa/schemas/tosa_0.80.fbs | 314 ------------------ 5 files changed, 2 insertions(+), 773 deletions(-) delete mode 100644 backends/arm/third-party/reference_model/patches/v0.80/reference_model/0001-Move-tosa-tools-to-be-namespaced-into-tosa-tools.v0_.patch delete mode 100644 backends/arm/third-party/reference_model/patches/v0.80/serialization_lib/0001-Make-TOSA-serializer-lib-to-be-self-contained.patch delete mode 100644 backends/arm/tosa/schemas/tosa_0.80.fbs diff --git a/backends/arm/README.md b/backends/arm/README.md index 6bf46d3f3ae..9fa8ff8f5be 100644 --- a/backends/arm/README.md +++ b/backends/arm/README.md @@ -181,8 +181,8 @@ The Arm EthosU Backend should be considered a prototype quality at this point, l ## Current flows The EthosUBackend has a two stage process, -- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v0.80 TOSA BI with specific concern to a subset which gives support on Ethos-U55 and Ethos-U85, the target of the initial prototype efforts. This calls into the TOSABackend. -- Lower via the ethos-u-vela compilation flow which takes TOSA v0.80 as an input and produces a low level commandstream for the hardware which is then passed via the delegate to the ethos-u-core-driver for direct execution. +- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v1.0 TOSA INT with specific concern to a subset which gives support on Ethos-U55 and Ethos-U85, the target of the initial prototype efforts. This calls into the TOSABackend. +- Lower via the ethos-u-vela compilation flow which takes TOSA v1.0 as an input and produces a low level commandstream for the hardware which is then passed via the delegate to the ethos-u-core-driver for direct execution. The EthosUPartitioner is currenly used to ensure the operations converted are Ethos-U compatible, but will be extended to offer spec-correct TOSA Base inference and TOSA Main Inference generation in future. diff --git a/backends/arm/scripts/install_reference_model.sh b/backends/arm/scripts/install_reference_model.sh index 4d2d8cf4954..089eab899db 100755 --- a/backends/arm/scripts/install_reference_model.sh +++ b/backends/arm/scripts/install_reference_model.sh @@ -10,9 +10,6 @@ set -euo pipefail # TOSA reference model tosa_reference_model_url="https://git.gitlab.arm.com/tosa/tosa-reference-model.git" -tosa_reference_model_0_80_branch="v0.80" -tosa_reference_model_0_80_rev="70ed0b40fa831387e36abdb4f7fb9670a3464f5a" -tosa_serialization_lib_0_80_rev="v0.80.1" tosa_reference_model_1_0_rev="1e6e4526df3391e1d6bc41562596bb18b3153bf3" script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) @@ -31,23 +28,6 @@ function setup_tosa_reference_model() { mkdir -p "$work_dir" pushd "$work_dir" || exit 1 - # Install a patched version of TOSA reference model v0.80.1 to make it co-exist with 1.0 during the transition period - if [[ ! -d "reference_model" ]]; then - git clone --recurse-submodules --branch ${tosa_reference_model_0_80_branch} "$tosa_reference_model_url" reference_model - fi - - patches_dir=${script_dir}/../third-party/reference_model/patches/v0.80 - patch_repo reference_model ${tosa_reference_model_0_80_rev} ${patches_dir} - patch_repo reference_model/thirdparty/serialization_lib ${tosa_serialization_lib_0_80_rev} ${patches_dir} - - pushd reference_model - rm -rf build - # reference_model flatbuffers version clashes with Vela. - # go with Vela's since it newer. - # Vela's flatbuffer requirement is expected to loosen, then remove this. MLETORCH-565 - CMAKE_POLICY_VERSION_MINIMUM=3.5 pip install . --no-dependencies flatbuffers - popd - # Install the 1.0 branch from upstream CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 pip install "tosa-tools@git+${tosa_reference_model_url}@${tosa_reference_model_1_0_rev}" ml_dtypes==0.5.1 --no-dependencies flatbuffers } diff --git a/backends/arm/third-party/reference_model/patches/v0.80/reference_model/0001-Move-tosa-tools-to-be-namespaced-into-tosa-tools.v0_.patch b/backends/arm/third-party/reference_model/patches/v0.80/reference_model/0001-Move-tosa-tools-to-be-namespaced-into-tosa-tools.v0_.patch deleted file mode 100644 index 512c105bda2..00000000000 --- a/backends/arm/third-party/reference_model/patches/v0.80/reference_model/0001-Move-tosa-tools-to-be-namespaced-into-tosa-tools.v0_.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 20c2059723d5c6952cecfb7fcde92601639ef825 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Per=20=C3=85strand?= -Date: Wed, 5 Feb 2025 12:31:47 +0100 -Subject: [PATCH 1/2] Move tosa-tools to be namespaced into tosa-tools.v0_80 - ---- - CMakeLists.txt | 4 ++- - pyproject.toml | 3 ++- - setup.cfg | 70 +++++++++++++++++++++++++------------------------- - setup.py | 3 ++- - 4 files changed, 42 insertions(+), 38 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 68e8d8a..34becd0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,4 +1,6 @@ --cmake_minimum_required (VERSION 3.4) -+cmake_minimum_required (VERSION 3.19) -+ -+cmake_policy(SET CMP0077 NEW) - - set(CMAKE_INSTALL_PREFIX ".") - project(tosa_tools LANGUAGES CXX) -diff --git a/pyproject.toml b/pyproject.toml -index 7565f93..60448e7 100644 ---- a/pyproject.toml -+++ b/pyproject.toml -@@ -6,7 +6,8 @@ requires = [ - "setuptools>=42", - "wheel", - "setuptools_scm[toml]>=6.0", -- "cmake" -+ "cmake", -+ "ninja", - ] - build-backend = "setuptools.build_meta" - -diff --git a/setup.cfg b/setup.cfg -index 82ec9b8..c1bd1a8 100644 ---- a/setup.cfg -+++ b/setup.cfg -@@ -2,7 +2,7 @@ - # SPDX-License-Identifier: Apache-2.0 - - [metadata] --name = tosa-tools -+name = tosa-tools-v0.80 - # version = done by setuptools_scm in pyproject.toml - author = Arm Limited - #author_email = -@@ -25,44 +25,44 @@ install_requires = - python_requires = >=3.6 - include_package_data = True - packages = -- runner -- generator -- checker -- frameworks -- tests -- conformance -- xunit -- json2fbbin -- json2numpy -- schemavalidation -- convert2conformance -- tosa -- serializer -- tosa_reference_model -+ tosa_tools.v0_80.verif.runner -+ tosa_tools.v0_80.verif.generator -+ tosa_tools.v0_80.verif.checker -+ tosa_tools.v0_80.verif.frameworks -+ tosa_tools.v0_80.verif.tests -+ tosa_tools.v0_80.verif.conformance -+ tosa_tools.v0_80.xunit -+ tosa_tools.v0_80.json2fbbin -+ tosa_tools.v0_80.json2numpy -+ tosa_tools.v0_80.schemavalidation -+ tosa_tools.v0_80.convert2conformance -+ tosa_tools.v0_80.tosa -+ tosa_tools.v0_80.serializer -+ tosa_tools.v0_80.tosa_reference_model - package_dir = -- = verif -- xunit = scripts/xunit -- json2fbbin = scripts/json2fbbin -- json2numpy = scripts/json2numpy -- convert2conformance = scripts/convert2conformance -- tosa = thirdparty/serialization_lib/python/tosa -- serializer = thirdparty/serialization_lib/python/serializer -- tosa_reference_model = py_package -- schemavalidation = scripts/schemavalidation -+ tosa_tools.v0_80.verif = verif -+ tosa_tools.v0_80.xunit = scripts/xunit -+ tosa_tools.v0_80.json2fbbin = scripts/json2fbbin -+ tosa_tools.v0_80.json2numpy = scripts/json2numpy -+ tosa_tools.v0_80.convert2conformance = scripts/convert2conformance -+ tosa_tools.v0_80.tosa = thirdparty/serialization_lib/python/tosa -+ tosa_tools.v0_80.serializer = thirdparty/serialization_lib/python/serializer -+ tosa_tools.v0_80.tosa_reference_model = py_package -+ tosa_tools.v0_80.schemavalidation = scripts/schemavalidation - - [options.entry_points] - console_scripts = -- tosa_verif_run_ref = runner.tosa_verif_run_tests:main -- tosa_verif_run_tests = runner.tosa_verif_run_tests:main -- tosa_verif_build_tests = generator.tosa_verif_build_tests:main -- tosa_json2numpy = json2numpy.json2numpy:main -- tosa_json2fbbin = json2fbbin.json2fbbin:main -- tosa_verif_result_check = checker.tosa_result_checker:main -- tosa_convert2conformance = convert2conformance.convert2conformance:main -- tosa_verif_framework_generator = frameworks.tosa_verif_framework_generator:main -- tosa_verif_framework_compiler_runner = frameworks.tosa_verif_framework_compiler_runner:main -- tosa_verif_conformance_generator = conformance.tosa_verif_conformance_generator:main -- tosa_schemavalidation = schemavalidation.schemavalidation:main -+ tosa_verif_run_ref = tosa_tools.v0_80.verif.runner.tosa_verif_run_tests:main -+ tosa_verif_run_tests = tosa_tools.v0_80.verif.runner.tosa_verif_run_tests:main -+ tosa_verif_build_tests = tosa_tools.v0_80.verif.generator.tosa_verif_build_tests:main -+ tosa_json2numpy = tosa_tools.v0_80.verif.json2numpy.json2numpy:main -+ tosa_json2fbbin = tosa_tools.v0_80.verif.json2fbbin.json2fbbin:main -+ tosa_verif_result_check = tosa_tools.v0_80.verif.checker.tosa_result_checker:main -+ tosa_convert2conformance = tosa_tools.v0_80.verif.convert2conformance.convert2conformance:main -+ tosa_verif_framework_generator = tosa_tools.v0_80.verif.frameworks.tosa_verif_framework_generator:main -+ tosa_verif_framework_compiler_runner = tosa_tools.v0_80.verif.frameworks.tosa_verif_framework_compiler_runner:main -+ tosa_verif_conformance_generator = tosa_tools.v0_80.verif.conformance.tosa_verif_conformance_generator:main -+ tosa_schemavalidation = tosa_tools.v0_80.verif.schemavalidation.schemavalidation:main - - [options.package_data] - schemavalidation= -diff --git a/setup.py b/setup.py -index 8c6b4cd..95896ad 100644 ---- a/setup.py -+++ b/setup.py -@@ -20,7 +20,7 @@ class CMakeBuild(build_py): - root_dir = Path(__file__).parent - build_dir = root_dir / "build" - build_dir.mkdir(exist_ok=True) -- package_dir = root_dir / "py_package" -+ package_dir = root_dir / "build/lib/tosa_tools/v0_80/tosa_reference_model/" - - cmake_cmd = [ - "cmake", -@@ -90,6 +90,7 @@ class CMakeBuild(build_py): - # Python will know which one to import - copied_so = False - so_dir = build_dir / "reference_model" -+ package_dir.mkdir(parents=True, exist_ok=True) - print(f"copying .so files from '{so_dir}' to '{package_dir}'") - for so_file in so_dir.glob("tosa_reference_model.*.so"): - shutil.copy(so_file, package_dir) --- -2.39.5 (Apple Git-154) - diff --git a/backends/arm/third-party/reference_model/patches/v0.80/serialization_lib/0001-Make-TOSA-serializer-lib-to-be-self-contained.patch b/backends/arm/third-party/reference_model/patches/v0.80/serialization_lib/0001-Make-TOSA-serializer-lib-to-be-self-contained.patch deleted file mode 100644 index cc9cbc4edad..00000000000 --- a/backends/arm/third-party/reference_model/patches/v0.80/serialization_lib/0001-Make-TOSA-serializer-lib-to-be-self-contained.patch +++ /dev/null @@ -1,283 +0,0 @@ -From b3c8c3f779a7e051826f317598fb831fa9cfe923 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Per=20=C3=85strand?= -Date: Wed, 5 Feb 2025 12:30:09 +0100 -Subject: [PATCH] Make TOSA serializer lib to be self contained - ---- - CMakeLists.txt | 4 ++ - python/serializer/tosa_serializer.py | 57 ++++++++++++++-------------- - 2 files changed, 32 insertions(+), 29 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ac34b75..5e191aa 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,6 +19,8 @@ - cmake_minimum_required(VERSION 3.13.4) - project(TosaSerialization) - -+cmake_policy(SET CMP0077 NEW) -+ - set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") - set(CMAKE_CXX_STANDARD_REQUIRED YES) - -@@ -27,6 +29,8 @@ set(CMAKE_VERBOSE_MAKEFILE ON) - option(BUILD_TESTS "Build test applications" ON) - option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off) - -+message(STATUS "FLATBUFFERS_ROOT set to: ${FLATBUFFERS_ROOT}") -+ - include_directories(${PROJECT_SOURCE_DIR}/third_party/half/include) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py -index 7bc75f0..d191997 100644 ---- a/python/serializer/tosa_serializer.py -+++ b/python/serializer/tosa_serializer.py -@@ -14,12 +14,11 @@ - - import os - import struct --import serializer.tosa_serializer as ts - import json - import flatbuffers - import numpy as np - from enum import IntEnum, unique --from tosa import ( -+from ..tosa import ( - TosaGraph, - TosaRegion, - TosaBasicBlock, -@@ -27,8 +26,8 @@ from tosa import ( - TosaOperator, - Version, - ) --import tosa.DType as TosaDType --import tosa.Op as TosaOp -+from ..tosa import DType as TosaDType -+from ..tosa import Op as TosaOp - - # Keep version number in sync with the version default value with schema/tosa.fbs - TOSA_VERSION_MAJOR = 0 -@@ -159,7 +158,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): - output_zp, - accum_dtype, - ): -- from tosa import PoolAttribute as a, Attribute -+ from ..tosa import PoolAttribute as a, Attribute - - self.utype = Attribute.Attribute().PoolAttribute - -@@ -172,7 +171,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): - self.ints.append((a.AddAccumDtype, accum_dtype)) - - def ConvAttribute(self, pad, stride, dilation, input_zp, weight_zp, local_bound): -- from tosa import ConvAttribute as a, Attribute -+ from ..tosa import ConvAttribute as a, Attribute - - self.utype = Attribute.Attribute().ConvAttribute - self.optFcns = (a.Start, a.End) -@@ -187,7 +186,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): - def TransposeConvAttribute( - self, outpad, stride, output_shape, input_zp, weight_zp, local_bound - ): -- from tosa import TransposeConvAttribute as a, Attribute -+ from ..tosa import TransposeConvAttribute as a, Attribute - - self.utype = Attribute.Attribute().TransposeConvAttribute - self.optFcns = (a.Start, a.End) -@@ -200,7 +199,7 @@ class TosaSerializerAttribute(TosaSerializerUnion): - self.bools.append((a.AddLocalBound, local_bound)) - - def PadAttribute(self, serializer_builder, padding, pad_const_int, pad_const_fp): -- from tosa import PadAttribute as a, Attribute -+ from ..tosa import PadAttribute as a, Attribute - - self.utype = Attribute.Attribute().PadAttribute - self.optFcns = (a.Start, a.End) -@@ -210,14 +209,14 @@ class TosaSerializerAttribute(TosaSerializerUnion): - - # pad_const_fp attribute serialized as uint8 vector - pad_const_float_as_bytes = struct.pack("