[Mlir-commits] [mlir] [mlir] Add ContractionOpInterface utility functions for vector matrix multiplication (PR #68945)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 16 13:07:41 PDT 2023


================
@@ -240,4 +240,134 @@ TEST(isRowMajorBatchMatmul, FirstInputSwapped) {
   EXPECT_THAT(maps, Not(Truly(isRowMajorBatchMatmul)));
 }
 
+TEST(isVecmat, Simple) {
+  MLIRContext context;
+
+  AffineExpr k, n;
+  bindDims(&context, k, n);
+  auto mapA = AffineMapAttr::get(AffineMap::get(2, 0, {k}, &context));
+  auto mapB = AffineMapAttr::get(AffineMap::get(2, 0, {k, n}, &context));
+  auto mapC = AffineMapAttr::get(AffineMap::get(2, 0, {n}, &context));
+  auto maps = ArrayAttr::get(&context, {mapA, mapB, mapC});
+
+  EXPECT_THAT(maps, Truly(isVecmat));
+}
+
+TEST(isVecmat, BindingSwapped) {
+  MLIRContext context;
+
+  AffineExpr k, n;
+  bindDims(&context, k, n); // bind in different order
----------------
NatashaKnk wrote:

Whoops! Fixed, thanks.

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


More information about the Mlir-commits mailing list