[flang-commits] [flang] [flang][OpenMP] - Transform target offloading directives with dependencies during PFT to MLIR conversion (PR #85130)

Pranav Bhandarkar via flang-commits flang-commits at lists.llvm.org
Thu Mar 14 21:53:53 PDT 2024


bhandarkar-pranav wrote:

Thanks @kiranchandramohan 
> Isn't there always a target task generated by the target construct? This could be implicit and I am assuming that you are making the implicit task for a target construct explicit for dependencies. And by making an explicit task in the presence of dependences we are making a difference with the regular target flow.

Rereading the spec (5.2) it appears to me that an outer task should always be generated. Here is the relevant part taken from [here](https://www.openmp.org/spec-html/5.2/openmpse3.html#x16-150001.3)
>>> _When a target construct is encountered, a new target task is generated. The target task region encloses the target region. The target task is complete after the execution of the target region is complete._

But, in the absence of the `nowait` clause on the `target` construct, this enclosing task is an _included task_ i.e. _undeferred_ and executed by the _encountering thread_ . This is why, I think, Clang only generates  an enclosing task if `depend`, `in_reduction`, `nowait` or `thread_limit` (if OpenMP > 5.1) clauses are used on the `target` construct.

> I am fine with it as a `legalize-for-export` pass. Doing this in MLIR slightly deviates from the OpenMPIRBuilder approach that the LLVM openmp developers wanted us to use. Could you write a quick RFC in MLIR discourse, point out that this is a good use case of MLIR progressive lowering and ping @jdoerfert @Meinersbur and check whether it is OK?

Sounds good, but can the RFC wait a few weeks. I am out on parental leave starting Monday and think it is best to pick it up after I come back (mid April). If you think otherwise, let me know and I'll write up a quick RFC on Friday


https://github.com/llvm/llvm-project/pull/85130


More information about the flang-commits mailing list