[Mlir-commits] [mlir] [OpenMP][MLIR] Add omp.distribute op to the OMP dialect (PR #67720)
Sergio Afonso
llvmlistbot at llvm.org
Tue Oct 3 07:15:04 PDT 2023
skatrak wrote:
> > > In the lowering in #67798, an `omp.wsloop` is created for `!$omp distribute`. Is this always correct to do as per the standard? Is it based on existing Clang lowering?
> >
> >
> > I think a omp.wsloop is created from parallel do, Afaik 'distribute' is associated with teams, so that each team takes a chunk of the iterations instead of all teams taking all (duplicating) iterations.
>
> The example lowering created a `omp.wsloop` operation for an `omp.distribute` eventhough there was no `parallel do`. Hence the question. https://github.com/llvm/llvm-project/pull/67798/files#diff-0652f88238afa05fb262dcebab875780ab553b3914ba7239512c45986198240d
>
Thanks for bringing attention to this. I think that example should not produce an `omp.wsloop` in that situation. We would need to have the `omp.distribute` operation somehow represent that loop by itself, since the semantics for `omp.wsloop` are not the same (worksharing iterations across threads in a team vs worksharing iterations across teams in a league).
To me, at this time the options to achieve this are either to adopt `omp.canonical_loop` and to integrate it with both `omp.distribute` and `omp.wsloop` or to follow `omp.wsloop` design in `omp.distribute` so that it defines its own loop indices as block arguments after being given the bounds and step. I understand that the first option would be what we'd like to have long term, but the second would allow us to keep adding offloading features while the `omp.canonical_loop` design is finalized.
https://github.com/llvm/llvm-project/pull/67720
More information about the Mlir-commits
mailing list