Skip to content

Adds QAT ConvBN fuse pass to utils#17599

Merged
JakeStevens merged 1 commit intopytorch:mainfrom
JakeStevens:export-D93904683
Mar 5, 2026
Merged

Adds QAT ConvBN fuse pass to utils#17599
JakeStevens merged 1 commit intopytorch:mainfrom
JakeStevens:export-D93904683

Conversation

@JakeStevens
Copy link
Copy Markdown
Contributor

@JakeStevens JakeStevens commented Feb 20, 2026

Summary:
Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Differential Revision: D93904683

cc @robert-kalmar @digantdesai

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 20, 2026

🔗 Helpful Links

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

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

❌ 2 New Failures, 2 Unrelated Failures

As of commit 05b4b89 with merge base 19e8b68 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 20, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Feb 20, 2026

@JakeStevens has exported this pull request. If you are a Meta employee, you can view the originating Diff in D93904683.

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 24, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Differential Revision: D93904683
@robert-kalmar robert-kalmar added module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate labels Feb 24, 2026
Copy link
Copy Markdown
Contributor

@larryliu0820 larryliu0820 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 25, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 25, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 25, 2026
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 26, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 26, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Feb 26, 2026
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
@JakeStevens JakeStevens force-pushed the export-D93904683 branch 2 times, most recently from c65a4af to 6b01b13 Compare March 2, 2026 14:27
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 2, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
@roman-janik-nxp
Copy link
Copy Markdown
Collaborator

@StrycekSimon please review.

@robert-kalmar
Copy link
Copy Markdown
Collaborator

Sorry for the wait time, I am currently investigating a failed test case in our internal tests related to this PR. Will notify when I have more info.

@StrycekSimon , the internal CI passed on this PR. What failure you refer to?

Comment thread backends/nxp/tests/test_integration.py
model, input_shape, use_qat=True, use_neutron_for_format_conversion=False
).exported_program()

assert any("lowered_module" in node.name for node in edge_program.graph.nodes)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please change to checking targets. We check for delegate calls and have a util for it.

Suggested change
assert any("lowered_module" in node.name for node in edge_program.graph.nodes)
assert graph_contains_any_of_ops(edge_program.graph, [torch.ops.higher_order.executorch_call_delegate])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

complete

@JakeStevens
Copy link
Copy Markdown
Contributor Author

In the test test_biasless_convbn_fusion_qat, the added QuantizeFusedConvBnBiasAtenPass correctly quantize conv bias. This looks like fixing an error in the graph, shouldn't be the bias quantized when added to the graph? Do I understand it right @JakeStevens ? image

Yes this is the intention, exactly. We need to "manually" quantize the bias after we fuse conv bn in QAT

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
@@ -23,6 +23,8 @@
to_quantized_edge_program,
)
from executorch.backends.nxp.tests.executors import OverrideTargetSupportCheck
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from executorch.backends.nxp.tests.executors import OverrideTargetSupportCheck
from executorch.backends.nxp.tests.executors import (
graph_contains_any_of_ops,
OverrideTargetSupportCheck,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

.. to fix the nxp-unittest and linting error

JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Mar 4, 2026
Summary:

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
Summary:
Pull Request resolved: pytorch#17599

Earlier PR adds support for a pass that quantizes the bias resulting from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Reviewed By: larryliu0820

Differential Revision: D93904683
@JakeStevens
Copy link
Copy Markdown
Contributor Author

OK I think finally ready for NXP

@StrycekSimon
Copy link
Copy Markdown
Collaborator

Sorry for the wait time, I am currently investigating a failed test case in our internal tests related to this PR. Will notify when I have more info.

@StrycekSimon , the internal CI passed on this PR. What failure you refer to?

This is currently a disabled test on our CI as this feature was not implemented yet. Let's not block this PR any further. I will raise a bugfix PR later if needed...

Copy link
Copy Markdown
Collaborator

@StrycekSimon StrycekSimon left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@JakeStevens JakeStevens merged commit e3d2afc into pytorch:main Mar 5, 2026
155 of 160 checks passed
@JakeStevens JakeStevens deleted the export-D93904683 branch March 5, 2026 11:49
jpiat pushed a commit to jpiat/executorch that referenced this pull request Mar 17, 2026
Summary:
Earlier PR adds support for a pass that quantizes the bias resulting
from QAT ConvBN fusion without an initial bias.

This PR adds it to the NXP calibrate_and_quantize method.

Differential Revision: D93904683




cc @robert-kalmar @digantdesai
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. fb-exported meta-exported 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.

5 participants