[Openmp-commits] [PATCH] D145831: [OpenMP][libomptarget] Add support for critical regions in AMD GPU device offloading

Carlo Bertolli via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 21 09:46:23 PDT 2023


carlo.bertolli added a comment.

In D145831#4207338 <https://reviews.llvm.org/D145831#4207338>, @JonChesterfield wrote:

> I'm really sure that locks at thread scope do not work on amdgpu or pre-volta nvptx. One of the threads wins the cas, all the others do not, and it immediately deadlocks.
>
> Critical sections can be done by rewriting the cfg, general purpose locks can't.
>
> What am I missing here?

Agreed: this patch does not address "unstructured" locks in general, when there is inter-wave/warp thread divergence in GPUs that cannot guarantee forward progress for diverging lanes within the same wave.

What this is for is to support OpenMP critical sections, whose implementation is based on setLock/unsetLock. That's why the LIT test uses critical. The implementation - it is my understanding - calls very carefully set/unsetLock as @doru1004 indicated (one lane in the wave calss set/unsetLock and the others are waiting at a wave sync point).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145831



More information about the Openmp-commits mailing list