[all-commits] [llvm/llvm-project] f81f88: [mlir] Lower async.func with async.coro and async....

yijia1212 via All-commits all-commits at lists.llvm.org
Mon Nov 7 09:54:10 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f81f880871e04ef0284af14a141a58905e81cdd9
      https://github.com/llvm/llvm-project/commit/f81f880871e04ef0284af14a141a58905e81cdd9
  Author: yijiagu <yijiagu at google.com>
  Date:   2022-11-07 (Mon, 07 Nov 2022)

  Changed paths:
    M mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
    M mlir/test/Dialect/Async/async-to-async-runtime.mlir
    A mlir/test/mlir-cpu-runner/async-func.mlir

  Log Message:
  -----------
  [mlir] Lower async.func with async.coro and async.runtime operations

Lower async.func with async.coro and async.runtime operations

- This patch modifies AsyncToAsyncRuntime pass to add lowering async.func ops with coroutine cfg.
Example:

```
async.func @foo() -> !async.value<f32> {
  %cst = arith.constant 42.0 : f32
  return %cst: f32
}
```

After lowering:

```
func.func @foo() -> !async.value<f32> attributes {passthrough = ["presplitcoroutine"]} {
    %0 = async.runtime.create : !async.value<f32>
    %1 = async.coro.id
    %2 = async.coro.begin %1
    cf.br ^bb1
  ^bb1:  // pred: ^bb0
    %cst = arith.constant 4.200000e+01 : f32
    async.runtime.store %cst, %0 : <f32>
    async.runtime.set_available %0 : !async.value<f32>
    cf.br ^bb2
  ^bb2:  // pred: ^bb1
    async.coro.free %1, %2
    cf.br ^bb3
  ^bb3:  // pred: ^bb2
    async.coro.end %2
    return %0 : !async.value<f32>
}
```

Reviewed By: ezhulenev

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




More information about the All-commits mailing list