Skip to content

Commit 0758007

Browse files
Reza Sajadianyfacebook-github-bot
authored andcommitted
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
1 parent 5d07ce0 commit 0758007

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

backends/cadence/aot/quantizer/fusion_pass.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ def call(self, graph_module: fx.GraphModule) -> PassResult: # noqa: C901
620620
)
621621
kwargs = {}
622622
if isinstance(pattern, AddReluPatterns):
623+
if len(dequants_inputs) != 2:
624+
continue
623625
# For AddReLU, we are fusing Add+ReLU.
624626
# The quantized_add op performs requantization,
625627
# so the relu is implicit in the output quant params.
@@ -633,6 +635,8 @@ def call(self, graph_module: fx.GraphModule) -> PassResult: # noqa: C901
633635
quant_node,
634636
)
635637
elif isinstance(pattern, AddPattern):
638+
if len(dequants_inputs) != 2:
639+
continue
636640
args, kwargs = get_args_and_kwargs_add(
637641
graph_module,
638642
inputs_inputs,

0 commit comments

Comments
 (0)