Skip to content

Commit 132e43a

Browse files
committed
NXP backend: Update Neutron SW to 3.1.3
1 parent 2ec218c commit 132e43a

5 files changed

Lines changed: 19 additions & 123 deletions

File tree

backends/nxp/requirements-eiq.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
--index-url https://eiq.nxp.com/repository
2-
eiq-neutron-sdk==3.1.2
2+
eiq-neutron-sdk==3.1.3
33
eiq_nsys

backends/nxp/tests/ir/converter/node_converter/test_conv_converter.py

Lines changed: 13 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ def assert_delegated_and_correct(model, input_shape, mocker, request, use_qat):
201201
expected_delegated_ops={Convolution: 1},
202202
expected_non_delegated_ops={},
203203
)
204-
dataset = RandomDatasetCreator(low=-256, high=256)
204+
dataset = RandomDatasetCreator(low=-1, high=1)
205+
206+
# Use quantized dataset and allow single bit error.
207+
remove_quant_io_ops = True
205208
comparator = AllCloseOutputComparator(atol=1)
206209

207210
lower_run_compare(
@@ -212,6 +215,7 @@ def assert_delegated_and_correct(model, input_shape, mocker, request, use_qat):
212215
dataset,
213216
comparator,
214217
use_qat=use_qat,
218+
remove_quant_io_ops=remove_quant_io_ops,
215219
)
216220

217221
@staticmethod
@@ -248,40 +252,24 @@ def assert_not_delegated(model, input_shape, use_qat):
248252
oc := 16,
249253
qat := True,
250254
id=f"qat={qat}, basic inference: " + _conv_id(ins, oc),
251-
marks=pytest.mark.xfail(
252-
reason="AIR-14679",
253-
strict=True,
254-
),
255255
),
256256
pytest.param(
257257
ins := (8, 16, 8, 32),
258258
oc := 16,
259259
qat := False,
260260
id=f"qat={qat}, basic inference: " + _conv_id(ins, oc),
261-
marks=pytest.mark.xfail(
262-
reason="AIR-14679",
263-
strict=True,
264-
),
265261
),
266262
pytest.param(
267263
ins := (16, 8, 32, 64),
268264
oc := 32,
269265
qat := True,
270266
id=f"qat={qat}, basic inference: " + _conv_id(ins, oc),
271-
marks=pytest.mark.xfail(
272-
reason="AIR-14679",
273-
strict=True,
274-
),
275267
),
276268
pytest.param(
277269
ins := (16, 8, 32, 64),
278270
oc := 32,
279271
qat := False,
280272
id=f"qat={qat}, basic inference: " + _conv_id(ins, oc),
281-
marks=pytest.mark.xfail(
282-
reason="AIR-14679",
283-
strict=True,
284-
),
285273
),
286274
pytest.param(
287275
ins := (1, 8, 32, 64),
@@ -300,10 +288,6 @@ def assert_not_delegated(model, input_shape, use_qat):
300288
oc := 24,
301289
qat := True,
302290
id=f"qat={qat}, basic inference: " + _conv_id(ins, oc),
303-
marks=pytest.mark.xfail(
304-
reason="AIR-14679",
305-
strict=True,
306-
),
307291
),
308292
pytest.param(
309293
ins := (1, 32, 48, 8),
@@ -347,30 +331,18 @@ def test__basic_nsys_inference(
347331
qat := False,
348332
id=f"qat={qat}, basic inference, depthwise: "
349333
+ _conv_id(ins, ins[1], g=ins[1]),
350-
marks=pytest.mark.xfail(
351-
reason="AIR-14679",
352-
strict=True,
353-
),
354334
),
355335
pytest.param(
356336
ins := (16, 8, 32, 64),
357337
qat := True,
358338
id=f"qat={qat}, basic inference, depthwise: "
359339
+ _conv_id(ins, ins[1], g=ins[1]),
360-
marks=pytest.mark.xfail(
361-
reason="AIR-14679",
362-
strict=True,
363-
),
364340
),
365341
pytest.param(
366342
ins := (16, 8, 32, 64),
367343
qat := False,
368344
id=f"qat={qat}, basic inference, depthwise: "
369345
+ _conv_id(ins, ins[1], g=ins[1]),
370-
marks=pytest.mark.xfail(
371-
reason="AIR-14679",
372-
strict=True,
373-
),
374346
),
375347
pytest.param(
376348
ins := (1, 16, 32, 64),
@@ -398,9 +370,7 @@ def test__basic_nsys_inference(
398370
),
399371
],
400372
)
401-
def test__basic_nsys_inference_depthwise(
402-
self, input_shape, is_qat, request, mocker
403-
):
373+
def test__depthwise(self, input_shape, is_qat, request, mocker):
404374
out_channels = input_shape[1]
405375
group = input_shape[1]
406376
model = Conv2dModule(
@@ -483,16 +453,10 @@ def test__basic_nsys_inference_depthwise(
483453
oc := 27,
484454
qat := False,
485455
id=f"qat={qat}, unusual shape inference: " + _conv_id(ins, oc),
486-
marks=pytest.mark.xfail(
487-
reason="AIR-14679",
488-
strict=True,
489-
),
490456
),
491457
],
492458
)
493-
def test__basic_nsys_inference__unusual_shapes(
494-
self, input_shape, out_channels, is_qat, request, mocker
495-
):
459+
def test__unusual_shapes(self, input_shape, out_channels, is_qat, request, mocker):
496460
model = Conv2dModule(in_channels=input_shape[1], out_channels=out_channels)
497461

