From 09247954404f2b741e2ba5f2065d268ba8bb7b16 Mon Sep 17 00:00:00 2001 From: Luca Sarti Date: Wed, 13 Nov 2024 17:51:42 +0000 Subject: [PATCH] Adding new quantileType types to mlir test --- mlir/lib/Dialect/Quant/IR/TypeParser.cpp | 6 +++--- mlir/test/Dialect/Quant/Bytecode/types.mlir | 22 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp index 9ce1accc4ea5..1fd148dd4736 100644 --- a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp +++ b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp @@ -523,10 +523,10 @@ static void printStorageType(QuantizedType type, DialectAsmPrinter &out) { static void printQuantileType(Type quantileType, DialectAsmPrinter &out) { if (auto intType = llvm::dyn_cast(quantileType)) { const unsigned storageTypeWidth = intType.getWidth(); - if (intType.isSigned()) { - out << ":i" << storageTypeWidth; - } else { + if (intType.isUnsigned()) { out << ":u" << storageTypeWidth; + } else { + out << ":i" << storageTypeWidth; } } else if (quantileType.isa()) { out << ":f8E5M2"; diff --git a/mlir/test/Dialect/Quant/Bytecode/types.mlir b/mlir/test/Dialect/Quant/Bytecode/types.mlir index c797572056f7..be080d730976 100644 --- a/mlir/test/Dialect/Quant/Bytecode/types.mlir +++ b/mlir/test/Dialect/Quant/Bytecode/types.mlir @@ -68,12 +68,30 @@ module @parseUniformPerAxisMixed attributes { // QuantileQuantized //===----------------------------------------------------------------------===// -// CHECK-LABEL: parseQuantilePerLayer -module @parseQuantilePerLayer attributes { +// CHECK-LABEL: parseQuantilePerLayerFp16 +module @parseQuantilePerLayerFp16 attributes { // CHECK: !quant.quantile bytecode.test = !quant.quantile } {} +// CHECK-LABEL: parseQuantilePerLayerBf16 +module @parseQuantilePerLayerBf16 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerLayerI8 +module @parseQuantilePerLayerI8 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + +// CHECK-LABEL: parseQuantilePerLayerU8 +module @parseQuantilePerLayerU8 attributes { + // CHECK: !quant.quantile + bytecode.test = !quant.quantile +} {} + //===----------------------------------------------------------------------===// // QuantileQuantizedPerAxis //===----------------------------------------------------------------------===//