NXP backend: added support for aten.pad with mode reflect - #21515
NXP backend: added support for aten.pad with mode reflect#21515novak-vaclav wants to merge 1 commit into
aten.pad with mode reflect#21515Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21515
Note: Links to docs will display an error until the docs builds have been completed. ❌ 127 New Failures, 5 Cancelled Jobs, 2 Unrelated Failures, 6 Unclassified FailuresAs of commit f5b65ca with merge base e3571c2 ( NEW FAILURES - The following jobs have 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 JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
9b9736c to
97731d1
Compare
|
Fixed minor issues I found out about after creating the PR. |
97731d1 to
76b13f3
Compare
|
And rebased onto current main to run the tests on Neutron Software 3.2.0 |
76b13f3 to
fc14b2c
Compare
fc14b2c to
bc44109
Compare
bc44109 to
6bf8da0
Compare
|
Resolved comments from code review, resolved conflicts with main and rebased. |
roman-janik-nxp
left a comment
There was a problem hiding this comment.
Just move the comment, otherwise GJ!
6bf8da0 to
f5b65ca
Compare
|
Fixed all found issues in code review, rebased onto |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (3)
backends/nxp/backend/ir/converter/node_converters/ops_converters/pad_converter.py:33
PadConverter._get_mode()only looks at positional args. Ifaten.padis emitted with keyword arguments (common in FX graphs),modemay be present innode.kwargsand this will incorrectly default to "constant", causing reflect padding to be treated as unsupported and decomposed.
@staticmethod
def _get_mode(node: Node) -> str:
return node.args[2] if len(node.args) > 2 else "constant"
backends/nxp/backend/ir/converter/node_converters/ops_converters/pad_converter.py:87
_convert_paddings_to_tflite()is annotated to returnlist[int], but it actually returns a list of 2-element pairs (rank x 2). Also,paddings_reversedbecomes a list of NumPy row arrays, which then gets concatenated with Python lists; converting to plainlist[list[int]]early avoids mixed element types and matches whatMirrorPadexpects.
@staticmethod
def _convert_paddings_to_tflite(
paddings: Collection[int], input_tensor: tflite_model.Tensor
) -> list[int]:
# Group `padding` by two elements per list.
backends/nxp/neutron_partitioner.py:559
- Docstring has a mismatched bracket in the return-type description (
Optional[Callable[[torch.fx.Node], bool]]]:). This makes the rendered/parsed type unclear.
Returns:
List[torch._ops.OpOverload]: a list of ops that should not be decomposed.
Optional[Callable[[torch.fx.Node], bool]]]: an optional filter, called for each node in the
graph, that lets a node be decomposed even though its op is in the list above. A node is kept
(not decomposed) only if the filter returns True for it; if it returns False, the node is decomposed.
Summary
Added support for
aten.padwith modereflectusing new Neutron MLIR flow.Test plan
tests can be manually run using
pytest -c /dev/null backends/nxp/tests/cc @robert-kalmar @JakeStevens @digantdesai @rascani @MartinPavella