Skip to content

Arm backend: xfail test for FoldScalarMulIntoConv quantized-accuracy hazard (#21152)#21152

Open
3l1 wants to merge 1 commit into
mainfrom
export-D113310822
Open

Arm backend: xfail test for FoldScalarMulIntoConv quantized-accuracy hazard (#21152)#21152
3l1 wants to merge 1 commit into
mainfrom
export-D113310822

Conversation

@3l1

@3l1 3l1 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

@3l1
3l1 requested a review from digantdesai as a code owner July 22, 2026 22:16
@pytorch-bot

pytorch-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 3 New Failures, 13 Unrelated Failures, 3 Unclassified Failures

As of commit e6ccc61 with merge base 430b73d (image):

NEW FAILURES - The following jobs have failed:

  • Build Presets / windows (pybind) / build (gh)
    Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under 'C:\actions-runner\_work\executorch\executorch\test-infra\.github\actions\teardown-windows'. Did you forget to run actions/checkout before running your local action?
  • Build Presets / windows (windows) / build (gh)
    Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under 'C:\actions-runner\_work\executorch\executorch\test-infra\.github\actions\teardown-windows'. Did you forget to run actions/checkout before running your local action?
  • pull / unittest-nxp-neutron / linux-job (gh)
    RuntimeError: Command docker exec -t d2065a8fdc61893a9f75c63e8bd11ef2f7892fdd174388e9025a5d1abf50a158 /exec failed with exit code 2

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:

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.

@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 Jul 22, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jul 22, 2026
@meta-codesync

meta-codesync Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync meta-codesync Bot changed the title Arm backend: xfail test for FoldScalarMulIntoConv quantized-accuracy hazard Arm backend: xfail test for FoldScalarMulIntoConv quantized-accuracy hazard (#21152) Jul 22, 2026
meta-codesync Bot pushed a commit that referenced this pull request Jul 22, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv #20838 rewrites conv(x) * scale to a convolution with scaled
weights. This is exact in floating point (already covered by the existing tests
in this file), but it is not safe under quantization: activation qparams are
calibrated and frozen on the pre-fold conv output, which has a uniform range.
Folding a per-channel scale into the weights moves the scaling inside the
convolution, so the real conv output spans the scaled dynamic range while it is
still requantized with the stale pre-fold scale. With a wide-dynamic-range scale
this clips / loses precision and the quantized result diverges from the reference
where the mul is kept as a separate, well-scaled op. The same requant shift
degrades models that carry a quantized value across steps, where it compounds.

Add ConvMulWideDynamicRangeScale and an xfail test on the bit-accurate TOSA INT
reference documenting the hazard. It will start passing (flagging that the xfail
should be removed) once the fold is made quantization-aware or is skipped for the
affected models.

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from 994b837 to b056b7d Compare July 22, 2026 22:46
@3l1
3l1 requested review from gggekov, rascani and zingo July 22, 2026 22:49
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv #20838 rewrites conv(x) * scale to a convolution with scaled
weights. This is exact in floating point (already covered by the existing tests
in this file), but it is not safe under quantization: activation qparams are
calibrated and frozen on the pre-fold conv output, which has a uniform range.
Folding a per-channel scale into the weights moves the scaling inside the
convolution, so the real conv output spans the scaled dynamic range while it is
still requantized with the stale pre-fold scale. With a wide-dynamic-range scale
this clips / loses precision and the quantized result diverges from the reference
where the mul is kept as a separate, well-scaled op. The same requant shift
degrades models that carry a quantized value across steps, where it compounds.

Add ConvMulWideDynamicRangeScale and an xfail test on the bit-accurate TOSA INT
reference documenting the hazard. It will start passing (flagging that the xfail
should be removed) once the fold is made quantization-aware or is skipped for the
affected models.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from b056b7d to 542e37c Compare July 23, 2026 02:25
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv #20838 rewrites conv(x) * scale to a convolution with scaled
weights. This is exact in floating point (already covered by the existing tests
in this file), but it is not safe under quantization: activation qparams are
calibrated and frozen on the pre-fold conv output, which has a uniform range.
Folding a per-channel scale into the weights moves the scaling inside the
convolution, so the real conv output spans the scaled dynamic range while it is
still requantized with the stale pre-fold scale. With a wide-dynamic-range scale
this clips / loses precision and the quantized result diverges from the reference
where the mul is kept as a separate, well-scaled op. The same requant shift
degrades models that carry a quantized value across steps, where it compounds.

Add ConvMulWideDynamicRangeScale and an xfail test on the bit-accurate TOSA INT
reference documenting the hazard. It will start passing (flagging that the xfail
should be removed) once the fold is made quantization-aware or is skipped for the
affected models.

Reviewed By: rascani

Differential Revision: D113310822
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv #20838 rewrites conv(x) * scale to a convolution with scaled
weights. This is exact in floating point (already covered by the existing tests
in this file), but it is not safe under quantization: activation qparams are
calibrated and frozen on the pre-fold conv output, which has a uniform range.
Folding a per-channel scale into the weights moves the scaling inside the
convolution, so the real conv output spans the scaled dynamic range while it is
still requantized with the stale pre-fold scale. With a wide-dynamic-range scale
this clips / loses precision and the quantized result diverges from the reference
where the mul is kept as a separate, well-scaled op. The same requant shift
degrades models that carry a quantized value across steps, where it compounds.

Add ConvMulWideDynamicRangeScale and an xfail test on the bit-accurate TOSA INT
reference documenting the hazard. It will start passing (flagging that the xfail
should be removed) once the fold is made quantization-aware or is skipped for the
affected models.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from 542e37c to bb0b0b3 Compare July 23, 2026 02:26
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from dfcb3cb to d938697 Compare July 23, 2026 03:30
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv #20838 rewrites conv(x) * scale to a convolution with scaled
weights. This is exact in floating point (already covered by the existing tests
in this file), but it is not safe under quantization: activation qparams are
calibrated and frozen on the pre-fold conv output, which has a uniform range.
Folding a per-channel scale into the weights moves the scaling inside the
convolution, so the real conv output spans the scaled dynamic range while it is
still requantized with the stale pre-fold scale. With a wide-dynamic-range scale
this clips / loses precision and the quantized result diverges from the reference
where the mul is kept as a separate, well-scaled op. The same requant shift
degrades models that carry a quantized value across steps, where it compounds.

Add ConvMulWideDynamicRangeScale and an xfail test on the bit-accurate TOSA INT
reference documenting the hazard. It will start passing (flagging that the xfail
should be removed) once the fold is made quantization-aware or is skipped for the
affected models.

Reviewed By: rascani

Differential Revision: D113310822
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from d938697 to 8a015aa Compare July 23, 2026 03:36
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from 8a015aa to 8fe1b23 Compare July 23, 2026 03:42
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from 8fe1b23 to 3015e4b Compare July 23, 2026 03:51
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
@meta-codesync
meta-codesync Bot force-pushed the export-D113310822 branch from 3015e4b to e6ccc61 Compare July 23, 2026 04:03
meta-codesync Bot pushed a commit that referenced this pull request Jul 23, 2026
…hazard (#21152)

Summary:

FoldScalarMulIntoConv (#20838) rewrites
conv(x) * scale into a convolution with scaled weights. This is exact in floating
point (already covered by the existing tests in this file), but it is not safe
under quantization when the scaled conv output feeds a carried/stateful
quantization boundary -- a value written back into a mutable buffer / input that
persists across invocations (recurrent state). Activation qparams are calibrated
and frozen on the pre-fold conv output; folding the scale into the weights moves
the scaling inside the convolution, so the conv output is requantized with the
stale pre-fold scale. That shifted requantization drifts the persisted quantized
state and the error compounds over the sequence.

Add StatefulConvMul (conv output * scale written into a mutable buffer) and an
xfail unit test (test_does_not_fold_when_output_feeds_stateful_buffer) documenting
the hazard: the fold currently fires and drops the mul across the buffer boundary.
The test is marked xfail (strict); the state-aware guard in D113310883 makes it
pass, and the xfail is removed there.

Reviewed By: rascani

Differential Revision: D113310822
@zingo

zingo commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks Ill add some people that are in the office 🙂
@Sebastian-Larsson @SaoirseARM @perheld
(Im on a small roadtrip 🌞 but take a check when back if still needed)

@zingo zingo added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label Jul 23, 2026
@perheld
perheld self-requested a review July 24, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants