From 07580071a944dd6f25873904e9abc9363f1056ca Mon Sep 17 00:00:00 2001 From: Reza Sajadiany Date: Tue, 5 May 2026 16:54:10 -0700 Subject: [PATCH] bypass add and addRelu that have inputs from non-dq nodes Summary: The QuantFusion pass in crashes when an add node's inputs aren't dequantize_per_tensor ops. QAT model produces exactly this pattern. The dequants_inputs list ends up empty, and get_args_and_kwargs_add() indexes [0]. Differential Revision: D103949573 --- backends/cadence/aot/quantizer/fusion_pass.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backends/cadence/aot/quantizer/fusion_pass.py b/backends/cadence/aot/quantizer/fusion_pass.py index 5375367b929..36ba258ad20 100644 --- a/backends/cadence/aot/quantizer/fusion_pass.py +++ b/backends/cadence/aot/quantizer/fusion_pass.py @@ -620,6 +620,8 @@ def call(self, graph_module: fx.GraphModule) -> PassResult: # noqa: C901 ) kwargs = {} if isinstance(pattern, AddReluPatterns): + if len(dequants_inputs) != 2: + continue # For AddReLU, we are fusing Add+ReLU. # The quantized_add op performs requantization, # so the relu is implicit in the output quant params. @@ -633,6 +635,8 @@ def call(self, graph_module: fx.GraphModule) -> PassResult: # noqa: C901 quant_node, ) elif isinstance(pattern, AddPattern): + if len(dequants_inputs) != 2: + continue args, kwargs = get_args_and_kwargs_add( graph_module, inputs_inputs,