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

Kevin Gleason llvmlistbot at llvm.org
Tue Feb 11 14:55:22 PST 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:

Can we use one of the following methods with an explicitly specified Rbrace delimeter?:

```
  /// Parse a comma-separated list of elements up until the specified end token.
  ParseResult
  parseCommaSeparatedListUntil(Token::Kind rightToken,
                               function_ref<ParseResult()> parseElement,
                               bool allowEmptyList = true);

  /// Parse a list of comma-separated items with an optional delimiter.  If a
  /// delimiter is provided, then an empty list is allowed.  If not, then at
  /// least one element will be parsed.
  ParseResult
  parseCommaSeparatedList(Delimiter delimiter,
                          function_ref<ParseResult()> parseElementFn,
                          StringRef contextMessage = StringRef());
```

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


More information about the Mlir-commits mailing list