diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp --- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp +++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp @@ -591,8 +591,11 @@ runtimeTarget.addIllegalOp(); runtimeTarget.addIllegalOp(); - // Assertions must be converted to runtime errors. - runtimeTarget.addIllegalOp(); + // Assertions must be converted to runtime errors inside async functions. + runtimeTarget.addDynamicallyLegalOp([&](AssertOp op) -> bool { + auto func = op->getParentOfType(); + return outlinedFunctions.find(func) == outlinedFunctions.end(); + }); runtimeTarget.addLegalOp(); if (failed(applyPartialConversion(module, runtimeTarget,