Skip to content

NXP backend: added support for aten.bmm#17818

Open
novak-vaclav wants to merge 1 commit intopytorch:mainfrom
nxp-upstream:feature/EIEX-709-add-support-for-aten-bmm
Open

NXP backend: added support for aten.bmm#17818
novak-vaclav wants to merge 1 commit intopytorch:mainfrom
nxp-upstream:feature/EIEX-709-add-support-for-aten-bmm

Conversation

@novak-vaclav
Copy link
Contributor

@novak-vaclav novak-vaclav commented Mar 3, 2026

Summary

adds support for aten.bmm operator.

The original PR is here, however I pushed to the branch without committing the work first and the PR closed itself auto-magically.

Test plan

tests can be manually run using pytest -c /dev/null backends/nxp/tests/

cc @robert-kalmar @JakeStevens @digantdesai @MartinPavella

Copilot AI review requested due to automatic review settings March 3, 2026 12:09
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 3, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17818

Note: Links to docs will display an error until the docs builds have been completed.

⚠️ 1 Awaiting Approval

As of commit 8fc1396 with merge base abc0237 (image):

AWAITING APPROVAL - The following workflow needs approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 3, 2026
@novak-vaclav
Copy link
Contributor Author

@pytorchbot label "release notes: nxp"

@novak-vaclav
Copy link
Contributor Author

@pytorchbot label "module: nxp"

@pytorch-bot pytorch-bot bot added release notes: nxp Changes to the NXP Neutron backend delegate module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ labels Mar 3, 2026
@MartinPavella MartinPavella requested review from MartinPavella and removed request for Copilot March 3, 2026 12:14
@novak-vaclav
Copy link
Contributor Author

@MartinPavella
Internal tests passing here.

Please try to re-run the periodic / gather models Github test if possible, according to the log it was stopped because some other, higher priority task was scheduled.

After that, this can be merged ✔️

@novak-vaclav novak-vaclav force-pushed the feature/EIEX-709-add-support-for-aten-bmm branch from 0c62f83 to 53924f3 Compare March 6, 2026 15:31
Copilot AI review requested due to automatic review settings March 6, 2026 15:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the aten.bmm (batch matrix multiply) operator in the NXP Neutron backend for ExecuTorch. It includes a new BMMConverter node converter, a BMMPattern quantization pattern, test models, and test cases.

Changes:

  • Adds BMMConverter class with IR support and target-level (num_macs) validation, converting aten.bmm to TFLite BatchMatMul with proper channels-first/last handling
  • Registers BMMPattern quantizer and BMMConverter in the partitioner/converter registries
  • Adds test models (BatchMatMulModel, BatchMatMulConvModel) and tests covering supported/unsupported shapes and conv+bmm fusion scenarios

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
bmm_converter.py Core converter implementation with IR and target support checks, channels-format handling
__init__.py Exports BMMConverter
edge_program_converter.py Registers BMMConverter for aten.bmm.default
neutron_partitioner.py Registers BMMConverter in the supported ops map
patterns.py Adds BMMPattern quantization pattern
neutron_quantizer.py Registers BMMPattern in the quantizer
models.py Adds BatchMatMulModel and BatchMatMulConvModel test models
test_bmm_converter.py Tests for supported/unsupported configs and conv+bmm quantization
op-support.csv Documents aten.bmm.default operator support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MartinPavella MartinPavella self-requested a review March 9, 2026 06:54
@novak-vaclav novak-vaclav force-pushed the feature/EIEX-709-add-support-for-aten-bmm branch from 53924f3 to abc0237 Compare March 16, 2026 09:10
@novak-vaclav novak-vaclav reopened this Mar 16, 2026
Copilot AI review requested due to automatic review settings March 16, 2026 09:16
@novak-vaclav novak-vaclav force-pushed the feature/EIEX-709-add-support-for-aten-bmm branch from 4ec6cd4 to a69dad7 Compare March 16, 2026 09:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@novak-vaclav
Copy link
Contributor Author

Fixed the issues mentioned by @MartinPavella
When rebasing and splitting the feature changes and the rebased changes into separate commits, and then pushing them in the wrong order, it automatically closes the PR. However I found out that it can be reopened.

@pytest.mark.parametrize(
"input_shape_x1, input_shape_x2",
[
pytest.param((1, 8, 16), (1, 16, 24), id="3D, x1_W not divisible by NUM_MACS."),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x1_W not divisible by NUM_MACS

Unless W refers to the first dimension, this is not true,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During the implementation and review of the feedback, I forgot to also modify this test. The test cases were all a bit off, so I fixed them. Please have a look.

@novak-vaclav novak-vaclav force-pushed the feature/EIEX-709-add-support-for-aten-bmm branch from a69dad7 to 8fc1396 Compare March 16, 2026 15:06
@novak-vaclav
Copy link
Contributor Author

Fixed all the issues, please have a look @MartinPavella

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants