Skip to content

Commit d63dade

Browse files
Arm backend: Update VGF test for fused ReLU qparams (pytorch#22088)
Update the VGF rewrite-convolution regression for the ReLU fusion behavior introduced by D116922192. The ReLU is fused into the convolution before ConvertToClampPass runs, so the clamp is fused away and no clamp node remains. Verify that the fused convolution owns the output quantization parameters with qmin rewritten to the zero point. Rename the adjacent lowering test to describe the fused Conv-ReLU-Cat path. Test plan: - `buck test @fbcode//mode/dev fbcode//executorch/backends/arm/test:rewrite_conv_pass -- --exact "fbcode//executorch/backends/arm/test:rewrite_conv_pass - test_rewrite_conv_pass.py::test_fold_and_annotate_q_params_vgf_quant_tracks_fused_relu_qparams"` - `buck test @fbcode//mode/dev fbcode//executorch/backends/arm/test:rewrite_conv_pass -- --exact "fbcode//executorch/backends/arm/test:rewrite_conv_pass - test_rewrite_conv_pass.py::test_rewrite_conv_vgf_quant_handles_fused_conv_relu_cat_branch" "fbcode//executorch/backends/arm/test:rewrite_conv_pass - test_rewrite_conv_pass.py::test_rewrite_conv_vgf_quant_infers_quantized_bias_dtype_from_inputs"` - `arc lint -a` and `arc lint` on changed files - `python -m py_compile backends/arm/test/passes/test_rewrite_conv_pass.py` This PR was authored with Codex. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani
1 parent dd3b096 commit d63dade

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎backends/arm/test/passes/test_rewrite_conv_pass.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,22 @@ def test_rewrite_conv_a16w8_preserves_int32_after_permute() -> None:
534534

535535

536536
@pytest.mark.skipif(not _VGF_ENABLED, reason="VGF not enabled")
537-
def test_fold_and_annotate_q_params_vgf_quant_preserves_output_qparams_on_non_fuseable_clamp() -> (
538-
None
539-
):
537+
def test_fold_and_annotate_q_params_vgf_quant_tracks_fused_relu_qparams() -> None:
540538
exported_program = _export_quantized(TinyConvReluCat())
541539
gm = _run_pre_rewrite_passes(to_edge(exported_program).exported_program())
542540

543541
conv = _get_call_function_node(gm, exir_ops.edge.aten.convolution.default)
544-
clamp = _get_call_function_node(gm, exir_ops.edge.aten.clamp.default)
542+
output_qparams = conv.meta["output_qparams"][0]
545543

546544
assert conv.meta["input_qparams"]
547-
assert not conv.meta["output_qparams"]
548-
assert clamp.meta["output_qparams"]
545+
assert output_qparams.qmin == output_qparams.zp
546+
assert not any(
547+
node.target == exir_ops.edge.aten.clamp.default for node in gm.graph.nodes
548+
)
549549

550550

551551
@pytest.mark.skipif(not _VGF_ENABLED, reason="VGF not enabled")
552-
def test_rewrite_conv_vgf_quant_handles_non_fuseable_conv_clamp_cat_branch() -> None:
552+
def test_rewrite_conv_vgf_quant_handles_fused_conv_relu_cat_branch() -> None:
553553
exported_program = _export_quantized(TinyConvReluCat())
554554
compile_spec = _compile_spec()
555555

0 commit comments

Comments
 (0)