[Mlir-commits] [mlir] 8f23fac - [mlir:Async] Convert assertions to async errors only inside async functions

Eugene Zhulenev llvmlistbot at llvm.org
Thu May 27 12:49:10 PDT 2021


Author: Eugene Zhulenev
Date: 2021-05-27T12:49:00-07:00
New Revision: 8f23fac4da254e8cd2a3160a4fa029613a284ebe

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

LOG: [mlir:Async] Convert assertions to async errors only inside async functions

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

Added: 
    

Modified: 
    mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 6ebf48ad6475..0789a0ee6887 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -591,8 +591,11 @@ void AsyncToAsyncRuntimePass::runOnOperation() {
   runtimeTarget.addIllegalOp<CreateGroupOp, AddToGroupOp>();
   runtimeTarget.addIllegalOp<ExecuteOp, AwaitOp, AwaitAllOp, async::YieldOp>();
 
-  // Assertions must be converted to runtime errors.
-  runtimeTarget.addIllegalOp<AssertOp>();
+  // Assertions must be converted to runtime errors inside async functions.
+  runtimeTarget.addDynamicallyLegalOp<AssertOp>([&](AssertOp op) -> bool {
+    auto func = op->getParentOfType<FuncOp>();
+    return outlinedFunctions.find(func) == outlinedFunctions.end();
+  });
   runtimeTarget.addLegalOp<CondBranchOp>();
 
   if (failed(applyPartialConversion(module, runtimeTarget,


        


More information about the Mlir-commits mailing list