[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 07:09:32 PDT 2024


bhandarkar-pranav wrote:

Thanks @skatrak and @kiranchandramohan 
> The concern with this approach is that it is attempting early lowering or conversion of target dependencies. It also means there will be no lowering for target dependencies in MLIR. It is probably not good that there is no lowering for target dependencies in the OpenMP dialect when there is a representation for it.

The other PR (https://github.com/llvm/llvm-project/pull/83966) which is an alternative solution to this does the lowering in MLIR instead. With this approach one of the outcomes would be that we could remove dependencies from the ``omp.target`` representation entirely.
> 
> The issue with the conversion OpenMP MLIR pass is that it introduces tasks wrapping target constructs only when there are dependencies. Why is it not there when there are no dependencies? 

I don't understand why the the outer task is needed in the absence of dependencies. Dependencies are handled by the runtime on the host side and hence the outer task.

>If this is an LLVM openmp runtime-specific lowering or just matching what Clang is doing, then we can add it as part of a legalize-for-export kind of pass. Equivalently you could refactor the task dependence lowering in OpenMPIRBuilder and/or OpenMP Translation.

Yes, it matches what clang is doing. But, clang does it when generating LLVM IR. But IMHO, this is a higher level transformation ideally suited for MLIR. So, I would prefer a legalize-for-export pass rather than handle this procedurally in OpenMP Translation.  Clang, of course, has no choice because it doesn't use MLIR.



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


More information about the flang-commits mailing list