Commit 3c17a1d
Gate FuseQATConvBN behind is_qat=True; opt in from QAT deployments
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: D1050617521 parent 7cd209d commit 3c17a1d
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
202 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
203 | 208 | | |
204 | 209 | | |
205 | 210 | | |
| |||
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| 229 | + | |
224 | 230 | | |
225 | 231 | | |
226 | 232 | | |
| |||
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
| 251 | + | |
245 | 252 | | |
246 | 253 | | |
247 | 254 | | |
| |||
254 | 261 | | |
255 | 262 | | |
256 | 263 | | |
257 | | - | |
| 264 | + | |
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
| |||
0 commit comments