498462
self.assert_delegated_and_correct(model, input_shape, mocker, request, is_qat)
@@ -565,10 +529,6 @@ def test__basic_nsys_inference__unusual_shapes(
565529
qat := True,
566530
id=f"qat={qat}, unusual shape inference, depthwise: "
567531
+ _conv_id(ins, ins[1], g=ins[1]),
568-
marks=pytest.mark.xfail(
569-
reason="AIR-14679",
570-
strict=True,
571-
),
572532
),
573533
pytest.param(
574534
ins := (4, 21, 13, 17),
@@ -578,9 +538,7 @@ def test__basic_nsys_inference__unusual_shapes(
578538
),
579539
],
580540
)
581-
def test__basic_nsys_inference_depthwise__unusual_shapes(
582-
self, input_shape, is_qat, request, mocker
583-
):
541+
def test__depthwise__unusual_shapes(self, input_shape, is_qat, request, mocker):
584542
out_channels = input_shape[1]
585543
group = input_shape[1]
586544

@@ -607,9 +565,7 @@ def test__basic_nsys_inference_depthwise__unusual_shapes(
607565
),
608566
],
609567
)
610-
def test__basic_nsys_inference__implicit_batch(
611-
self, input_shape, out_channels, is_qat, mocker, request
612-
):
568+
def test__implicit_batch(self, input_shape, out_channels, is_qat, mocker, request):
613569
in_channels = input_shape[0]
614570

