This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Enable lowering support for OpenACC atomic operations
AcceptedPublic

Authored by razvanlupusoru on Aug 24 2023, 1:27 PM.

Details

Summary

Since the OpenACC atomics specification is a subset of OpenMP atomics,
the same lowering implementation can be used. This change extracts out
the necessary pieces from the OpenMP lowering and puts them in a shared
spot. The shared spot is a header file (in the lib directory) so that
each implementation can template specialize directly.

After putting the OpenMP implementation in a common spot, the following
changes were needed to make it work for OpenACC:

  • Ensure parsing works correctly by avoiding hardcoded offsets.
  • Templatize based on atomic type.
  • The checking whether it is OpenMP or OpenACC is done by checking

for OmpAtomicClauseList (OpenACC does not implement this so we just
templatize with void). It was preferable to check this instead of atomic
type because in some cases, like atomic capture, the read/write/update
implementations are called - and we want compile time evaluation of
these conditional parts.

  • The memory order and hint are used only for OpenMP.
  • Generate acc dialect operations instead of omp dialect operations.

Depends on D158768

Diff Detail

Event Timeline

razvanlupusoru created this revision.Aug 24 2023, 1:27 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
razvanlupusoru requested review of this revision.Aug 24 2023, 1:27 PM

Just to be sure, did you build this change with https://reviews.llvm.org/D158294 in mind?

Just to be sure, did you build this change with https://reviews.llvm.org/D158294 in mind?

Yes - it will be straightforward to adapt the changes here on top of that as well.

clementval accepted this revision.Aug 25 2023, 1:03 PM

Just to be sure, did you build this change with https://reviews.llvm.org/D158294 in mind?

Yes - it will be straightforward to adapt the changes here on top of that as well.

Ok great! This look good for me.

This revision is now accepted and ready to land.Aug 25 2023, 1:03 PM