Skip to content

Commit 1e42581

Browse files
authored
Arm backend: Fix div.Scalar (#21288)
Fix div.Scalar cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: Elena Zhelezina <elena.zhelezina@arm.com>
1 parent 4a26c64 commit 1e42581

2 files changed

Lines changed: 16 additions & 18 deletions

File tree

backends/arm/quantizer/quantizer_support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def check_pattern(cls, pattern):
168168
(torch.ops.aten.zeros_like.default,),
169169
(torch.ops.aten._softmax.default,),
170170
(torch.ops.aten.softmax.int,),
171+
(torch.ops.aten.div.Scalar,),
171172
(torch.ops.aten.div.Tensor,),
172173
(torch.ops.aten.div_.Tensor,),
173174
(torch.ops.aten.div.Tensor_mode,),

backends/arm/test/ops/test_div.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Optional, Tuple, Union
1010

11-
import pytest
1211
import torch
1312
from executorch.backends.arm.test import common
1413

@@ -181,29 +180,27 @@ def test_div_scalar_vgf_no_quant(test_data: input_t1):
181180
pipeline.run()
182181

183182

183+
aten_ops_quant = [
184+
"torch.ops.aten.reciprocal.default",
185+
"torch.ops.aten.mul.Tensor",
186+
]
187+
188+
exir_ops_quant = [
189+
"executorch_exir_dialects_edge__ops_aten_reciprocal_default",
190+
"executorch_exir_dialects_edge__ops_aten_mul_Tensor",
191+
]
192+
193+
184194
@common.parametrize("test_data", test_data_suite_scalar)
185-
@pytest.mark.xfail(
186-
reason=(
187-
"Quantized div.Scalar is rewritten to div.Tensor after the initial "
188-
"quantizer support match, so it misses DecomposeDivPass and remains "
189-
"outside the VGF delegate. MLETORCH-2366"
190-
),
191-
strict=True,
192-
)
193195
@common.SkipIfNoModelConverter
194196
def test_div_scalar_vgf_quant(test_data: input_t1):
195-
"""Test Tensor / Scalar division (VGF INT).
196-
197-
The quantized scalar path is rewritten before the ATen and should not be
198-
checked as div.Scalar. We keep expected op lists empty, matching the
199-
existing quantized div.Tensor test.
200-
201-
"""
197+
"""Test Tensor / Scalar division (VGF INT)."""
202198
pipeline = VgfPipeline[input_t1](
203199
DivScalar(),
204200
test_data(),
205-
[],
206-
[],
201+
aten_op=aten_ops_quant,
202+
exir_op=exir_ops_quant,
207203
quantize=True,
204+
use_to_edge_transform_and_lower=False,
208205
)
209206
pipeline.run()

0 commit comments

Comments
 (0)