[flang-commits] [flang] [llvm] [flang][OpenACC][OpenMP] Separate implementations of ATOMIC constructs (PR #137517)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Mon Apr 28 13:40:55 PDT 2025
kparzysz wrote:
> Would you mind clarifying which atomic features from OpenMP 6.0 cause the difference between OpenMP and OpenACC atomics to widen that they need separated out?
Short answer: conditional-update and change in the implementation of the existing OpenMP code.
The conditional update (ATOMIC COMPARE) actually exists in OpenMP prior to 6.0, but hasn't been implemented in flang (beyond parsing). Without being aware of that yet, I tried to implement conditional update-capture (with post-6.0 clarifications), and then I realized that it's not going to be a simple addition of extra code.
I'm changing the OpenMP implementation in some fundamental ways. In particular, I'm putting the majority of work (to analyze and validate) the AST nodes into the semantic analysis, and within it, the expressions and assignments will be universally represented by `evaluate::Expr` and `evaluate::Assignment`. The existing shared code used AST nodes as the sources for MLIR-gen, the new code will use "evaluate". There is no `OmpAtomicClause` anymore, there is a single `OpenMPAtomicConstruct` for everything, and so on. This essentially replaced the OpenMP versions of the shared functions, so I decided to remove the rest from the header file and put it in OpenACC.cpp (which was the only user of that code).
This patch simply extracts that step into an individual PR to reduce the size of the upcoming OpenMP PR.
After everything is done, it may be possible for OpenACC to reuse the code, but in the meantime I didn't want to modify OpenACC as a part of this work.
Going back to the conditional-update: I'm planning to change the OpenMP atomic MLIR ops to avoid having to add an extra one for conditional-update-capture, so that may affect sharing in some way.
https://github.com/llvm/llvm-project/pull/137517
More information about the flang-commits
mailing list