[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:
parent
850e8b4504
commit
f32c3d9528
|
|
@ -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 ®istry);
|
||||||
|
|
||||||
|
} // namespace affine_ext
|
||||||
|
} // namespace comprehensive_bufferize
|
||||||
|
} // namespace linalg
|
||||||
|
} // namespace mlir
|
||||||
|
|
||||||
|
#endif // MLIR_DIALECT_LINALG_COMPREHENSIVEBUFFERIZE_AFFINE_INTERFACE_IMPL_H
|
||||||
|
|
@ -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 ®istry) {
|
||||||
|
registry.addOpInterface<AffineParallelOp,
|
||||||
|
AllocationHoistingBarrierOnly<AffineParallelOp>>();
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
set(LLVM_OPTIONAL_SOURCES
|
set(LLVM_OPTIONAL_SOURCES
|
||||||
|
AffineInterfaceImpl.cpp
|
||||||
ArithInterfaceImpl.cpp
|
ArithInterfaceImpl.cpp
|
||||||
BufferizableOpInterface.cpp
|
BufferizableOpInterface.cpp
|
||||||
ComprehensiveBufferize.cpp
|
ComprehensiveBufferize.cpp
|
||||||
|
|
@ -20,6 +21,14 @@ add_mlir_dialect_library(MLIRBufferizableOpInterface
|
||||||
MLIRMemRef
|
MLIRMemRef
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_mlir_dialect_library(MLIRAffineBufferizableOpInterfaceImpl
|
||||||
|
AffineInterfaceImpl.cpp
|
||||||
|
|
||||||
|
LINK_LIBS PUBLIC
|
||||||
|
MLIRAffine
|
||||||
|
MLIRBufferizableOpInterface
|
||||||
|
)
|
||||||
|
|
||||||
add_mlir_dialect_library(MLIRArithBufferizableOpInterfaceImpl
|
add_mlir_dialect_library(MLIRArithBufferizableOpInterfaceImpl
|
||||||
ArithInterfaceImpl.cpp
|
ArithInterfaceImpl.cpp
|
||||||
|
|
||||||
|
|
@ -73,7 +82,6 @@ add_mlir_dialect_library(MLIRComprehensiveBufferize
|
||||||
ComprehensiveBufferize.cpp
|
ComprehensiveBufferize.cpp
|
||||||
|
|
||||||
LINK_LIBS PUBLIC
|
LINK_LIBS PUBLIC
|
||||||
MLIRAffine
|
|
||||||
MLIRBufferizableOpInterface
|
MLIRBufferizableOpInterface
|
||||||
MLIRInferTypeOpInterface
|
MLIRInferTypeOpInterface
|
||||||
MLIRIR
|
MLIRIR
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,10 @@
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
|
||||||
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
|
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
|
||||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
|
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
|
||||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||||
|
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||||
#include "mlir/Dialect/Utils/StaticValueUtils.h"
|
#include "mlir/Dialect/Utils/StaticValueUtils.h"
|
||||||
#include "mlir/IR/AsmState.h"
|
#include "mlir/IR/AsmState.h"
|
||||||
#include "mlir/IR/BlockAndValueMapping.h"
|
#include "mlir/IR/BlockAndValueMapping.h"
|
||||||
|
|
@ -1513,8 +1513,6 @@ void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry) {
|
||||||
|
|
||||||
// Ops that are not bufferizable but are allocation hoisting barriers.
|
// Ops that are not bufferizable but are allocation hoisting barriers.
|
||||||
registry.addOpInterface<FuncOp, AllocationHoistingBarrierOnly<FuncOp>>();
|
registry.addOpInterface<FuncOp, AllocationHoistingBarrierOnly<FuncOp>>();
|
||||||
registry.addOpInterface<AffineParallelOp,
|
|
||||||
AllocationHoistingBarrierOnly<AffineParallelOp>>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace comprehensive_bufferize
|
} // namespace comprehensive_bufferize
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ add_mlir_dialect_library(MLIRLinalgTransforms
|
||||||
|
|
||||||
LINK_LIBS PUBLIC
|
LINK_LIBS PUBLIC
|
||||||
MLIRAffine
|
MLIRAffine
|
||||||
|
MLIRAffineBufferizableOpInterfaceImpl
|
||||||
MLIRAffineUtils
|
MLIRAffineUtils
|
||||||
MLIRAnalysis
|
MLIRAnalysis
|
||||||
MLIRArithBufferizableOpInterfaceImpl
|
MLIRArithBufferizableOpInterfaceImpl
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "PassDetail.h"
|
#include "PassDetail.h"
|
||||||
|
|
||||||
#include "mlir/Dialect/Bufferization/IR/Bufferization.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/ArithInterfaceImpl.h"
|
||||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
|
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.h"
|
||||||
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.h"
|
#include "mlir/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.h"
|
||||||
|
|
@ -44,6 +45,7 @@ struct LinalgComprehensiveModuleBufferize
|
||||||
vector::VectorDialect, scf::SCFDialect,
|
vector::VectorDialect, scf::SCFDialect,
|
||||||
arith::ArithmeticDialect, StandardOpsDialect, AffineDialect>();
|
arith::ArithmeticDialect, StandardOpsDialect, AffineDialect>();
|
||||||
registerBufferizableOpInterfaceExternalModels(registry);
|
registerBufferizableOpInterfaceExternalModels(registry);
|
||||||
|
affine_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||||
arith_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
arith_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||||
linalg_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
linalg_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||||
scf_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
scf_ext::registerBufferizableOpInterfaceExternalModels(registry);
|
||||||
|
|
|
||||||
|
|
@ -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(
|
cc_library(
|
||||||
name = "ArithBufferizableOpInterfaceImpl",
|
name = "ArithBufferizableOpInterfaceImpl",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
|
@ -6611,6 +6627,7 @@ cc_library(
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
deps = [
|
deps = [
|
||||||
":Affine",
|
":Affine",
|
||||||
|
":AffineBufferizableOpInterfaceImpl",
|
||||||
":AffineUtils",
|
":AffineUtils",
|
||||||
":Analysis",
|
":Analysis",
|
||||||
":ArithBufferizableOpInterfaceImpl",
|
":ArithBufferizableOpInterfaceImpl",
|
||||||
|
|
@ -6656,7 +6673,6 @@ cc_library(
|
||||||
],
|
],
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
deps = [
|
deps = [
|
||||||
":Affine",
|
|
||||||
":BufferizableOpInterface",
|
":BufferizableOpInterface",
|
||||||
":BufferizationDialect",
|
":BufferizationDialect",
|
||||||
":DialectUtils",
|
":DialectUtils",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue