Skip to content

Commit f7c0f06

Browse files
authored
Revert "Arm backend: Add bfloat16 to relevant vgf tests." (#20663)
Reverts #20660 due to #20299 also getting reverted. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell
1 parent 37d354d commit f7c0f06

53 files changed

Lines changed: 83 additions & 426 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backends/arm/test/models/Qwen3_VL/test_qwen3_vl_layers.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,6 @@ class Qwen3VLTestCase:
474474
"qk_norm": TOSA_FP_TEST_CASES["qk_norm"],
475475
}
476476

477-
VGF_NO_QUANT_BF16_TEST_CASES: dict[str, Qwen3VLTestCase] = TOSA_BF16_TEST_CASES
478-
479477

480478
TOSA_MXFP8_TEST_CASES: dict[str, Qwen3VLTestCase] = {
481479
"text_attention": Qwen3VLTestCase(
@@ -604,25 +602,3 @@ def test_qwen3_vl_vgf_no_quant(test_case: Qwen3VLTestCase):
604602
transform_passes=list(test_case.transform_passes),
605603
)
606604
pipeline.run()
607-
608-
609-
@common.SkipIfNoModelConverter
610-
@common.parametrize(
611-
"test_case",
612-
VGF_NO_QUANT_BF16_TEST_CASES,
613-
)
614-
def test_qwen3_vl_vgf_no_quant_bf16(test_case: Qwen3VLTestCase):
615-
model, inputs = test_case.model_cls.prepare_model_and_inputs()
616-
model, inputs = _to_bfloat16(model, inputs)
617-
with torch.no_grad():
618-
pipeline = VgfPipeline[input_t](
619-
model,
620-
inputs,
621-
aten_op=[],
622-
exir_op=[],
623-
quantize=False,
624-
transform_passes=list(test_case.transform_passes),
625-
atol=5e-2,
626-
rtol=5e-2,
627-
)
628-
pipeline.run()

backends/arm/test/models/phi3/test_phi3_layers.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,14 @@ def _dtype_cases() -> list:
180180
]
181181

182182

183-
def _vgf_no_quant_dtype_cases() -> list:
184-
return [
185-
pytest.param(torch.float32, id="fp32"),
186-
pytest.param(torch.bfloat16, id="bf16"),
187-
]
188-
189-
190-
def _vgf_quant_dtype_cases() -> list:
183+
def _vgf_dtype_cases() -> list:
191184
return [
192185
pytest.param(torch.float32, id="fp32"),
186+
pytest.param(
187+
torch.bfloat16,
188+
marks=pytest.mark.xfail(reason="BF16 runtime support not ready for VGF."),
189+
id="bf16",
190+
),
193191
]
194192

195193

@@ -235,14 +233,12 @@ def test_phi3_tosa_INT_layers(name, module_factory, input_factory):
235233

236234

237235
@common.SkipIfNoModelConverter
238-
@pytest.mark.parametrize("dtype", _vgf_no_quant_dtype_cases())
236+
@pytest.mark.parametrize("dtype", _vgf_dtype_cases())
239237
@pytest.mark.parametrize("name,module_factory,input_factory", _module_cases())
240238
def test_phi3_vgf_no_quant_layers(name, module_factory, input_factory, dtype):
241239
config = _phi3_config()
242240
module = module_factory(config).to(dtype)
243241
inputs = input_factory(config, dtype)
244-
atol = 1e-02 if dtype == torch.bfloat16 else 1e-03
245-
rtol = 1e-02 if dtype == torch.bfloat16 else 1e-03
246242

247243
pipeline = VgfPipeline[input_t1 if len(inputs) == 1 else input_t2](
248244
module,
@@ -254,14 +250,12 @@ def test_phi3_vgf_no_quant_layers(name, module_factory, input_factory, dtype):
254250
InsertInt32CastsAfterInt64PlaceholdersPass(),
255251
],
256252
quantize=False,
257-
atol=atol,
258-
rtol=rtol,
259253
)
260254
pipeline.run()
261255

262256

