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

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Fri Nov 24 05:51:53 PST 2023


kiranchandramohan wrote:

@luporl I see that clang uses a runtime call to implement threadprivate. And that runtime call internally has a barrier.
https://openmp.llvm.org/doxygen/group__THREADPRIVATE.html#ga1453eca6136fd77e5de88ea0e78cc7a4

Have you explored using the runtime call?

In general, there is a desire to capture the privatisation and data-copying closes in the OpenMP dialect and then lower them later when we interface with the OpenMP IRBuilder. We did not do this initially to minimize any changes from the default FIR flow, lack of experience, and also the fact that privatisation in Parallel construct did not need a runtime call or any special construction. This will change with tasks (which need all the firstprivate variables to be allocated in the task data-structure). But copyprivate also could be a good candidate to initiate capturing this information in the OpenMP dialect and then lowering it later using the OpenMPIRBuilder since it can make use of the `kmpc_copyprivate` runtime call and also because it is only applicable to one construct.

Let me know what your thoughts are on this.

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


More information about the flang-commits mailing list