[PATCH] D115790: [Coroutines] Set presplit attribute in Clang

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 19 19:50:05 PST 2021


ChuanqiXu added a comment.

In D115790#3199905 <https://reviews.llvm.org/D115790#3199905>, @ezhulenev wrote:

> There are two places where in MLIR you can put an attribute to coroutine functions:
>
> 1. https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp#L126
>
> This is the point when coroutine functions are created, and you can attach attribute to the `func` argument
>
> 2. https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp#L325
>
> Another options is to attach attribute to the `op->getParentOfType<FuncOp>` when async runtime operations lowered to `coro.id` intrinsic.
>
> /cc @mehdi_amini to chime in what option is better. I'm not sure though what type of MLIR attribute will be translated to LLVM `"coroutine.presplit"="0"`, `UnitAttr`? Or it must be `IntegerAttr`.
>
> I'm on vacation with limjted access to computer until the end of the year, I can take a look at it myself ~late Dec or early Jan.

Hi, thanks for looking into this. In this func, https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp#L126, I tried to write:

  func.setAttr("coroutine.presplit", "0");

But it shows that we could only set the attribute for argument and result type instead of the function itself. How could we make it?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115790/new/

https://reviews.llvm.org/D115790



More information about the llvm-commits mailing list