263257
@common.SkipIfNoModelConverter
264-
@pytest.mark.parametrize("dtype", _vgf_quant_dtype_cases())
258+
@pytest.mark.parametrize("dtype", _vgf_dtype_cases())
265259
@pytest.mark.parametrize("name,module_factory,input_factory", _module_cases())
266260
def test_phi3_vgf_quant_layers(name, module_factory, input_factory, dtype):
267261
config = _phi3_config()

backends/arm/test/models/test_mobilenet_v2_arm.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,6 @@ def test_mv2_vgf_no_quant():
191191
pipeline.run()
192192

193193

194-
@common.SkipIfNoModelConverter
195-
def test_mv2_vgf_no_quant_bf16():
196-
bf16_model = models.mobilenetv2.mobilenet_v2(
197-
weights=MobileNet_V2_Weights.DEFAULT
198-
).eval()
199-
bf16_model = bf16_model.to(torch.bfloat16)
200-
bf16_input = normalize(torch.rand((1, 3, 224, 224))).to(torch.bfloat16)
201-
pipeline = VgfPipeline[input_t](
202-
bf16_model,
203-
(bf16_input,),
204-
aten_op=[],
205-
exir_op=[],
206-
use_to_edge_transform_and_lower=True,
207-
quantize=False,
208-
atol=2.5e-01,
209-
rtol=2.5e-01,
210-
)
211-
pipeline.run()
212-
213-
214194
def test_mv2_tosa_INT_FP_partial_quant():
215195
pipeline = TosaPipelineINT[input_t](
216196
mv2,

backends/arm/test/models/test_resnet18.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
EthosU85PipelineINT,
1515
TosaPipelineFP,
1616
TosaPipelineINT,
17-
VgfPipeline,
1817
)
1918

2019
from torchvision import transforms # type: ignore[import-untyped]
@@ -66,22 +65,6 @@ def test_resnet_18_tosa_FP_bf16():
6665
pipeline.run()
6766

6867

