Skip to content

Commit 65aacaa

Browse files
authored
NXP backend: remove pytorch#22179 workaround for QAT channels-last segfault (pytorch#22746)
What: test_mlperf_tiny_classification_mse_cpu_vs_npu used the Python edge reference instead of the portable-kernel C++ reference for the QAT plus channels-last variant, because that configuration segfaulted in the portable kernels. Why: the crash is fixed on current main (issue pytorch#22179). The reporter's stack predates two out-of-bounds fixes in the portable dequantize path that this model exercises at runtime (16 per-channel dequantize ops): pytorch#21517 fixed an out-of-bounds traversal for non-contiguous (channels-last) inputs, and pytorch#21773 fixed misreading int32 zero points as int64. The int32 zero points are QAT-only: QAT emits int32 bias zero points while PTQ emits int64, matching the issue's QAT-only signature. Verification: exported the exact failing configuration (QAT, channels-last, 15-epoch training, dataset calibration, NXP edge passes) and ran it with the portable-kernel executor_runner. It runs cleanly and its outputs bit-match the eager quantized reference. The quantized_kernels_test suite passes 74/74, including the regression tests from both fixes. lintrunner reports no issues on the touched file. The NXP SDK-gated test itself was not run here (no SDK); NXP CI will exercise it. Fixes pytorch#22179 Authored with AI assistance (Muse Code). cc @robert-kalmar @digantdesai @rascani
1 parent ec15631 commit 65aacaa

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎backends/nxp/tests/models/test_mlperf_tiny_image_classification.py‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,14 @@ def test_mlperf_tiny_classification_mse_cpu_vs_npu(
8080
else None
8181
)
8282

83-
# This model does not work in channels-last format and QAT when running using portable kernels.
84-
# See more information below.
85-
# Github issue: https://github.com/pytorch/executorch/issues/22179
86-
# NXP internal issue ID: EIEX-1065
87-
ref_model = (
88-
ReferenceModel.QUANTIZED_EDGE_PYTHON
89-
if channels_last and use_qat
90-
else ReferenceModel.QUANTIZED_EXECUTORCH_CPP
91-
)
92-
9383
lower_run_compare(
9484
model,
9585
[input_spec],
9686
model_verifier,
9787
request,
9888
dataset_creator=dataset_creator,
9989
output_comparator=comparator,
100-
reference_model=ref_model,
90+
reference_model=ReferenceModel.QUANTIZED_EXECUTORCH_CPP,
10191
mocker=mocker,
10292
use_qat=use_qat,
10393
train_fn=train_fn,

0 commit comments

Comments
 (0)