[mlir] [MLIR][Linalg] Introduce broadcast/transpose semantic to 'linalg.batc… (PR #122275)

Andrzej Warzyński llvmlistbot at llvm.org
Mon Jan 20 12:09:31 PST 2025


================
@@ -3450,6 +3467,95 @@ static LogicalResult verifyExtendedMatmulSemantic(MatmulOp matmulOp,
   return success();
 }
 
+/// Checks if the given AffineMap represents a valid batch dimension.
+/// It checks if the first result dimension is a function of the first
+/// dimension.
+static bool isValidBatchDim(AffineMap bcastMap) {
+  AffineExpr exp = bcastMap.getResult(0);
+  return exp.isFunctionOfDim(0);
+}
+
+/// Checks if the given AffineMap's result dimensions are valid output result
+/// dimensions.
----------------
banach-space wrote:

1. What does it mean to be "valid"?
2. Why is the `k` dim omitted?

IMO, it would be better to check these inline in `verifyOutputMap` where the context is still clear. This is not generic enough to deserve a hook.

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


More information about the Mlir-commits mailing list