Skip to content

NXP backend: Add post-quantization data utilization to aot_neutron_compile.py.#17479

Merged
MartinPavella merged 1 commit intopytorch:mainfrom
nxp-upstream:nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning
Feb 20, 2026
Merged

NXP backend: Add post-quantization data utilization to aot_neutron_compile.py.#17479
MartinPavella merged 1 commit intopytorch:mainfrom
nxp-upstream:nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning

Conversation

@MartinPavella
Copy link
Copy Markdown
Collaborator

@MartinPavella MartinPavella commented Feb 16, 2026

Summary

A recent PR added the option to use the post-quantization state dict to access static data during quantization. This PR adds this feature to the aot_neutron_compile.py.

Test plan

Unit-test with the example MobileNetV2 is provided.

cc @robert-kalmar @JakeStevens @digantdesai

@MartinPavella MartinPavella self-assigned this Feb 16, 2026
@MartinPavella MartinPavella added the module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ label Feb 16, 2026
@MartinPavella MartinPavella added the release notes: nxp Changes to the NXP Neutron backend delegate label Feb 16, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 16, 2026

🔗 Helpful Links

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

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

❌ 4 New Failures

As of commit f99baab with merge base 2cad5db (image):

NEW FAILURES - The following jobs have failed:

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 Feb 16, 2026
@StrycekSimon StrycekSimon requested a review from Copilot February 16, 2026 14:10
Copy link
Copy Markdown
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

Adds support in the NXP AOT compile example for using post-quantization model data (state dict) during partitioning/lowering, and introduces a regression test intended to validate end-to-end delegation for MobileNetV2.

Changes:

  • Pass post_quantization_state_dict=module.state_dict() into NeutronPartitioner in aot_neutron_compile.py when delegation is enabled.
  • Add a new pytest that runs the AOT example script for MobileNetV2 and inspects the produced .pte for delegation.

Reviewed changes

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

File Description
examples/nxp/aot_neutron_compile.py Provides post-quantization state dict to the partitioner so static tensors can be recovered during partitioning with fake tensors.
backends/nxp/tests/test_aot_example.py Adds an end-to-end test that runs the example script and validates the serialized program contains Neutron delegation.

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

Comment thread backends/nxp/tests/test_aot_example.py Outdated
Comment thread backends/nxp/tests/test_aot_example.py Outdated
Comment thread backends/nxp/tests/test_aot_example.py Outdated
@MartinPavella MartinPavella force-pushed the nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning branch 2 times, most recently from 23adc42 to ad6d973 Compare February 17, 2026 08:01
@JakeStevens
Copy link
Copy Markdown
Contributor

looks like it is failing to load from URL.

Maybe just use random weights + data instead of "real"?

@MartinPavella MartinPavella force-pushed the nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning branch 2 times, most recently from aac78f3 to 24c6762 Compare February 18, 2026 14:00
@MartinPavella MartinPavella force-pushed the nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning branch from 24c6762 to 3c23f5a Compare February 19, 2026 13:34
…ompile.py`.

This data is used to correctly assess Neutron operator support during partitioning.
@MartinPavella MartinPavella force-pushed the nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning branch from 3c23f5a to f99baab Compare February 20, 2026 08:15
@MartinPavella
Copy link
Copy Markdown
Collaborator Author

The failing checks seem unrelated and the internal build passed. Merging.

@MartinPavella MartinPavella merged commit bd6a75d into pytorch:main Feb 20, 2026
149 of 153 checks passed
@MartinPavella MartinPavella deleted the nxg01483/EIEX-731-use-post-quantization-state-dict-in-aot_neutron_compile-partitioning branch February 20, 2026 10:30
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.

4 participants