From a38f326ff847ce1e2e4e7c141d5a50b7e24e201b Mon Sep 17 00:00:00 2001 From: Elena Zhelezina Date: Thu, 23 Jul 2026 13:29:54 +0100 Subject: [PATCH] Arm backend: Fix div.Scalar Change-Id: Iec5dafaf1b8ae07f159d4870c7a7ee3bdab5c2df Signed-off-by: Elena Zhelezina Change-Id: Ib87be6bc0795f2dadd38acc31aac1638068edc70 --- backends/arm/quantizer/quantizer_support.py | 1 + backends/arm/test/ops/test_div.py | 33 ++++++++++----------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/backends/arm/quantizer/quantizer_support.py b/backends/arm/quantizer/quantizer_support.py index 855b7cd489b..59b6efb084e 100644 --- a/backends/arm/quantizer/quantizer_support.py +++ b/backends/arm/quantizer/quantizer_support.py @@ -168,6 +168,7 @@ def check_pattern(cls, pattern): (torch.ops.aten.zeros_like.default,), (torch.ops.aten._softmax.default,), (torch.ops.aten.softmax.int,), + (torch.ops.aten.div.Scalar,), (torch.ops.aten.div.Tensor,), (torch.ops.aten.div_.Tensor,), (torch.ops.aten.div.Tensor_mode,), diff --git a/backends/arm/test/ops/test_div.py b/backends/arm/test/ops/test_div.py index 3aaa7aa4ae0..f35b5ac13d3 100644 --- a/backends/arm/test/ops/test_div.py +++ b/backends/arm/test/ops/test_div.py @@ -8,7 +8,6 @@ from typing import Optional, Tuple, Union -import pytest import torch from executorch.backends.arm.test import common @@ -181,29 +180,27 @@ def test_div_scalar_vgf_no_quant(test_data: input_t1): pipeline.run() +aten_ops_quant = [ + "torch.ops.aten.reciprocal.default", + "torch.ops.aten.mul.Tensor", +] + +exir_ops_quant = [ + "executorch_exir_dialects_edge__ops_aten_reciprocal_default", + "executorch_exir_dialects_edge__ops_aten_mul_Tensor", +] + + @common.parametrize("test_data", test_data_suite_scalar) -@pytest.mark.xfail( - reason=( - "Quantized div.Scalar is rewritten to div.Tensor after the initial " - "quantizer support match, so it misses DecomposeDivPass and remains " - "outside the VGF delegate. MLETORCH-2366" - ), - strict=True, -) @common.SkipIfNoModelConverter def test_div_scalar_vgf_quant(test_data: input_t1): - """Test Tensor / Scalar division (VGF INT). - - The quantized scalar path is rewritten before the ATen and should not be - checked as div.Scalar. We keep expected op lists empty, matching the - existing quantized div.Tensor test. - - """ + """Test Tensor / Scalar division (VGF INT).""" pipeline = VgfPipeline[input_t1]( DivScalar(), test_data(), - [], - [], + aten_op=aten_ops_quant, + exir_op=exir_ops_quant, quantize=True, + use_to_edge_transform_and_lower=False, ) pipeline.run()