Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24258
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New FailuresAs of commit 46661bf with merge base b831dbe ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pssrawat has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128002647. |
This PR needs a
|
Summary: Q/DQ folding (`FoldAndAnnotateQParamsPass`) always folds the quantize/dequantize pair around a constant-producing op (`full`, `full_like`, `arange`, `eye`, `linspace`, `scalar_tensor`) into the op: it removes the Q node and records the output qparams, but the op itself keeps producing float. The Arm backend follows folding with `ComputeConstantOpsAOTPass`, which evaluates such ops in float and quantizes the result. Cortex-M did not, so in `x + torch.full(shape, 0.5)` the int8 `quantized_add` kernel read a float32 constant, and the output was silently wrong. Add `ComputeQuantizedConstantOpsPass` and run it right after folding on both Cortex-M pass lists. - a. It only touches nodes with output qparams, so unquantized constant ops are unchanged. A quantized `full` stays a runtime fill, with its fill value quantized and its dtype set to the qparams' dtype, so a large fill does not turn into a large constant; - b.`full_like` is first converted to `full` with the Arm backend's `ConvertFullLikeToFullPass`. - c. Since `ComputeConstantOpsAOTPass` only logs a failed precompute, the new pass raises if a quantized constant op is still in the graph afterwards, as it would feed float data to an int8 kernel. Differential Revision: D128002647
Summary: Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`. Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8. The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too. Authored with an AI coding assistant (Claude). Differential Revision: D128001102
Summary: Q/DQ folding (`FoldAndAnnotateQParamsPass`) always folds the quantize/dequantize pair around a constant-producing op (`full`, `full_like`, `arange`, `eye`, `linspace`, `scalar_tensor`) into the op: it removes the Q node and records the output qparams, but the op itself keeps producing float. The Arm backend follows folding with `ComputeConstantOpsAOTPass`, which evaluates such ops in float and quantizes the result. Cortex-M did not, so in `x + torch.full(shape, 0.5)` the int8 `quantized_add` kernel read a float32 constant, and the output was silently wrong. Add `ComputeQuantizedConstantOpsPass` and run it right after folding on both Cortex-M pass lists. - a. It only touches nodes with output qparams, so unquantized constant ops are unchanged. A quantized `full` stays a runtime fill, with its fill value quantized and its dtype set to the qparams' dtype, so a large fill does not turn into a large constant; - b.`full_like` is first converted to `full` with the Arm backend's `ConvertFullLikeToFullPass`. - c. Since `ComputeConstantOpsAOTPass` only logs a failed precompute, the new pass raises if a quantized constant op is still in the graph afterwards, as it would feed float data to an int8 kernel. Differential Revision: D128002647
8a2eadf to
46661bf
Compare
Summary:
Q/DQ folding (
FoldAndAnnotateQParamsPass) always folds the quantize/dequantize pair around a constant-producing op (full,full_like,arange,eye,linspace,scalar_tensor) into the op: it removes the Q node and records the output qparams, but the op itself keeps producing float. The Arm backend follows folding withComputeConstantOpsAOTPass, which evaluates such ops in float and quantizes the result. Cortex-M did not, so inx + torch.full(shape, 0.5)the int8quantized_addkernel read a float32 constant, and the output was silently wrong.Add
ComputeQuantizedConstantOpsPassand run it right after folding on both Cortex-M pass lists.fullstays a runtime fill, with its fill value quantized and its dtype set to the qparams' dtype, so a large fill does not turn into a large constant;full_likeis first converted tofullwith the Arm backend'sConvertFullLikeToFullPass.ComputeConstantOpsAOTPassonly logs a failed precompute, the new pass raises if a quantized constant op is still in the graph afterwards, as it would feed float data to an int8 kernel.Differential Revision: D128002647