llvm
177e3828 - [mlir][tosa] Get quantized element type with sign info. (#169387)

Commit
179 days ago
[mlir][tosa] Get quantized element type with sign info. (#169387) As mentioned in https://github.com/llvm/llvm-project/blob/a27bb38ee6f5762e715803d8eb6ffc5a8dd09575/mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h#L109 `QuantType::getStorageType` doesn't capture the sign information. This lead to the following IR to fail during verification: ``` func.func @clamp(%arg0:tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) -> (tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) { %0 = tosa.clamp %arg0 {max_val = 255 : ui8, min_val = 0 : ui8} : (tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>>) -> tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>> return %0 : tensor<?x112x112x32x!quant.uniform<u8:f32, 0.023529412224888802:-128>> } ``` with `'tosa.clamp' op min/max attributes types are incompatible with input/output element types` error since `getStorageType` was returning signed integer but the clamp attributes were unsigned. This PR updates the usage of `getStorageType` in tosa codebase to correctly use the signed info for the quantized type.
Author
Parents
Loading