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. ✅ No FailuresAs of commit e2356ac with merge base 7586c16 ( 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. |
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 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: 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
46661bf to
74f93e3
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 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: 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: 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
74f93e3 to
cb2b068
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 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: 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: 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
cb2b068 to
929abc5
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 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
929abc5 to
30f6dee
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 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
30f6dee to
53fe523
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 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 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`. Differential Revision: D128002647
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 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`. Differential Revision: D128002647
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 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`. This also fixes a test that was already failing. `surrounded_quantized_op_constant` in `misc/test_quantization.py` was marked as an expected failure. Its `torch.ones(2, 2)` constant is lowered to a `full` op, so the int8 add read float data, and every output element was off by about 0.49. With this change the case matches the quantized reference exactly, so its `xfail` is removed. The other constants in that file are stored tensors, which folding already quantized correctly. Differential Revision: D128002647
53fe523 to
e2356ac
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 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 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`. This also fixes a test that was already failing. `surrounded_quantized_op_constant` in `misc/test_quantization.py` was marked as an expected failure. Its `torch.ones(2, 2)` constant is lowered to a `full` op, so the int8 add read float data, and every output element was off by about 0.49. With this change the case matches the quantized reference exactly, so its `xfail` is removed. The other constants in that file are stored tensors, which folding already quantized correctly. Differential Revision: D128002647
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 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`. This also fixes a test that was already failing. `surrounded_quantized_op_constant` in `misc/test_quantization.py` was marked as an expected failure. Its `torch.ones(2, 2)` constant is lowered to a `full` op, so the int8 add read float data, and every output element was off by about 0.49. With this change the case matches the quantized reference exactly, so its `xfail` is removed. The other constants in that file are stored tensors, which folding already quantized correctly. Differential Revision: D128002647
AdrianLundell
left a comment
There was a problem hiding this comment.
Small nit, the full -> fill change does not seem strictly related to the compute constant ops AOT pass to me, maybe that should be it's own pass and we keep the arm passes as they are for clarity? LGTM otherwise
I'll do it as a followup |
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 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.This also fixes a test that was already failing.
surrounded_quantized_op_constantinmisc/test_quantization.pywas marked as an expected failure. Itstorch.ones(2, 2)constant is lowered to afullop, so the int8 add read float data, and every output element was off by about 0.49. With this change the case matches the quantized reference exactly, so itsxfailis removed. The other constants in that file are stored tensors, which folding already quantized correctly.Differential Revision: D128002647