Skip to content

Commit 5cc83fe

Browse files
author
Github Executorch
committed
Summary: MCU Tests: Add two basic qadd , qlinear qdq tests
- Enable on CI for consistent signals - Note that this is interim solution until a proper MCU testing standalone pipeline is ready Test Plan: - examples/arm/run_mcu_models_fvp.sh --target=cortex-m55 --models=qadd,qlinear ════════════════════════════════════════════════════════════════ 🏁 MCU MODEL VALIDATION SUMMARY - TARGET: cortex-m55 ════════════════════════════════════════════════════════════════ qadd : ✅ Passed qlinear : ✅ Passed Reviewers: Subscribers: Tasks: Tags:
1 parent a548635 commit 5cc83fe

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

examples/arm/aot_arm_compiler.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,19 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
297297
can_delegate = True
298298

299299

300+
class QuantLinearTest(torch.nn.Module):
301+
def __init__(self):
302+
super().__init__()
303+
# Define a simple linear layer
304+
self.linear = torch.nn.Linear(61, 37)
305+
306+
def forward(self, x):
307+
return self.linear(x)
308+
309+
example_input = (torch.randn([8, 61], dtype=torch.float32),)
310+
can_delegate = True
311+
312+
300313
models = {
301314
"add": AddModule,
302315
"add2": AddModule2,
@@ -306,6 +319,9 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
306319
"qops": QuantOpTest,
307320
"softmax": SoftmaxModule,
308321
"MultipleOutputsModule": MultipleOutputsModule,
322+
# TODO: Remove this from here, once we have dedicated MCU test pipeline ready. This is an interim solution.
323+
# See https://github.com/pytorch/executorch/discussions/13944
324+
"qlinear": QuantLinearTest,
309325
}
310326

311327
calibration_data = {
@@ -330,6 +346,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
330346
torch.randn(32, 2, 1) * 1000,
331347
),
332348
"softmax": (torch.randn(32, 2, 2),),
349+
"qlinear": (torch.randn(37, 61),),
333350
}
334351

335352
evaluators = {

examples/arm/run_mcu_models_fvp.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ VALID_TARGETS=(
2424
)
2525

2626
# Default models for MCU validation with portable kernels
27-
DEFAULT_MODELS=(mv2 mv3 lstm)
27+
DEFAULT_MODELS=(mv2 mv3 lstm qadd qlinear)
2828
# Available models (on FVP)
29-
AVAILABLE_MODELS=(mv2 mv3 lstm)
29+
AVAILABLE_MODELS=(mv2 mv3 lstm qadd qlinear)
3030
# Add the following models if you want to enable them later (atm they are not working on FVP)
3131
# edsr w2l ic3 ic4 resnet18 resnet50
3232

@@ -257,6 +257,7 @@ for model in "${MODELS[@]}"; do
257257
-m "$model" \
258258
--target="$ETHOS_TARGET" \
259259
--quantize \
260+
--enable_qdq_fusion_pass \
260261
--output="arm_test/$model"; then
261262
echo "❌ AOT compilation failed for $model"
262263
MODEL_SUCCESS=false

0 commit comments

Comments
 (0)