Add Async Function to the Async Dialect
Add Async Function to the Async Dialect
Today `async.execute` operation semantics requires attached region to be executed in a thread managed by the runtime, and always returns an `!async.token` result. We need to model async functions that are not necessarily executed in a runtime-managed threads, but eventually lowered to llvm coroutines.
Example:
```
async.func @foo(%arg0: !async.value<f32>) -> !async.token {
%0 = async.await %arg0: !async.value<f32>
"do_something_with_f32"(%0)
return
}
```
If `arg0` is available this function will be executed in the caller thread. If it's not available it will be suspended and resumed later later on a thread managed by the async runtime. Currently this is not representable with `async.execute` operations.
The longer term goal is to make async dialect more like https://github.com/lewissbaker/cppcoro to be able to represent structured host concurrency in MLIR.
(1) Add async.func, async.call, and async.return operations in Async Dialect
Reviewed By: ezhulenev, rriddle
Differential Revision: https://reviews.llvm.org/D137189