Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23261
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Cancelled JobAs of commit 7eb92a3 with merge base d46a886 ( CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
@RahulC7 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D120871768. |
This PR needs a
|
37456c1 to
4616348
Compare
…23261) Summary: ## Context The way we lowered the GDN model is we looked at the traced model, and then recreated "stages" of it(i.e created a graph for that stage), and lowered each one of those stages, making them go through the entire compiler pipeline. That’s usually fine for the ops/nodes in the middle, because they still have the surrounding nodes(producer consumer chain) and those get collapsed/changed in the same way, but in the boundaries, where there’s connections to other other nodes not in the subgraph, the lowering might end up producing a different result than what we expect in the actual graph. The quant/dequant insertion, calibration and FuseMul adjacency depend on the global context so it’ll look different. That's what happens here. ## Problem In D117100989, we do `N_c = -A_c` as `aten.full(-1.0) + aten.mul.Tensor`(elementwise kernel). However, before the multiply, there's a quantize, and so multiply gets combined with the quantize. The issue is that this is a negative, and so we're going to have a negative scale in the quantize/dequantize scales, because of `FuseMulTensorIntoDequantPass` and `FuseMulScalarIntoDequantPass` folding it in. ## What this diff does - Make all three multiply fusion passes stop when the derived scale is not positive. - Leave the original multiply in the graph when fusion is not valid. - Add focused tests for tensor-to-quant, tensor-from-dequant, and scalar-from-dequant with multipliers `0.0` and `-1.0`. - Give the chunk-32 GDN test a test-only gate offset of `-5.0`. This keeps the 32-step cumulative `Gamma_c` values in the useful int16 calibration range. Chunk size 2 stays unchanged. - Use measured tolerances for the three equivalent chunk-32 pre-trace transforms. ## Result The full chunk-32 graph keeps one explicit `aten.mul.Tensor` with `aten.full(-1.0)` for `N_c = -A_c`. All quantize, dequantize, requantize, and packed prep scales in the dumped graph are finite and positive. Reviewed By: ThomasJannaud Differential Revision: D120871768
…23261) Summary: Pull Request resolved: pytorch#23261 ## Context The way we lowered the GDN model is we looked at the traced model, and then recreated "stages" of it(i.e created a graph for that stage), and lowered each one of those stages, making them go through the entire compiler pipeline. That’s usually fine for the ops/nodes in the middle, because they still have the surrounding nodes(producer consumer chain) and those get collapsed/changed in the same way, but in the boundaries, where there’s connections to other other nodes not in the subgraph, the lowering might end up producing a different result than what we expect in the actual graph. The quant/dequant insertion, calibration and FuseMul adjacency depend on the global context so it’ll look different. That's what happens here. ## Problem In D117100989, we do `N_c = -A_c` as `aten.full(-1.0) + aten.mul.Tensor`(elementwise kernel). However, before the multiply, there's a quantize, and so multiply gets combined with the quantize. The issue is that this is a negative, and so we're going to have a negative scale in the quantize/dequantize scales, because of `FuseMulTensorIntoDequantPass` and `FuseMulScalarIntoDequantPass` folding it in. ## What this diff does - Make all three multiply fusion passes stop when the derived scale is not positive. - Leave the original multiply in the graph when fusion is not valid. - Add focused tests for tensor-to-quant, tensor-from-dequant, and scalar-from-dequant with multipliers `0.0` and `-1.0`. - Give the chunk-32 GDN test a test-only gate offset of `-5.0`. This keeps the 32-step cumulative `Gamma_c` values in the useful int16 calibration range. Chunk size 2 stays unchanged. - Use measured tolerances for the three equivalent chunk-32 pre-trace transforms. ## Result The full chunk-32 graph keeps one explicit `aten.mul.Tensor` with `aten.full(-1.0)` for `N_c = -A_c`. All quantize, dequantize, requantize, and packed prep scales in the dumped graph are finite and positive. Reviewed By: ThomasJannaud Differential Revision: D120871768
4616348 to
7eb92a3
Compare
Summary:
What this diff does
0.0and-1.0.Result
The full chunk-32 graph keeps one explicit
aten.mul.Tensorwithaten.full(-1.0)forN_c = -A_c. All quantize, dequantize, requantize, and packed prep scales in the dumped graph are finite and positive.Reviewed By: ThomasJannaud
Differential Revision: D120871768