Gate FuseQATConvBN behind is_qat=True; opt in from QAT deployments#19601
Gate FuseQATConvBN behind is_qat=True; opt in from QAT deployments#19601ethansfng wants to merge 1 commit into
Conversation
Summary: The FuseQATConvBN pass added in D104497938 ran unconditionally inside `apply_pre_edge_transform_passes`. Its `_prep_conv_biases` step delegates to the shared `_quantize_fused_conv_bias` helper, which iterates every conv in the graph and asserts each conv input is `dequantize_per_tensor` — an invariant that only holds inside the conv-BN simulation chain `prepare_qat_pt2e` inserts. PTQ graphs trip the assert (T271158088). Two failure modes seen in the wild: - `test_quantized_w8a32_conv1d_out_2` uses `CadenceW8A32MixedQuantizer` so activations stay float32; the conv input is the placeholder, not a dequant. - `test_conv2d_out_7` is `channel_last=True`, so the conv input is `aten.permute`, not a dequant; the helper only unwraps `unsqueeze` variants. Add an `is_qat: bool = False` parameter to `apply_pre_edge_transform_passes` and only include `FuseQATConvBN` when True. Plumb through `quantize_pt2`/`get_fake_quant_model` and forward from the modai recipe lambda so `ar_*_qat_et_recipe` factories actually opt in. QAT-trained models lowered via blobgen need a way to reach the QAT recipe. Add `is_qat: bool` to `Packaging` and have `Rt700Hifi4Deployment` pass `train=self.packaging.is_qat` to `get_recipe_with_custom_settings`. Models like `activity_classification_artemis` should set `"is_qat": True` in their `defs.bzl` packaging block. Differential Revision: D105061752
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19601
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 3 New Failures, 1 Unrelated FailureAs of commit 3c17a1d with merge base 7cd209d ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were 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. |
|
@ethansfng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105061752. |
This PR needs a
|
Summary:
The FuseQATConvBN pass added in D104497938 ran unconditionally inside
apply_pre_edge_transform_passes. Its_prep_conv_biasesstep delegates to the shared_quantize_fused_conv_biashelper, which iterates every conv in the graph and asserts each conv input isdequantize_per_tensor— an invariant that only holds inside the conv-BN simulation chainprepare_qat_pt2einserts. PTQ graphs trip the assert (T271158088).Two failure modes seen in the wild:
test_quantized_w8a32_conv1d_out_2usesCadenceW8A32MixedQuantizerso activations stay float32; the conv input is the placeholder, not a dequant.test_conv2d_out_7ischannel_last=True, so the conv input isaten.permute, not a dequant; the helper only unwrapsunsqueezevariants.Add an
is_qat: bool = Falseparameter toapply_pre_edge_transform_passesand only includeFuseQATConvBNwhen True. Plumb throughquantize_pt2/get_fake_quant_modeland forward from the modai recipe lambda soar_*_qat_et_recipefactories actually opt in.QAT-trained models lowered via blobgen need a way to reach the QAT recipe. Add
is_qat: booltoPackagingand haveRt700Hifi4Deploymentpasstrain=self.packaging.is_qattoget_recipe_with_custom_settings. Models likeactivity_classification_artemisshould set"is_qat": Truein theirdefs.bzlpackaging block.Differential Revision: D105061752