[mlir][linalg][bufferize][NFC] Move Affine interface impl to new build target

This makes ComprehensiveBufferize entirely independent of the Affine dialect.

Differential Revision: https://reviews.llvm.org/D114222
This commit is contained in:
Matthias Springer 2021-11-26 09:21:04 +09:00
parent 850e8b4504
commit f32c3d9528
7 changed files with 75 additions and 5 deletions

View File

@ -0,0 +1,27 @@
//===- LinalgInterfaceImpl.h - Linalg 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.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_AFFINE_INTERFACE_IMPL_H
#define MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_AFFINE_INTERFACE_IMPL_H
namespace mlir {
class DialectRegistry;
namespace linalg {
namespace comprehensive_bufferize {
namespace affine_ext {
void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry);
} // namespace affine_ext
} // namespace comprehensive_bufferize
} // namespace linalg
} // namespace mlir
#endif // MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_AFFINE_INTERFACE_IMPL_H

View File

@ -0,0 +1,18 @@
//===- AffineInterfaceImpl.cpp - Affine 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.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
void mlir::linalg::comprehensive_bufferize::affine_ext::
registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry) {
registry.addOpInterface<AffineParallelOp,
AllocationHoistingBarrierOnly<AffineParallelOp>>();
}

View File

@ -1,4 +1,5 @@
set(LLVM_OPTIONAL_SOURCES
AffineInterfaceImpl.cpp
ArithInterfaceImpl.cpp
BufferizableOpInterface.cpp
ComprehensiveBufferize.cpp
@ -20,6 +21,14 @@ add_mlir_dialect_library(MLIRBufferizableOpInterface
MLIRMemRef
)
add_mlir_dialect_library(MLIRAffineBufferizableOpInterfaceImpl
AffineInterfaceImpl.cpp
LINK_LIBS PUBLIC
MLIRAffine
MLIRBufferizableOpInterface
)
add_mlir_dialect_library(MLIRArithBufferizableOpInterfaceImpl
ArithInterfaceImpl.cpp
@ -73,7 +82,6 @@ add_mlir_dialect_library(MLIRComprehensiveBufferize
ComprehensiveBufferize.cpp
LINK_LIBS PUBLIC
MLIRAffine
MLIRBufferizableOpInterface
MLIRInferTypeOpInterface
MLIRIR

View File

@ -109,10 +109,10 @@
#include <random>
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BlockAndValueMapping.h"
@ -1513,8 +1513,6 @@ void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry) {
// Ops that are not bufferizable but are allocation hoisting barriers.
registry.addOpInterface<FuncOp, AllocationHoistingBarrierOnly<FuncOp>>();
registry.addOpInterface<AffineParallelOp,
AllocationHoistingBarrierOnly<AffineParallelOp>>();
}
} // namespace comprehensive_bufferize

View File

@ -29,6 +29,7 @@ add_mlir_dialect_library(MLIRLinalgTransforms
LINK_LIBS PUBLIC
MLIRAffine
MLIRAffineBufferizableOpInterfaceImpl
MLIRAffineUtils
MLIRAnalysis
MLIRArithBufferizableOpInterfaceImpl

View File

@ -9,6 +9,7 @@
#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/ArithInterfaceImpl.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.h"
@ -44,6 +45,7 @@ struct LinalgComprehensiveModuleBufferize
vector::VectorDialect, scf::SCFDialect,
arith::ArithmeticDialect, StandardOpsDialect, AffineDialect>();
registerBufferizableOpInterfaceExternalModels(registry);
affine_ext::registerBufferizableOpInterfaceExternalModels(registry);
arith_ext::registerBufferizableOpInterfaceExternalModels(registry);
linalg_ext::registerBufferizableOpInterfaceExternalModels(registry);
scf_ext::registerBufferizableOpInterfaceExternalModels(registry);

View File

@ -6318,6 +6318,22 @@ cc_library(
],
)
cc_library(
name = "AffineBufferizableOpInterfaceImpl",
srcs = [
"lib/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.cpp",
],
hdrs = [
"include/mlir/Dialect/Linalg/ComprehensiveBufferize/AffineInterfaceImpl.h",
],
includes = ["include"],
deps = [
":Affine",
":BufferizableOpInterface",
"//llvm:Support",
],
)
cc_library(
name = "ArithBufferizableOpInterfaceImpl",
srcs = [
@ -6611,6 +6627,7 @@ cc_library(
includes = ["include"],
deps = [
":Affine",
":AffineBufferizableOpInterfaceImpl",
":AffineUtils",
":Analysis",
":ArithBufferizableOpInterfaceImpl",
@ -6656,7 +6673,6 @@ cc_library(
],
includes = ["include"],
deps = [
":Affine",
":BufferizableOpInterface",
":BufferizationDialect",
":DialectUtils",