Index: libomptarget/deviceRTLs/nvptx/src/data_sharing.cu =================================================================== --- libomptarget/deviceRTLs/nvptx/src/data_sharing.cu +++ libomptarget/deviceRTLs/nvptx/src/data_sharing.cu @@ -88,7 +88,7 @@ omptarget_nvptx_TeamDescr *teamDescr = &omptarget_nvptx_threadPrivateContext->TeamContext(); - __kmpc_data_sharing_slot *RootS = teamDescr->RootS(WID); + __kmpc_data_sharing_slot *RootS = teamDescr->RootS(WID, IsMasterThread()); DataSharingState.SlotPtr[WID] = RootS; DataSharingState.StackPtr[WID] = (void *)&RootS->Data[0]; @@ -340,7 +340,7 @@ unsigned WID = getWarpId(); omptarget_nvptx_TeamDescr *teamDescr = &omptarget_nvptx_threadPrivateContext->TeamContext(); - __kmpc_data_sharing_slot *RootS = teamDescr->RootS(WID); + __kmpc_data_sharing_slot *RootS = teamDescr->RootS(WID, IsMasterThread()); DataSharingState.SlotPtr[WID] = RootS; DataSharingState.TailPtr[WID] = RootS; Index: libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h =================================================================== --- libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h +++ libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h @@ -259,10 +259,10 @@ // init INLINE void InitTeamDescr(); - INLINE __kmpc_data_sharing_slot *RootS(int wid) { + INLINE __kmpc_data_sharing_slot *RootS(int wid, bool IsMasterThread) { // If this is invoked by the master thread of the master warp then intialize // it with a smaller slot. - if (wid == WARPSIZE - 1) { + if (IsMasterThread) { // Initialize the pointer to the end of the slot given the size of the // data section. DataEnd is non-inclusive. master_rootS[0].DataEnd = &master_rootS[0].Data[0] + DS_Slot_Size; Index: libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.cu =================================================================== --- libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.cu +++ libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.cu @@ -168,7 +168,8 @@ if (RequiresDataSharing && threadId % WARPSIZE == 0) { // Warp master innitializes data sharing environment. unsigned WID = threadId / WARPSIZE; - __kmpc_data_sharing_slot *RootS = currTeamDescr.RootS(WID); + __kmpc_data_sharing_slot *RootS = currTeamDescr.RootS( + WID, WID == WARPSIZE - 1); DataSharingState.SlotPtr[WID] = RootS; DataSharingState.StackPtr[WID] = (void *)&RootS->Data[0]; }