615571
model = Conv2dModule(in_channels=in_channels, out_channels=out_channels)
@@ -716,10 +672,6 @@ def test__basic_nsys_inference__implicit_batch(
716672
d := (1, 4096),
717673
qat := True,
718674
id=f"qat={qat}, bounds of dilation width: {_conv_id(ins, oc, ks=ks, s=s, d=d)}",
719-
marks=pytest.mark.xfail(
720-
reason="AIR-14679",
721-
strict=True,
722-
),
723675
),
724676
pytest.param(
725677
ins := (3, 3, 3, 8500),
@@ -729,10 +681,6 @@ def test__basic_nsys_inference__implicit_batch(
729681
d := (1, 4096),
730682
qat := False,
731683
id=f"qat={qat}, bounds of dilation width: {_conv_id(ins, oc, ks=ks, s=s, d=d)}",
732-
marks=pytest.mark.xfail(
733-
reason="AIR-14679",
734-
strict=True,
735-
),
736684
),
737685
pytest.param(
738686
ins := (4, 3, 8500, 3),
@@ -742,10 +690,6 @@ def test__basic_nsys_inference__implicit_batch(
742690
d := (4096, 1),
743691
qat := True,
744692
id=f"qat={qat}, bounds of dilation height: {_conv_id(ins, oc, ks=ks, s=s, d=d)}",
745-
marks=pytest.mark.xfail(
746-
reason="AIR-14679",
747-
strict=True,
748-
),
749693
),
750694
pytest.param(
751695
ins := (4, 3, 8500, 3),
@@ -755,10 +699,6 @@ def test__basic_nsys_inference__implicit_batch(
755699
d := (4096, 1),
756700
qat := False,
757701
id=f"qat={qat}, bounds of dilation height: {_conv_id(ins, oc, ks=ks, s=s, d=d)}",
758-
marks=pytest.mark.xfail(
759-
reason="AIR-14679",
760-
strict=True,
761-
),
762702
),
763703
pytest.param(
764704
ins := (2, 80, 35, 34),
@@ -788,7 +728,7 @@ def test__basic_nsys_inference__implicit_batch(
788728
),
789729
],
790730
)
791-
def test__basic_nsys_inference__big(
731+
def test__big(
792732
self,
793733
input_shape,
794734
out_channels,
@@ -907,10 +847,6 @@ def test__basic_nsys_inference__big(
907847
d := (4096, 1),
908848
qat := False,
909849
id=f"qat={qat}, bounds of dilation height: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, g=ins[1])}",
910-
marks=pytest.mark.xfail(
911-
reason="AIR-14679",
912-
strict=True,
913-
),
914850
),
915851
pytest.param(
916852
ins := (2, 80, 35, 34),
@@ -919,10 +855,6 @@ def test__basic_nsys_inference__big(
919855
d := 1,
920856
qat := True,
921857
id=f"qat={qat}, bounds of kernel_h * kernel_w * input_channels: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, g=ins[1])}",
922-
marks=pytest.mark.xfail(
923-
reason="AIR-14679",
924-
strict=True,
925-
),
926858
),
927859
pytest.param(
928860
ins := (2, 80, 35, 34),
@@ -931,14 +863,10 @@ def test__basic_nsys_inference__big(
931863
d := 1,
932864
qat := False,
933865
id=f"qat={qat}, bounds of kernel_h * kernel_w * input_channels: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, g=ins[1])}",
934-
marks=pytest.mark.xfail(
935-
reason="AIR-14679",
936-
strict=True,
937-
),
938866
),
939867
],
940868
)
941-
def test__basic_nsys_inference_depthwise__big(
869+
def test__depthwise__big(
942870
self, input_shape, kernel_size, stride, dilation, is_qat, request, mocker
943871
):
944872
out_channels = input_shape[1]
@@ -968,10 +896,6 @@ def test__basic_nsys_inference_depthwise__big(
968896
b := True,
969897
qat := True,
970898
id=f"qat={qat}, some params not default: {_conv_id(ins, oc, ks=ks, s=s, d=d, p=p, b=b)}",
971-
marks=pytest.mark.xfail(
972-
reason="AIR-14679",
973-
strict=True,
974-
),
975899
),
976900
pytest.param(
977901
ins := (1, 8, 32, 32),
@@ -1038,10 +962,6 @@ def test__basic_nsys_inference_depthwise__big(
1038962
b := False,
1039963
qat := True,
1040964
id=f"qat={qat}, some params not default: {_conv_id(ins, oc, ks=ks, s=s, d=d, p=p, b=b)}",
1041-
marks=pytest.mark.xfail(
1042-
reason="AIR-14679",
1043-
strict=True,
1044-
),
1045965
),
1046966
pytest.param(
1047967
ins := (3, 2, 40, 20),
@@ -1053,10 +973,6 @@ def test__basic_nsys_inference_depthwise__big(
1053973
b := False,
1054974
qat := False,
1055975
id=f"qat={qat}, some params not default: {_conv_id(ins, oc, ks=ks, s=s, d=d, p=p, b=b)}",
1056-
marks=pytest.mark.xfail(
1057-
reason="AIR-14679",
1058-
strict=True,
1059-
),
1060976
),
1061977
pytest.param(
1062978
ins := (4, 6, 30, 30),
@@ -1068,10 +984,6 @@ def test__basic_nsys_inference_depthwise__big(
1068984
b := True,
1069985
qat := True,
1070986
id=f"qat={qat}, some params not default: {_conv_id(ins, oc, ks=ks, s=s, d=d, p=p, b=b)}",
1071-
marks=pytest.mark.xfail(
1072-
reason="AIR-14679",
1073-
strict=True,
1074-
),
1075987
),
1076988
pytest.param(
1077989
ins := (4, 6, 30, 30),
@@ -1130,7 +1042,7 @@ def test__basic_nsys_inference_depthwise__big(
11301042
),
11311043
],
11321044
)
1133-
def test__nsys_inference__non_default_params(
1045+
def test__non_default_params(
11341046
self,
11351047
input_shape,
11361048
out_channels,
@@ -1207,10 +1119,6 @@ def test__nsys_inference__non_default_params(
12071119
b := True,
12081120
qat := True,
12091121
id=f"qat={qat}, some params not default: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, p=p, b=b, g=ins[1])}",
1210-
marks=pytest.mark.xfail(
1211-
reason="AIR-14679",
1212-
strict=True,
1213-
),
12141122
),
12151123
pytest.param(
12161124
ins := (2, 12, 28, 28),
@@ -1230,10 +1138,6 @@ def test__nsys_inference__non_default_params(
12301138
p := (0, 2),
12311139
b := False,
12321140
qat := True,
1233-
marks=pytest.mark.xfail(
1234-
reason="AIR-14679",
1235-
strict=True,
1236-
),
12371141
id=f"qat={qat}, some params not default: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, p=p, b=b, g=ins[1])}",
12381142
),
12391143
pytest.param(
@@ -1244,10 +1148,6 @@ def test__nsys_inference__non_default_params(
12441148
p := (0, 2),
12451149
b := False,
12461150
qat := False,
1247-
marks=pytest.mark.xfail(
1248-
reason="AIR-14679",
1249-
strict=True,
1250-
),
12511151
id=f"qat={qat}, some params not default: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, p=p, b=b, g=ins[1])}",
12521152
),
12531153
pytest.param(
@@ -1258,10 +1158,6 @@ def test__nsys_inference__non_default_params(
12581158
p := (2, 2),
12591159
b := True,
12601160
qat := True,
1261-
marks=pytest.mark.xfail(
1262-
reason="AIR-14679",
1263-
strict=True,
1264-
),
12651161
id=f"qat={qat}, some params not default: {_conv_id(ins, ins[1], ks=ks, s=s, d=d, p=p, b=b, g=ins[1])}",
12661162
),
12671163
pytest.param(
@@ -1316,7 +1212,7 @@ def test__nsys_inference__non_default_params(
13161212
),
13171213
],
13181214
)
1319-
def test__nsys_inference_depthwise__non_default_params(
1215+
def test__depthwise__non_default_params(
13201216
self,
13211217
input_shape,
13221218
kernel_size,

backends/nxp/tests/model_output_comparator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def compare_sample(self, sample_dir, cpu_output_tensors, npu_output_tensors):
122122
all_close = np.allclose(cpu_tensor, npu_tensor, atol=self.atol)
123123
max_diff = None
124124
if not all_close:
125-
max_diff = np.abs(cpu_tensor - npu_tensor).max()
125+
max_diff = np.abs(np.float32(cpu_tensor) - np.float32(npu_tensor)).max()
126126
assert (
127127
all_close
128128
), f"NPU output doesn't match reference. Maximum absolute difference: {max_diff}"

docs/source/backends/nxp/nxp-overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ Among currently supported machine learning models are:
2323
## Development Requirements
2424

2525
- [MCUXpresso IDE](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE) or [MCUXpresso Visual Studio Code extension](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-for-visual-studio-code:MCUXPRESSO-VSC)
26-
- [MCUXpresso SDK 25.12](https://mcuxpresso.nxp.com/mcuxsdk/25.12.00/html/index.html)
27-
- eIQ Neutron SDK version 3.1.2, what you can download from eIQ PyPI:
26+
- [MCUXpresso SDK 26.06](https://mcuxpresso.nxp.com/mcuxsdk/26.06.00/html/index.html)
27+
- eIQ Neutron SDK version 3.1.3, what you can download from eIQ PyPI:
2828

2929
```commandline
30-
$ pip install --index-url https://eiq.nxp.com/repository eiq-neutron-sdk==3.1.2
30+
$ pip install --index-url https://eiq.nxp.com/repository eiq-neutron-sdk==3.1.3
3131
```
3232

3333
Instead of manually installing requirements, except MCUXpresso IDE and SDK, you can use the setup script:

examples/nxp/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -u
88
EIQ_PYPI_URL="${EIQ_PYPI_URL:-https://eiq.nxp.com/repository}"
99

1010
# Install eIQ Neutron dependencies - SDK and simulator
11-
pip install --index-url ${EIQ_PYPI_URL} eiq-neutron-sdk==3.1.2 eiq_nsys
11+
pip install --index-url ${EIQ_PYPI_URL} eiq-neutron-sdk==3.1.3 eiq_nsys
1212

1313
# Get the directory of the current script
1414
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

0 commit comments

Comments
 (0)