[Mlir-commits] [mlir] Sub-channel quantized type implementation (PR #120172)

Kevin Gleason llvmlistbot at llvm.org
Mon Mar 17 07:51:10 PDT 2025


================
@@ -228,38 +365,44 @@ static Type parseUniformType(DialectAsmParser &parser) {
     return nullptr;
   }
 
-  // Optionally parse quantized dimension for per-axis quantization.
+  // Optionally parse quantized dimension for per-axis or sub-channel
+  // quantization.
   if (succeeded(parser.parseOptionalColon())) {
-    if (parser.parseInteger(quantizedDimension))
-      return nullptr;
-    isPerAxis = true;
+    if (succeeded(parser.parseOptionalLBrace())) {
+      isSubChannel = true;
+      if (parseBlockSizeInfoUntilRBrace(parser, quantizedDimensions,
----------------
GleasonK wrote:

It's defined in `mlir/lib/AsmParser/Parser.h`, is that not accessible? As for empty list of blocks (1) is this checked in invariants and we don't need it in parser? Or (2) we could impl it as a `if blocks.empty()` check after the parse function.

That all said, new impl looks ok to me.

https://github.com/llvm/llvm-project/pull/120172


More information about the Mlir-commits mailing list