Commit c495957
authored
Cleanup: Remove duplicate quantization checks (#2566)
The recent upstream
[change](llvm/llvm-project#100667) have
introduced quantization checks that are
already present in the StableHLO core library. This commit removes these
duplicate
checks to avoid redundancy and potential inconsistencies.
|Checks proposed to be removed| StableHLO Code | Upstream MLIR |
|-|-|-|
| `channel-axis >= 0`|
[cs](https://github.com/openxla/stablehlo/blob/1c0547f391dff5ac71d36dc20a916260afa78c61/stablehlo/dialect/Base.cpp#L795)
|
[cs](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp#L399)
|
| scale within smallest and largest finite numbers determined by
`expressed_type`|
[cs](https://github.com/openxla/stablehlo/blob/1c0547f391dff5ac71d36dc20a916260afa78c61/stablehlo/dialect/Base.cpp#L765)
|
[cs1](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp#L327)
[cs2](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp#L393C9-L393C45)
|
Note that StableHLO has checks like `quantization_dimension <
rank(self)` and
`dim(self, quantization_dimension) = size(scales)` implemented at
[cs](https://github.com/openxla/stablehlo/blob/1c0547f391dff5ac71d36dc20a916260afa78c61/stablehlo/dialect/Base.cpp#L795).
In upstream MLIR similar checks
[cs](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp#L51)
are encoded as part of
[dcast](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp#L110)
and
[qcast](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp#L139)
ops and hence cannot be claimed as duplicate.
related upstream clean-up
llvm/llvm-project#1106041 parent 8dd667a commit c495957
1 file changed
+2
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | 754 | | |
772 | 755 | | |
773 | 756 | | |
| |||
788 | 771 | | |
789 | 772 | | |
790 | 773 | | |
791 | | - | |
| 774 | + | |
792 | 775 | | |
793 | 776 | | |
794 | 777 | | |
795 | | - | |
| 778 | + | |
796 | 779 | | |
797 | 780 | | |
798 | 781 | | |
| |||
0 commit comments