This is an archive of the discontinued LLVM Phabricator instance.

Add async_funcs_only option to AsyncToAsyncRuntime pass
ClosedPublic

Authored by yijia1212 on Nov 23 2022, 2:26 PM.

Details

Summary

This change adds async_funcs_only option to AsyncToAsyncRuntimePass. The goal is to convert async functions to regular functions in early stages of compilation pipeline.

Diff Detail

Event Timeline

yijia1212 created this revision.Nov 23 2022, 2:26 PM
yijia1212 requested review of this revision.Nov 23 2022, 2:26 PM

Instead of adding an option to a pass, can you add a populate... function (similar to https://github.com/llvm/llvm-project/blob/2e999b7dd1934a44d38c3a753460f1e5a217e9a5/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h#L22-L25) that will add all patterns to the rewriter.

Users that need to lower just the async.func can write a custom pass with their own ConversionTarget that will only mark async.func as illegal. That's a more idiomatic MLIR way to parametrize passes.

Also having populateSCFToControlFlowConversionPatterns here is a mistake. If some users require mixing lowering of async and lowering to CFG, again they should use populate... and a custom pass. Let's try to remove it from this pass (in future PRs), I don't think that any tests in MLIR itself depend on this behavior.

yijia1212 updated this revision to Diff 478765.Nov 29 2022, 5:31 PM

Handle reviews. Creating a separate pass to lower async.func to coroutine

ezhulenev added inline comments.Nov 30 2022, 8:27 AM
mlir/include/mlir/Dialect/Async/Passes.td
43–44

Lower all hight level ...

50

nit: async-func-to-async-runtime for consistency

51

Lower async.func

Address reviews

yijia1212 marked 3 inline comments as done.Nov 30 2022, 10:03 AM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 30 2022, 10:27 AM
This revision was automatically updated to reflect the committed changes.