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

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Thu Mar 14 07:58:52 PDT 2024


kiranchandramohan wrote:


> > 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.

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.

> > 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.

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?

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


More information about the flang-commits mailing list