[Mlir-commits] [mlir] f0ceba8 - Revert "[mlir][Conversion] Implement ConvertToLLVMPatternInterface (1)"
Matthias Springer
llvmlistbot at llvm.org
Wed Aug 9 01:00:26 PDT 2023
Author: Matthias Springer
Date: 2023-08-09T09:53:21+02:00
New Revision: f0ceba8be63577d48bebf45aa8e91fb4fd9b7a54
URL: https://github.com/llvm/llvm-project/commit/f0ceba8be63577d48bebf45aa8e91fb4fd9b7a54
DIFF: https://github.com/llvm/llvm-project/commit/f0ceba8be63577d48bebf45aa8e91fb4fd9b7a54.diff
LOG: Revert "[mlir][Conversion] Implement ConvertToLLVMPatternInterface (1)"
This reverts commit 52aa6bd3fd6f48f583beaadcbb53edc0f3def4a1.
async-to-llvm needs special handling as it uses the type converter in a
different way.
Added:
Modified:
mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
mlir/include/mlir/InitAllExtensions.h
mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
mlir/test/Conversion/ControlFlowToLLVM/assert.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
index 25b82aed9c968a..b9f57cc8beb0b1 100644
--- a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
+++ b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
@@ -13,7 +13,6 @@
namespace mlir {
-class DialectRegistry;
class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
@@ -24,8 +23,6 @@ class Pass;
namespace arith {
void populateArithToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
-
-void registerConvertArithToLLVMInterface(DialectRegistry ®istry);
} // namespace arith
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h b/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
index bd9217ec686546..60441f9faaa60e 100644
--- a/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
+++ b/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
@@ -14,7 +14,6 @@
namespace mlir {
class ConversionTarget;
-class DialectRegistry;
class Pass;
class MLIRContext;
class TypeConverter;
@@ -35,8 +34,6 @@ void populateAsyncStructuralTypeConversionsAndLegality(
TypeConverter &typeConverter, RewritePatternSet &patterns,
ConversionTarget &target);
-void registerConvertAsyncToLLVMInterface(DialectRegistry ®istry);
-
} // namespace mlir
#endif // MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H
diff --git a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
index 69b01b471dd984..1385618c098001 100644
--- a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
+++ b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
@@ -11,7 +11,6 @@
#include "mlir/Conversion/LLVMCommon/StructBuilder.h"
namespace mlir {
-class DialectRegistry;
class LLVMTypeConverter;
class Pass;
class RewritePatternSet;
@@ -41,9 +40,6 @@ class ComplexStructBuilder : public StructBuilder {
/// Populate the given list with patterns that convert from Complex to LLVM.
void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
-
-void registerConvertComplexToLLVMInterface(DialectRegistry ®istry);
-
} // namespace mlir
#endif // MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
diff --git a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
index 35b691b8bc44b5..9cc867238a00dc 100644
--- a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
+++ b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
@@ -16,7 +16,6 @@
#include <memory>
namespace mlir {
-class DialectRegistry;
class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
@@ -38,9 +37,6 @@ void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter,
void populateAssertToLLVMConversionPattern(LLVMTypeConverter &converter,
RewritePatternSet &patterns,
bool abortOnFailure = true);
-
-void registerConvertControlFlowToLLVMInterface(DialectRegistry ®istry);
-
} // namespace cf
} // namespace mlir
diff --git a/mlir/include/mlir/InitAllExtensions.h b/mlir/include/mlir/InitAllExtensions.h
index 172df39a08d895..ee51bee9ced1d8 100644
--- a/mlir/include/mlir/InitAllExtensions.h
+++ b/mlir/include/mlir/InitAllExtensions.h
@@ -14,10 +14,6 @@
#ifndef MLIR_INITALLEXTENSIONS_H_
#define MLIR_INITALLEXTENSIONS_H_
-#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
-#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
-#include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
-#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/NVVMToLLVM/NVVMToLLVM.h"
#include "mlir/Dialect/Func/Extensions/AllExtensions.h"
@@ -33,10 +29,6 @@ namespace mlir {
/// individually register the specific extensions that are useful for the
/// pipelines and transformations you are using.
inline void registerAllExtensions(DialectRegistry ®istry) {
- arith::registerConvertArithToLLVMInterface(registry);
- registerConvertAsyncToLLVMInterface(registry);
- registerConvertComplexToLLVMInterface(registry);
- cf::registerConvertControlFlowToLLVMInterface(registry);
func::registerAllExtensions(registry);
registerConvertMemRefToLLVMInterface(registry);
registerConvertNVVMToLLVMInterface(registry);
diff --git a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
index d90154612a55d1..d12fee3552dcf2 100644
--- a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
+++ b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
@@ -9,7 +9,6 @@
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
-#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
@@ -452,35 +451,6 @@ struct ArithToLLVMConversionPass
};
} // namespace
-//===----------------------------------------------------------------------===//
-// ConvertToLLVMPatternInterface implementation
-//===----------------------------------------------------------------------===//
-
-namespace {
-/// Implement the interface to convert MemRef to LLVM.
-struct ArithToLLVMDialectInterface : public ConvertToLLVMPatternInterface {
- using ConvertToLLVMPatternInterface::ConvertToLLVMPatternInterface;
- void loadDependentDialects(MLIRContext *context) const final {
- context->loadDialect<LLVM::LLVMDialect>();
- }
-
- /// Hook for derived dialect interface to provide conversion patterns
- /// and mark dialect legal for the conversion target.
- void populateConvertToLLVMConversionPatterns(
- ConversionTarget &target, LLVMTypeConverter &typeConverter,
- RewritePatternSet &patterns) const final {
- arith::populateArithToLLVMConversionPatterns(typeConverter, patterns);
- }
-};
-} // namespace
-
-void mlir::arith::registerConvertArithToLLVMInterface(
- DialectRegistry ®istry) {
- registry.addExtension(+[](MLIRContext *ctx, arith::ArithDialect *dialect) {
- dialect->addInterfaces<ArithToLLVMDialectInterface>();
- });
-}
-
//===----------------------------------------------------------------------===//
// Pattern Population
//===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index 0fb21322b3ac3b..d1998cfb4b642d 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -8,7 +8,6 @@
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
-#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
@@ -1252,32 +1251,3 @@ void mlir::populateAsyncStructuralTypeConversionsAndLegality(
target.addDynamicallyLegalOp<AwaitOp, ExecuteOp, async::YieldOp>(
[&](Operation *op) { return typeConverter.isLegal(op); });
}
-
-//===----------------------------------------------------------------------===//
-// ConvertToLLVMPatternInterface implementation
-//===----------------------------------------------------------------------===//
-
-namespace {
-/// Implement the interface to convert MemRef to LLVM.
-struct AsyncToLLVMDialectInterface : public ConvertToLLVMPatternInterface {
- using ConvertToLLVMPatternInterface::ConvertToLLVMPatternInterface;
- void loadDependentDialects(MLIRContext *context) const final {
- context->loadDialect<LLVM::LLVMDialect>();
- }
-
- /// Hook for derived dialect interface to provide conversion patterns
- /// and mark dialect legal for the conversion target.
- void populateConvertToLLVMConversionPatterns(
- ConversionTarget &target, LLVMTypeConverter &typeConverter,
- RewritePatternSet &patterns) const final {
- populateAsyncStructuralTypeConversionsAndLegality(typeConverter, patterns,
- target);
- }
-};
-} // namespace
-
-void mlir::registerConvertAsyncToLLVMInterface(DialectRegistry ®istry) {
- registry.addExtension(+[](MLIRContext *ctx, AsyncDialect *dialect) {
- dialect->addInterfaces<AsyncToLLVMDialectInterface>();
- });
-}
diff --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
index b219de7fef8f8c..7185b01afdc00a 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
@@ -8,7 +8,6 @@
#include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
-#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
@@ -343,32 +342,3 @@ void ConvertComplexToLLVMPass::runOnOperation() {
applyPartialConversion(getOperation(), target, std::move(patterns))))
signalPassFailure();
}
-
-//===----------------------------------------------------------------------===//
-// ConvertToLLVMPatternInterface implementation
-//===----------------------------------------------------------------------===//
-
-namespace {
-/// Implement the interface to convert MemRef to LLVM.
-struct ComplexToLLVMDialectInterface : public ConvertToLLVMPatternInterface {
- using ConvertToLLVMPatternInterface::ConvertToLLVMPatternInterface;
- void loadDependentDialects(MLIRContext *context) const final {
- context->loadDialect<LLVM::LLVMDialect>();
- }
-
- /// Hook for derived dialect interface to provide conversion patterns
- /// and mark dialect legal for the conversion target.
- void populateConvertToLLVMConversionPatterns(
- ConversionTarget &target, LLVMTypeConverter &typeConverter,
- RewritePatternSet &patterns) const final {
- populateComplexToLLVMConversionPatterns(typeConverter, patterns);
- }
-};
-} // namespace
-
-void mlir::registerConvertComplexToLLVMInterface(DialectRegistry ®istry) {
- registry.addExtension(
- +[](MLIRContext *ctx, complex::ComplexDialect *dialect) {
- dialect->addInterfaces<ComplexToLLVMDialectInterface>();
- });
-}
diff --git a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
index d99968d78d248c..f58f9b4761ad8a 100644
--- a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
+++ b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
@@ -13,7 +13,6 @@
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
-#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
@@ -288,34 +287,3 @@ struct ConvertControlFlowToLLVM
}
};
} // namespace
-
-//===----------------------------------------------------------------------===//
-// ConvertToLLVMPatternInterface implementation
-//===----------------------------------------------------------------------===//
-
-namespace {
-/// Implement the interface to convert MemRef to LLVM.
-struct ControlFlowToLLVMDialectInterface
- : public ConvertToLLVMPatternInterface {
- using ConvertToLLVMPatternInterface::ConvertToLLVMPatternInterface;
- void loadDependentDialects(MLIRContext *context) const final {
- context->loadDialect<LLVM::LLVMDialect>();
- }
-
- /// Hook for derived dialect interface to provide conversion patterns
- /// and mark dialect legal for the conversion target.
- void populateConvertToLLVMConversionPatterns(
- ConversionTarget &target, LLVMTypeConverter &typeConverter,
- RewritePatternSet &patterns) const final {
- mlir::cf::populateControlFlowToLLVMConversionPatterns(typeConverter,
- patterns);
- }
-};
-} // namespace
-
-void mlir::cf::registerConvertControlFlowToLLVMInterface(
- DialectRegistry ®istry) {
- registry.addExtension(+[](MLIRContext *ctx, cf::ControlFlowDialect *dialect) {
- dialect->addInterfaces<ControlFlowToLLVMDialectInterface>();
- });
-}
diff --git a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
index 43ed4ebce34e17..db9df579820d69 100644
--- a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
@@ -1,9 +1,5 @@
// RUN: mlir-opt -pass-pipeline="builtin.module(func.func(convert-arith-to-llvm))" %s -split-input-file | FileCheck %s
-// Same below, but using the `ConvertToLLVMPatternInterface` entry point
-// and the generic `convert-to-llvm` pass.
-// RUN: mlir-opt --convert-to-llvm --split-input-file %s
-
// CHECK-LABEL: @vector_ops
func.func @vector_ops(%arg0: vector<4xf32>, %arg1: vector<4xi1>, %arg2: vector<4xi64>, %arg3: vector<4xi64>) -> vector<4xf32> {
// CHECK-NEXT: %0 = llvm.mlir.constant(dense<4.200000e+01> : vector<4xf32>) : vector<4xf32>
diff --git a/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir b/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
index f55023e94425e5..fd419dc95e7a1a 100644
--- a/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
+++ b/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
@@ -1,9 +1,5 @@
// RUN: mlir-opt %s -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' | FileCheck %s
-// Same below, but using the `ConvertToLLVMPatternInterface` entry point
-// and the generic `convert-to-llvm` pass.
-// RUN: mlir-opt -async-to-async-runtime --convert-to-llvm --split-input-file %s
-
// CHECK-LABEL: reference_counting
func.func @reference_counting(%arg0: !async.token) {
// CHECK: %[[C2:.*]] = arith.constant 2 : i64
diff --git a/mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir b/mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
index dc8513dd7586c5..be46c22155a6c6 100644
--- a/mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
+++ b/mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
@@ -1,9 +1,5 @@
// RUN: mlir-opt %s -convert-complex-to-llvm | FileCheck %s
-// Same below, but using the `ConvertToLLVMPatternInterface` entry point
-// and the generic `convert-to-llvm` pass.
-// RUN: mlir-opt --convert-to-llvm --split-input-file %s
-
// CHECK-LABEL: func @complex_create
// CHECK-SAME: (%[[REAL0:.*]]: f32, %[[IMAG0:.*]]: f32)
// CHECK-NEXT: %[[CPLX0:.*]] = llvm.mlir.undef : !llvm.struct<(f32, f32)>
diff --git a/mlir/test/Conversion/ControlFlowToLLVM/assert.mlir b/mlir/test/Conversion/ControlFlowToLLVM/assert.mlir
index 413933331ac95f..67804b60f26f4a 100644
--- a/mlir/test/Conversion/ControlFlowToLLVM/assert.mlir
+++ b/mlir/test/Conversion/ControlFlowToLLVM/assert.mlir
@@ -1,9 +1,5 @@
// RUN: mlir-opt %s -convert-cf-to-llvm='use-opaque-pointers=1' | FileCheck %s
-// Same below, but using the `ConvertToLLVMPatternInterface` entry point
-// and the generic `convert-to-llvm` pass.
-// RUN: mlir-opt --convert-to-llvm --split-input-file %s
-
func.func @main() {
%a = arith.constant 0 : i1
cf.assert %a, "assertion foo"
More information about the Mlir-commits
mailing list