[flang-commits] [llvm] [flang] [mlir] [flang][mlir][OpenMP] Add support for COPYPRIVATE (PR #73128)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Wed Dec 20 16:12:12 PST 2023


https://github.com/kiranchandramohan commented:

> * There is one thing that I've noticed a bit late. The `__kmpc_copyprivate` function uses 2 barriers, which may impact the performance of COPYPRIVATE with multiple variables. Combining the updates of all variables to use a single `__kmpc_copyprivate` call is not straightforward.

Looking at the code, if the OpenMPIRBuilder provides an interface that can combine the individual variables and copy function into a struct of variables and a single-combined copy function then this issue will go away since it will be 2 barriers for all the copyprivates. I am guessing this is an additional implementation effort and not a fundamental issue. 2 barriers and runtime call per variable in copy-private is high but I guess we can improve this in another patch.

> * I have written only a basic test for now, covering simple scalars and arrays. My plan is to add more tests, but I wanted to get some feedback first, to avoid having to rewrite the tests too much.

Since there is code in different sub-repos (mlir dialect, mlir translation, openmpirbuilder) we will need tests there eventually as well (mlir/test/Dialect/OpenMP/ops.mlir, mlir/test/Target/LLVMIR/, llvm/unittests/Frontend/).

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


More information about the flang-commits mailing list