NXP backend - added support for aten.conv2d using the new Neutron flow#19717
NXP backend - added support for aten.conv2d using the new Neutron flow#19717novak-vaclav wants to merge 2 commits into
aten.conv2d using the new Neutron flow#19717Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19717
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Cancelled Job, 2 Unclassified FailuresAs of commit 735d329 with merge base 10bc51e ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "module: nxp" |
|
@pytorchbot label "release notes: nxp" |
|
Please also review @MartinPavella @roman-janik-nxp @StrycekSimon. Thank you 😄 |
There was a problem hiding this comment.
Pull request overview
Adds aten.conv2d delegation coverage for the NXP Neutron “new flow” and expands the NXP backend test suite to validate delegation behavior and (where possible) numerical correctness.
Changes:
- Add a new-flow support-check path in the convolution converter and tighten failure behavior when group conv decomposition is missing.
- Add extensive new pytest coverage for conv2d delegation/non-delegation scenarios under the new Neutron flow (including depthwise and edge/bounds cases, plus targeted
xfails for known issues). - Improve NPU-vs-CPU mismatch reporting in the output comparator by including the max diff in the assertion message.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| backends/nxp/tests/model_output_comparator.py | Improves assertion failure message for output mismatches. |
| backends/nxp/tests/ir/converter/node_converter/test_conv_converter.py | Adds a large new test suite for conv2d under the new Neutron flow, including delegation checks and known-issue xfails. |
| backends/nxp/backend/ir/converter/node_converters/ops_converters/convolution_converter.py | Introduces new-flow target support checks and adjusts convolution argument handling / group-conv behavior. |
| backends/nxp/aten_passes/split_group_convolution.py | Updates group-conv splitting pass to handle optional bias and propagate FakeTensor meta safely. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9cedbc4 to
bc6ecdf
Compare
|
Fixed the issues found by Copilot. |
MartinPavella
left a comment
There was a problem hiding this comment.
Will review the rest of test_conv_converter tomorrow.
|
@novak-vaclav please take a look at this issue: https://jira.sw.nxp.com/browse/EIEX-809 |
bc6ecdf to
e6db65f
Compare
|
|
Fixed issues mentioned by @MartinPavella and updated the tests so they are based on Neutron SW 3.1.2. The support for padding mode |
e6db65f to
1f46333
Compare
|
Fixed issues mentioned by Copilot. Note: I am not using the |
|
Now I see I will have to rebase onto the Neutron SW 3.1.2 branch, will do |
MartinPavella
left a comment
There was a problem hiding this comment.
LGTM 👍🏻
I will approve after you rebase to the 3.1.2 PR
1f46333 to
ba6aee9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 50 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
backends/nxp/tests/ir/converter/node_converter/test_conv_converter.py:1
AllCloseOutputComparatoris imported fromexecutorch.backends.nxp.tests.nsys_testing, but in this PR other test modules import output comparators fromexecutorch.backends.nxp.tests.model_output_comparator. Ifnsys_testingdoesn’t define/re-exportAllCloseOutputComparator, this will fail at import time. Import the comparator from its actual module (or re-export it explicitly innsys_testing/a shared test utilities module) to keep imports consistent and avoid test collection errors.
examples/nxp/setup.sh:1- The
--index-urlvalue is unquoted; ifEIQ_PYPI_URLever contains special characters (or is empty/oddly formatted), word-splitting can break the command. Quote the variable (\"${EIQ_PYPI_URL}\") to make the script more robust.
ba6aee9 to
469260c
Compare
|
Fixed the issues with not taking into account the transposed variant of |
MartinPavella
left a comment
There was a problem hiding this comment.
LGTM. Once tests pass, we can merge.
|
@novak-vaclav please take a look at the failing linting and neutron job. |
469260c to
c6029b3
Compare
c6029b3 to
6e3f568
Compare
6e3f568 to
270b744
Compare
270b744 to
5a99b69
Compare
5a99b69 to
735d329
Compare
| w_data = self._get_tensor_constant_from_node(w) | ||
| b_data = self._get_tensor_constant_from_node(b) | ||
| if w_data is None or b_data is None: | ||
| continue # Only the standard case with static weights and bias is supported. | ||
|
|
||
| with_bias = b is not None | ||
| # Only the standard case with static weights and static bias (or bias=False) is supported. | ||
| if w_data is None or (b_data is None and with_bias): | ||
| continue |
| pytest.mark.xfail( | ||
| reason="AIR-14679: should start working after `conv2d` giving incorrect results is fixed by Neutron team.", | ||
| strict=True, | ||
| ) | ||
|
|
||
| def test_nsys_inference__with_conv(self, mocker): |
| elif conv_utils.group_conv_convertible_into_multiple_convolutions( | ||
| t_op, conv_params.groups | ||
| ): # Convert to separated `Conv2D`. | ||
| t_op.builtin_options = conv_2d_options.Conv2D() | ||
|
|
||
| return conv_utils.create_separated_convolutions_based_on_group( | ||
| t_op, | ||
| conv_params, | ||
| self.builder, | ||
| self._convert_unpadded_2D, | ||
| conv_utils.conv_op_factory, | ||
| ) | ||
| ): | ||
| raise RuntimeError("NXP backend: Group convolution was not decomposed.") |
| ).exported_program() | ||
|
|
||
| assert len(edge_program.graph.nodes) == 21 | ||
| assert len(edge_program.graph.nodes) == 7 |
Summary
Added support for
aten.conv2dusing new Neutron flow.Test plan
tests can be manually run using
pytest -c /dev/null backends/nxp/tests/cc @robert-kalmar @JakeStevens @digantdesai @rascani @MartinPavella