[Mlir-commits] [mlir] d2a8a3a - [mlir] Async: add unrealized cast materializations to AsyncToLLVM pass

Eugene Zhulenev llvmlistbot at llvm.org
Tue Aug 30 10:50:28 PDT 2022


Author: Eugene Zhulenev
Date: 2022-08-30T10:50:20-07:00
New Revision: d2a8a3af5e64a6dcfbe463311091d9e6b4d9c102

URL: https://github.com/llvm/llvm-project/commit/d2a8a3af5e64a6dcfbe463311091d9e6b4d9c102
DIFF: https://github.com/llvm/llvm-project/commit/d2a8a3af5e64a6dcfbe463311091d9e6b4d9c102.diff

LOG: [mlir] Async: add unrealized cast materializations to AsyncToLLVM pass

[mlir] Async: add unrealized cast materializations to AsyncToLLVM pass

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D132768

Added: 
    

Modified: 
    mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index aa6598c26853d..26154e4ed66d9 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -278,6 +278,17 @@ class AsyncRuntimeTypeConverter : public TypeConverter {
   AsyncRuntimeTypeConverter() {
     addConversion([](Type type) { return type; });
     addConversion(convertAsyncTypes);
+
+    // Use UnrealizedConversionCast as the bridge so that we don't need to pull
+    // in patterns for other dialects.
+    auto addUnrealizedCast = [](OpBuilder &builder, Type type,
+                                ValueRange inputs, Location loc) {
+      auto cast = builder.create<UnrealizedConversionCastOp>(loc, type, inputs);
+      return Optional<Value>(cast.getResult(0));
+    };
+
+    addSourceMaterialization(addUnrealizedCast);
+    addTargetMaterialization(addUnrealizedCast);
   }
 
   static Optional<Type> convertAsyncTypes(Type type) {


        


More information about the Mlir-commits mailing list