Skip to content

Commit f281d17

Browse files
Add a16w8 per-op test for gelu (#19598)
Summary: Add int16 activation / int8 weight (a16w8) quantization tests for `aten.gelu` on Ethos-U55 and Ethos-U85. ## Changes - Add `test_gelu_a16w8_u55_INT` using `EthosU55PipelineINT` with `a16w8_quantization=True, symmetric_io_quantization=True, qtol=128, epsilon=2**-16`, reusing existing `Gelu.test_data` parameters (12 test configurations covering both \`none\` and \`tanh\` approximation modes) - Add `test_gelu_a16w8_u85_INT` using `EthosU85PipelineINT` with same kwargs - Register `ops/test_gelu.py` in `fbcode/` and `xplat/` `targets.bzl` bypass-pytorch-oss-checks Differential Revision: D104532359
1 parent 09b0ebf commit f281d17

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

backends/arm/test/ops/test_gelu.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Tuple
77

88
import torch
9+
910
from executorch.backends.arm.test import common
1011
from executorch.backends.arm.test.tester.test_pipeline import (
1112
EthosU55PipelineINT,
@@ -176,3 +177,37 @@ def test_gelu_vgf_quant(test_data: input_t1):
176177
quantize=True,
177178
)
178179
pipeline.run()
180+
181+
182+
@common.parametrize("test_data", Gelu.test_data)
183+
@common.XfailIfNoCorstone300
184+
def test_gelu_a16w8_u55_INT(test_data: input_t1):
185+
approximate, data = test_data()
186+
pipeline = EthosU55PipelineINT[input_t1](
187+
Gelu(approximate),
188+
(data,),
189+
Gelu.aten_op,
190+
Gelu.exir_op,
191+
a16w8_quantization=True,
192+
symmetric_io_quantization=True,
193+
qtol=128,
194+
epsilon=2**-16,
195+
)
196+
pipeline.run()
197+
198+
199+
@common.parametrize("test_data", Gelu.test_data)
200+
@common.XfailIfNoCorstone320
201+
def test_gelu_a16w8_u85_INT(test_data: input_t1):
202+
approximate, data = test_data()
203+
pipeline = EthosU85PipelineINT[input_t1](
204+
Gelu(approximate),
205+
(data,),
206+
Gelu.aten_op,
207+
Gelu.exir_op,
208+
a16w8_quantization=True,
209+
symmetric_io_quantization=True,
210+
qtol=128,
211+
epsilon=2**-16,
212+
)
213+
pipeline.run()

backends/arm/test/targets.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def define_arm_tests():
4141
"ops/test_mean_dim.py",
4242
"ops/test_var.py",
4343
"ops/test_conv1d.py",
44+
"ops/test_gelu.py",
4445
]
4546

4647
# Quantization

0 commit comments

Comments
 (0)