[Mlir-commits] [mlir] [OpenMP][mlir] Add Groupprivate op in omp dialect. (PR #162704)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Nov 28 07:39:50 PST 2025
skc7 wrote:
Thanks @ergawy for finding the issue in shared memory allocation and deallocation in lowering of omp.groupprivate.
The current implementation directly lowers `omp.groupprivate` to `__kmpc_alloc_shared()` calls, which is incorrect per the OpenMP specification.
As per OpenMP spec, groupprivate variables should have **one copy per contention group (team)**, shared by all threads within that team.
**For GPU targets (device):**
- Groupprivate is equivalent to GPU shared memory (LDS on AMD)
- Could be lowered to a global variable in **address space 3** (NVPTX/AMDGPU shared memory) during OpenMPToLLVMIRTranslation.
- This automatically provides one copy per team, shared by all threads
But, I'm unaware of the case of lowering when groupprivate variable is accessed on host. Do we have any runtime call to handle this?
CC: @mjklemm
https://github.com/llvm/llvm-project/pull/162704
More information about the Mlir-commits
mailing list