[Mlir-commits] [mlir] [NFC] Make AggregateOpInterface part of mlir:: instead of linalg:: (PR #70089)
Mehdi Amini
llvmlistbot at llvm.org
Thu Oct 26 15:50:50 PDT 2023
================
@@ -0,0 +1,57 @@
+//===- AggregatedOpInterface.td ----------------------*- tablegen -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_AGGREGATEDOPINTERFACE
+#define MLIR_AGGREGATEDOPINTERFACE
+
+include "mlir/IR/OpBase.td"
+
+def AggregatedOpInterface : OpInterface<"AggregatedOpInterface"> {
+ let description = [{
+ This Interface is particularly useful in cases where we have an operation
+ that can be lowered into a sequence of simpler operations, thus essentially
+ decomposing an operation into a set of one or many simpler operations.
+ The operation being decomposed need to implement this Interface by implementing
+ the method `decomposeOperation` and return the set of values which would replace
+ the uses of the operation being decomposed.
+ Eg:
+ Assume there is an operation `CustomOp_Mul_Add` that takes in an input tensor
+ and a constant. It basically performs element-wise multiplication of the input
+ tensor with the given constant, and then performs element-wise addition of the
+ intermediate resulting tensor with the given constant.
+ `CustomOp_Mul_Add` can thus essentially be decomposed by implementing this
+ Interface.
+ `linalg::SoftmaxOp` is one such operation which makes use of this Interface
+ for implementing its decomposition.
+ }];
----------------
joker-eph wrote:
I have a hard time seeing how this is something that composes across dialects or can just be reused generically. That seems quite "specific" to a specific pass at one given level of abstraction (and this is what makes it pretty contextual and not generic as I see it right now).
https://github.com/llvm/llvm-project/pull/70089
More information about the Mlir-commits
mailing list