[flang-commits] [flang] [flang][OpenMP][RFC] Add support for COPYPRIVATE (PR #73128)
via flang-commits
flang-commits at lists.llvm.org
Fri Nov 24 08:27:29 PST 2023
https://github.com/jeanPerier commented:
I am a bit rusty with OpenMP, but how do you ensure that the sync variable is shared by all the threads when this is a single in a subprogram without a parallel?
I would expect the alloca for the buffer to be "private" to each threads that entered the subprogram in a call from.
e.g: do all threads print `1` in the program below?
```
subroutine foo(i)
!$omp single
i = 1
!$omp end single copyprivate(i)
end subroutine
integer, save :: i = 0
!$omp threadprivate(i)
!$omp parallel
call foo(i)
!$omp critical
print *, i
!$omp end critical
!$omp end parallel
end
```
>From a design point of view, would there be advantages to keep the copyprivate implementation abstract in the IR (e.g, to not make the buffer/barriers/copies explicit yet)?
https://github.com/llvm/llvm-project/pull/73128
More information about the flang-commits
mailing list