69-
@common.SkipIfNoModelConverter
70-
def test_resnet_18_vgf_no_quant_bf16():
71-
bf16_model = resnet18(weights=ResNet18_Weights).eval()
72-
bf16_model = bf16_model.to(torch.bfloat16)
73-
bf16_input = normalize(torch.rand((1, 3, 224, 224)) * 2 - 1).to(torch.bfloat16)
74-
pipeline = VgfPipeline[input_t](
75-
bf16_model,
76-
(bf16_input,),
77-
aten_op=[],
78-
quantize=False,
79-
atol=6e-01,
80-
rtol=6e-01,
81-
)
82-
pipeline.run()
83-
84-
8568
@common.parametrize("per_channel_quantization", quant_test_data)
8669
def test_resnet_18_tosa_INT(per_channel_quantization):
8770
pipeline = TosaPipelineINT[input_t](

backends/arm/test/ops/test_abs.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ def test_abs_u85_INT(test_data: torch.Tensor):
8888
pipeline.run()
8989

9090

91-
@common.parametrize(
92-
"test_data",
93-
Abs.test_parameters | Abs.test_parameters_bf16 | Abs.test_parameters_fp16,
94-
)
91+
@common.parametrize("test_data", Abs.test_parameters | Abs.test_parameters_fp16)
9592
@common.SkipIfNoModelConverter
9693
def test_abs_vgf_no_quant(test_data: input_t1):
9794
pipeline = VgfPipeline[input_t1](

backends/arm/test/ops/test_add.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,7 @@ def test_add_tensor_u85_INT_2(test_data: input_t2):
263263
pipeline.run()
264264

265265

266-
@common.parametrize(
267-
"test_data", Add.test_data | Add.test_data_fp16 | Add.test_data_bf16
268-
)
266+
@common.parametrize("test_data", Add.test_data | Add.test_data_fp16)
269267
@common.SkipIfNoModelConverter
270268
def test_add_tensor_vgf_no_quant(test_data: input_t1):
271269
pipeline = VgfPipeline[input_t1](

backends/arm/test/ops/test_alias_copy.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ def test_alias_u85_INT(test_data: input_t1):
9898
).run()
9999

100100

101-
@common.parametrize(
102-
"test_data",
103-
AliasCopy.test_data | AliasCopy.test_data_bf16 | AliasCopy.test_data_fp16,
104-
)
101+
@common.parametrize("test_data", AliasCopy.test_data | AliasCopy.test_data_fp16)
105102
@common.SkipIfNoModelConverter
106103
def test_alias_vgf_no_quant(test_data: input_t1):
107104
pipeline = VgfPipeline[input_t1](

backends/arm/test/ops/test_amax.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ def test_max_dim_tosa_FP_not_delegated():
212212
pipeline.run()
213213

214214

215-
@common.parametrize(
216-
"test_data", Amax.test_data | Amax.test_data_fp16 | Amax.test_data_bf16
217-
)
215+
@common.parametrize("test_data", Amax.test_data | Amax.test_data_fp16)
218216
@common.SkipIfNoModelConverter
219217
def test_amax_vgf_no_quant(test_data: Amax.input_t):
220218
data, dim, keep_dims = test_data()
@@ -242,9 +240,7 @@ def test_amax_vgf_quant(test_data: Amax.input_t):
242240
pipeline.run()
243241

244242

245-
@common.parametrize(
246-
"test_data", Max.test_data | Max.test_data_fp16 | Max.test_data_bf16
247-
)
243+
@common.parametrize("test_data", Max.test_data | Max.test_data_fp16)
248244
@common.SkipIfNoModelConverter
249245
def test_max_dim_vgf_no_quant_to_amax(test_data: Max.input_t):
250246
data, dim = test_data()

backends/arm/test/ops/test_amin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ def test_min_dim_tosa_FP_not_delegated():
224224
pipeline.run()
225225

226226

227-
@common.parametrize(
228-
"test_data", Amin.test_data | Amin.test_data_fp16 | Amin.test_data_bf16
229-
)
227+
@common.parametrize("test_data", Amin.test_data | Amin.test_data_fp16)
230228
@common.SkipIfNoModelConverter
231229
def test_amin_vgf_no_quant(test_data: Amin.input_t):
232230
data, dim, keep_dims = test_data()
@@ -252,9 +250,7 @@ def test_amin_vgf_quant(test_data: Amin.input_t):
252250
pipeline.run()
253251

254252

255-
@common.parametrize(
256-
"test_data", Min.test_data | Min.test_data_fp16 | Min.test_data_bf16
257-
)
253+
@common.parametrize("test_data", Min.test_data | Min.test_data_fp16)
258254
@common.SkipIfNoModelConverter
259255
def test_min_dim_vgf_no_quant_to_amin(test_data: Min.input_t):
260256
data, dim = test_data()

backends/arm/test/ops/test_avg_pool2d.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -286,31 +286,16 @@ def test_avg_pool2d_16a8w_u85_INT(test_module):
286286
pipeline.run()
287287

288288

289-
@common.parametrize(
290-
"test_module",
291-
test_modules | test_modules_bf16 | test_modules_fp16,
292-
xfails={
293-
"kernel_3x3_stride_1_pad_1_bf16": "'Unsupported BF16 PAD constant encoding' in emulation layer. MLCE-1887."
294-
},
295-
)
289+
@common.parametrize("test_module", test_modules | test_modules_fp16)
296290
@common.SkipIfNoModelConverter
297291
def test_avg_pool2d_vgf_no_quant(test_module):
298292
model, input_tensor = test_module()
299-
match input_tensor[0].dtype:
300-
case torch.bfloat16:
301-
atol = 5e-3
302-
rtol = 5e-3
303-
case _:
304-
atol = 1e-3
305-
rtol = 1e-3
306293
pipeline = VgfPipeline[input_t](
307294
model,
308295
input_tensor,
309296
aten_op,
310297
exir_op,
311298
quantize=False,
312-
atol=atol,
313-
rtol=rtol,
314299
)
315300
pipeline.run()
316301

0 commit comments

Comments
 (0)