[mlir] [MLIR][Linalg] Introduce broadcast/transpose semantic to 'linalg.batc… (PR #122275)
Andrzej Warzyński
llvmlistbot at llvm.org
Mon Jan 20 12:09:29 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);
+}
----------------
banach-space wrote:
> /// Checks if the given AffineMap represents a valid batch dimension.
Represents -> contains?
Also:
* `isValidBatchDim` -> `hasValidBatchDim`?
Lastly, this is a `static` method (so anything in this file can use it). Why is the argument called `bcastMap`? From what I can tell, it can be an arbitrary map. I find the argument name misleading.
Tl;Dr I see what you're trying to achieve here, but IMHO it would be better to have this check inline (perhaps a lambda?) and avoid introducing a dedicated method.
https://github.com/llvm/llvm-project/pull/122275
More information about the Mlir-commits
mailing list