forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Some uint8 Quantization Fixes (llvm#3122)
1. Changes the linalg lowering for dequantization ops to always sign cast to float to prevent misrepresenting uint32 overflow on subtraction with zero point. 2. Adds a basic quantized model test which only quantizes and dequantizes and now passes with these changes in linalg and onnx configs. 3. Changes the aten.mm lowering to allow mismatched quantized types. 4. If a quantized matmul arg is uint8, we shift by 128 to faithfully represent the quantization as a signed i8 quantization. This worked fine in the AtenMmOp lowering, but I'd be happy to move it to a rewrite in FuseQuantizedOps.cpp instead if that seems more appropriate. With the changes 3 and 4, the QuantizedMLP_basic and QuantizedSingleLayer_basic e2e tests now passes with the onnx config.
- Loading branch information
Showing
4 changed files
with
91 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters