HomePhabricator

[mlir:Async] Add intermediate async.coro and async.runtime operations to…

Authored by ezhulenev on Jan 18 2021, 10:58 AM.

Description

[mlir:Async] Add intermediate async.coro and async.runtime operations to simplify Async to LLVM lowering

[NFC] No new functionality, mostly a cleanup and one more abstraction level between Async and LLVM IR.

Instead of lowering from Async to LLVM coroutines and Async Runtime API in one shot, do it progressively via async.coro and async.runtime operations.

  1. Lower from async to async.runtime/coro (e.g. async.execute to function with coro setup and runtime calls)
  2. Lower from async.runtime/coro to LLVM intrinsics and runtime API calls

Intermediate coro/runtime operations will allow to run transformations on a higher level IR and do not try to match IR based on the LLVM::CallOp properties.

Although async.coro is very close to LLVM coroutines, it is not exactly the same API, instead it is optimized for usability in async lowering, and misses a lot of details that are present in @llvm.coro intrinsic.

Reviewed By: ftynse

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