mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
[mlir][linalg][bufferize][NFC] Move interface impl to Linalg Transforms
This is for consistency with other dialects. Differential Revision: https://reviews.llvm.org/D120190
This commit is contained in:
parent
1a2bb03eda
commit
41cb504b7c
@ -1,4 +1,4 @@
|
||||
//===- LinalgInterfaceImpl.h - Linalg Impl. of BufferizableOpInterface ----===//
|
||||
//===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_LINALGINTERFACEIMPL_H
|
||||
#define MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_LINALGINTERFACEIMPL_H
|
||||
#ifndef MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H
|
||||
#define MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H
|
||||
|
||||
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
|
||||
|
||||
@ -15,8 +15,6 @@ namespace mlir {
|
||||
class DialectRegistry;
|
||||
|
||||
namespace linalg {
|
||||
namespace comprehensive_bufferize {
|
||||
namespace linalg_ext {
|
||||
|
||||
/// A function that matches anchor OpOperands for InitTensorOp elimination.
|
||||
/// If an OpOperand is matched, the function should populate the SmallVector
|
||||
@ -53,9 +51,7 @@ LogicalResult insertSliceAnchoredInitTensorEliminationStep(
|
||||
|
||||
void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry);
|
||||
|
||||
} // namespace linalg_ext
|
||||
} // namespace comprehensive_bufferize
|
||||
} // namespace linalg
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_LINALGINTERFACEIMPL_H
|
||||
#endif // MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H
|
@ -1,9 +1,6 @@
|
||||
set(LLVM_OPTIONAL_SOURCES
|
||||
AffineInterfaceImpl.cpp
|
||||
LinalgInterfaceImpl.cpp
|
||||
ModuleBufferization.cpp
|
||||
StdInterfaceImpl.cpp
|
||||
VectorInterfaceImpl.cpp
|
||||
)
|
||||
|
||||
add_mlir_dialect_library(MLIRAffineBufferizableOpInterfaceImpl
|
||||
@ -14,17 +11,6 @@ add_mlir_dialect_library(MLIRAffineBufferizableOpInterfaceImpl
|
||||
MLIRBufferization
|
||||
)
|
||||
|
||||
add_mlir_dialect_library(MLIRLinalgBufferizableOpInterfaceImpl
|
||||
LinalgInterfaceImpl.cpp
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRBufferization
|
||||
MLIRBufferizationTransforms
|
||||
MLIRIR
|
||||
MLIRLinalg
|
||||
MLIRTensor
|
||||
)
|
||||
|
||||
add_mlir_dialect_library(MLIRModuleBufferization
|
||||
ModuleBufferization.cpp
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- LinalgInterfaceImpl.cpp - Linalg Impl. of BufferizableOpInterface --===//
|
||||
//===- BufferizableOpInterfaceImpl.cpp - Impl. of BufferizableOpInterface -===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
|
||||
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
|
||||
#include "mlir/Dialect/Linalg/IR/Linalg.h"
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
using namespace mlir;
|
||||
using namespace linalg;
|
||||
using namespace comprehensive_bufferize;
|
||||
using namespace mlir::bufferization;
|
||||
|
||||
namespace {
|
||||
@ -529,8 +528,7 @@ findValidInsertionPoint(Operation *initTensorOp,
|
||||
/// OpOperand. "Anchored" means that there is a path on the reverse SSA use-def
|
||||
/// chain, starting from the OpOperand and always following the aliasing
|
||||
/// OpOperand, that eventually ends at a single InitTensorOp.
|
||||
LogicalResult
|
||||
mlir::linalg::comprehensive_bufferize::linalg_ext::eliminateInitTensors(
|
||||
LogicalResult mlir::linalg::eliminateInitTensors(
|
||||
Operation *op, BufferizationState &state, BufferizationAliasInfo &aliasInfo,
|
||||
AnchorMatchFn anchorMatchFunc, RewriteFn rewriteFunc,
|
||||
SmallVector<Operation *> &newOps) {
|
||||
@ -632,10 +630,9 @@ mlir::linalg::comprehensive_bufferize::linalg_ext::eliminateInitTensors(
|
||||
///
|
||||
/// Note that the newly inserted ExtractSliceOp may have to bufferize
|
||||
/// out-of-place due to RaW conflicts.
|
||||
LogicalResult mlir::linalg::comprehensive_bufferize::linalg_ext::
|
||||
insertSliceAnchoredInitTensorEliminationStep(
|
||||
Operation *op, BufferizationState &state,
|
||||
BufferizationAliasInfo &aliasInfo, SmallVector<Operation *> &newOps) {
|
||||
LogicalResult mlir::linalg::insertSliceAnchoredInitTensorEliminationStep(
|
||||
Operation *op, BufferizationState &state, BufferizationAliasInfo &aliasInfo,
|
||||
SmallVector<Operation *> &newOps) {
|
||||
return eliminateInitTensors(
|
||||
op, state, aliasInfo,
|
||||
/*anchorMatchFunc=*/
|
||||
@ -688,8 +685,8 @@ LogicalResult mlir::linalg::comprehensive_bufferize::linalg_ext::
|
||||
newOps);
|
||||
}
|
||||
|
||||
void mlir::linalg::comprehensive_bufferize::linalg_ext::
|
||||
registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry) {
|
||||
void mlir::linalg::registerBufferizableOpInterfaceExternalModels(
|
||||
DialectRegistry ®istry) {
|
||||
registry.addOpInterface<linalg::InitTensorOp, InitTensorOpInterface>();
|
||||
registry.addOpInterface<linalg::TiledLoopOp, TiledLoopOpInterface>();
|
||||
registry.addOpInterface<linalg::YieldOp, YieldOpInterface>();
|
@ -1,4 +1,5 @@
|
||||
add_mlir_dialect_library(MLIRLinalgTransforms
|
||||
BufferizableOpInterfaceImpl.cpp
|
||||
Bufferize.cpp
|
||||
CodegenStrategy.cpp
|
||||
ComprehensiveBufferizePass.cpp
|
||||
@ -43,7 +44,6 @@ add_mlir_dialect_library(MLIRLinalgTransforms
|
||||
MLIRMemRef
|
||||
MLIRLinalg
|
||||
MLIRLinalgAnalysis
|
||||
MLIRLinalgBufferizableOpInterfaceImpl
|
||||
MLIRLinalgUtils
|
||||
MLIRModuleBufferization
|
||||
MLIRSCF
|
||||
|
@ -13,9 +13,9 @@
|
||||
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
|
||||
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.h"
|
||||
#include "mlir/Dialect/Linalg/Passes.h"
|
||||
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/SCF/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
@ -52,7 +52,7 @@ struct LinalgComprehensiveModuleBufferize
|
||||
arith::ArithmeticDialect, StandardOpsDialect, AffineDialect>();
|
||||
affine_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
arith::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
linalg_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
linalg::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
scf::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
std_ext::registerModuleBufferizationExternalModels(registry);
|
||||
tensor::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
@ -98,8 +98,7 @@ void LinalgComprehensiveModuleBufferize::runOnOperation() {
|
||||
opt.printConflicts = printConflicts;
|
||||
opt.testAnalysisOnly = testAnalysisOnly;
|
||||
if (initTensorElimination) {
|
||||
opt.addPostAnalysisStep(
|
||||
linalg_ext::insertSliceAnchoredInitTensorEliminationStep);
|
||||
opt.addPostAnalysisStep(insertSliceAnchoredInitTensorEliminationStep);
|
||||
}
|
||||
} else {
|
||||
opt = *options;
|
||||
|
@ -20,7 +20,6 @@ add_mlir_library(MLIRLinalgTestPasses
|
||||
MLIRBufferizationTransforms
|
||||
MLIRGPUTransforms
|
||||
MLIRLinalg
|
||||
MLIRLinalgBufferizableOpInterfaceImpl
|
||||
MLIRLinalgTransforms
|
||||
MLIRLLVMToLLVMIRTranslation
|
||||
MLIRMemRef
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
|
||||
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Linalg/IR/Linalg.h"
|
||||
#include "mlir/Dialect/Linalg/Passes.h"
|
||||
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/SCF/BufferizableOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h"
|
||||
@ -59,7 +59,7 @@ struct TestComprehensiveFunctionBufferize
|
||||
arith::ArithmeticDialect, AffineDialect>();
|
||||
affine_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
arith::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
linalg_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
linalg::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
scf::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
tensor::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
vector::registerBufferizableOpInterfaceExternalModels(registry);
|
||||
|
@ -6841,25 +6841,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "LinalgBufferizableOpInterfaceImpl",
|
||||
srcs = [
|
||||
"lib/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"include/mlir/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.h",
|
||||
],
|
||||
includes = ["include"],
|
||||
deps = [
|
||||
":BufferizationDialect",
|
||||
":BufferizationTransforms",
|
||||
":IR",
|
||||
":LinalgOps",
|
||||
":LinalgStructuredOpsIncGen",
|
||||
":TensorDialect",
|
||||
],
|
||||
)
|
||||
|
||||
td_library(
|
||||
name = "LinalgDocTdFiles",
|
||||
srcs = ["include/mlir/Dialect/Linalg/IR/LinalgDoc.td"],
|
||||
@ -7050,6 +7031,7 @@ cc_library(
|
||||
hdrs = [
|
||||
"include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h",
|
||||
"include/mlir/Dialect/Linalg/Passes.h",
|
||||
"include/mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h",
|
||||
"include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h",
|
||||
"include/mlir/Dialect/Linalg/Transforms/HoistPadding.h",
|
||||
"include/mlir/Dialect/Linalg/Transforms/Hoisting.h",
|
||||
@ -7073,7 +7055,6 @@ cc_library(
|
||||
":DialectUtils",
|
||||
":IR",
|
||||
":InferTypeOpInterface",
|
||||
":LinalgBufferizableOpInterfaceImpl",
|
||||
":LinalgOps",
|
||||
":LinalgPassIncGen",
|
||||
":LinalgStructuredOpsIncGen",
|
||||
|
@ -396,7 +396,6 @@ cc_library(
|
||||
"//mlir:BufferizationTransforms",
|
||||
"//mlir:GPUDialect",
|
||||
"//mlir:IR",
|
||||
"//mlir:LinalgBufferizableOpInterfaceImpl",
|
||||
"//mlir:LinalgOps",
|
||||
"//mlir:LinalgTransforms",
|
||||
"//mlir:MemRefDialect",
|
||||
|
Loading…
Reference in New Issue
Block a user