[Mlir-commits] [mlir] [mlir][linalg] unfold projected permutation. (PR #114704)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Nov 5 08:49:01 PST 2024
================
@@ -0,0 +1,270 @@
+//===- UnfoldProjectedPermutation.cpp - extract projected projections ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements pattern to decompose the operand of a GenericOp that
+// has `transpose+broadcast` juxtaposed via its affine map into separate
+// transpose and broadcast ops.
+//
+//===----------------------------------------------------------------------===//
+//
+#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
+#include <utility>
+
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include <map>
+#include <optional>
+#include <vector>
+
+using namespace mlir;
+using namespace mlir::linalg;
+
+namespace {
+
+/// Projected permutation are effectively folding in of a mixture of
----------------
banach-space wrote:
This comment is very insightful, but doesn't really say what the pattern does. Also, I don't believe `UnfoldProjectedPermutation` is accurate. The pattern (based on this comment and the tests), specialised `linalg.generic {op}` into `linalg.transpose + linalg.transpose + op`?
Unfolding the permutation map is just an implementation detail. A very important one, but not the ultimate goal.
https://github.com/llvm/llvm-project/pull/114704
More information about the Mlir-commits
mailing list