[Mlir-commits] [mlir] [mlir][mesh] Use tensor shape notation for the shape of a cluster (PR #73826)

Boian Petkantchin llvmlistbot at llvm.org
Mon Dec 4 09:43:37 PST 2023


================
@@ -1099,6 +1101,9 @@ namespace mlir {
 AffineMap makeStridedLinearLayoutMap(ArrayRef<int64_t> strides, int64_t offset,
                                      MLIRContext *context);
 
+void printShape(OpAsmPrinter &printer, Operation *op, ArrayRef<int64_t> shape);
+ParseResult parseShape(OpAsmParser &parser, DenseI64ArrayAttr &shape);
----------------
sogartar wrote:

I put these there since they are required by `custom<Shape>(...)` in `td`. It is a custom printer/parser for a shape attribute.
I can move these functions to the `AsmPrinter`/`AsmParser` header [OpImplementation.h](mlir/include/mlir/IR/OpImplementation.h).
There is a difference with how 0-rank shapes are handled compared to printing/parsing the shape in the context of a `tensor`/`memref` type. I can refactor the common part into functions in `AsmPrinter`/`AsmParser`.

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


More information about the Mlir-commits mailing list