Skip to content

Revert "Add pass for replacing dq-q patterns with rescale" #8480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions backends/arm/_passes/arm_pass_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from executorch.backends.arm._passes.fuse_quantized_activation_pass import ( # type: ignore[import-not-found]
FuseQuantizedActivationPass,
)
from executorch.backends.arm._passes.insert_rescales_pass import InsertRescalePass
from executorch.backends.arm._passes.insert_table_ops import InsertTableOpsPass
from executorch.backends.arm._passes.keep_dims_false_to_squeeze_pass import (
KeepDimsFalseToSqueezePass,
Expand All @@ -76,7 +75,6 @@
UnsqueezeScalarPlaceholdersPass,
)
from executorch.backends.arm.tosa_specification import TosaSpecification

from executorch.backends.xnnpack._passes.remove_getitem_op import RemoveGetItemPass
from executorch.exir import ExportedProgram
from executorch.exir.pass_manager import PassManager
Expand Down Expand Up @@ -121,7 +119,7 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(ConvertSqueezesToViewPass())

self.add_pass(AnnotateChannelsLastDimOrder())
self.add_pass(InsertRescalePass())

return self._transform(exported_program.graph_module)

def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModule:
Expand Down Expand Up @@ -159,7 +157,6 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(ConvertSqueezesToViewPass())

self.add_pass(AnnotateChannelsLastDimOrder())
self.add_pass(InsertRescalePass())

return self._transform(exported_program.graph_module)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def call(self, graph_module: GraphModule) -> PassResult:
n = cast(Node, n)
if n.op != "call_function":
continue
# Don't fold chains of quant-ops into each other.
if n.target in (q_op, dq_op):
continue

# Make sure we haven't already set qparams meta information on the node
assert "input_qparams" not in n.meta.keys()
Expand Down
109 changes: 0 additions & 109 deletions backends/arm/_passes/insert_rescales_pass.py

This file was deleted.

1 change: 0 additions & 1 deletion backends/arm/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
op_reciprocal,
op_relu,
op_repeat,
op_rescale,
op_rshift,
op_rsqrt,
op_sigmoid,
Expand Down
70 changes: 0 additions & 70 deletions backends/arm/operators/op_rescale.py

This file was deleted.

38 changes: 0 additions & 38 deletions backends/arm/test/ops/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
from typing import Tuple

import torch
from executorch.backends.arm.arm_backend import get_tosa_version
from executorch.backends.arm.quantizer import arm_quantizer
from executorch.backends.arm.test import common
from executorch.backends.arm.test.tester.test_pipeline import (
EthosU55PipelineBI,
EthosU85PipelineBI,
TosaPipelineBI,
TosaPipelineMI,
)
from executorch.backends.xnnpack.test.tester import Quantize
from torch.ao.quantization.observer import HistogramObserver
from torch.ao.quantization.quantizer import QuantizationSpec


aten_op = "torch.ops.aten.add.Tensor"
exir_op = "executorch_exir_dialects_edge__ops_aten_add_Tensor"
Expand Down Expand Up @@ -73,38 +67,6 @@ def test_add_tosa_BI(test_data: input_t1):
pipeline.run()


@common.parametrize("test_data", Add.test_data)
def test_add_i32_tosa_BI(test_data: input_t1):
pipeline = TosaPipelineBI[input_t1](Add(), test_data, aten_op, exir_op)

# Create a quantizer with int8 quantization on the input and output but int32 on everything else.
quantizer = arm_quantizer.ArmQuantizer(
get_tosa_version(common.get_tosa_compile_spec("TOSA-0.80+BI"))
)
quantizer.set_io(arm_quantizer.get_symmetric_quantization_config())
observer_options = {"eps": 2**-16}
observer = HistogramObserver.with_args(**observer_options)
input_act_qspec = QuantizationSpec(
torch.int32,
observer,
qscheme=torch.per_tensor_symmetric,
quant_max=2**31 - 1,
quant_min=-(2**31),
)
# This quantization_config will be set as global config.
quantization_config = arm_quantizer.QuantizationConfig(
input_act_qspec, None, None, None
)
quantize_stage = Quantize(quantizer, quantization_config)
pipeline.change_args("quantize", quantize_stage)

# Check that we get the additional (dq -> q
pipeline.add_stage_after(
"export", pipeline.tester.check_count, {"torch.ops.quantized_decomposed": 8}
)
pipeline.run()


@common.parametrize("test_data", Add.test_data)
def test_add_u55_BI(test_data: input_t1):
pipeline = EthosU55PipelineBI[input_t1](
Expand Down
Loading
Loading