[Openmp-commits] [PATCH] D44754: [OpenMP][libomptarget] Initialize global memory stack only once.
Phabricator via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Mar 21 14:07:59 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rOMP328148: [OpenMP][libomptarget] Initialize global memory stack only once. (authored by gbercea, committed by ).
Repository:
rOMP OpenMP
https://reviews.llvm.org/D44754
Files:
libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
Index: libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
===================================================================
--- libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
+++ libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
@@ -263,6 +263,9 @@
// If this is invoked by the master thread of the master warp then intialize
// it with a smaller slot.
if (IsMasterThread) {
+ // Do not initalize this slot again if it has already been initalized.
+ if (master_rootS[0].DataEnd == &master_rootS[0].Data[0] + DS_Slot_Size)
+ return 0;
// 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;
@@ -272,6 +275,10 @@
master_rootS[0].PrevSlotStackPtr = 0;
return (__kmpc_data_sharing_slot *)&master_rootS[0];
}
+ // Do not initalize this slot again if it has already been initalized.
+ if (worker_rootS[wid].DataEnd ==
+ &worker_rootS[wid].Data[0] + DS_Worker_Warp_Slot_Size)
+ return 0;
// Initialize the pointer to the end of the slot given the size of the data
// section. DataEnd is non-inclusive.
worker_rootS[wid].DataEnd =
Index: libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
===================================================================
--- libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
+++ libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
@@ -346,9 +346,14 @@
&omptarget_nvptx_threadPrivateContext->TeamContext();
__kmpc_data_sharing_slot *RootS = teamDescr->RootS(WID, IsMasterThread());
- DataSharingState.SlotPtr[WID] = RootS;
- DataSharingState.TailPtr[WID] = RootS;
- DataSharingState.StackPtr[WID] = (void *)&RootS->Data[0];
+ // If a valid address has been returned then proceed with the initalization.
+ // Otherwise the initialization of the slot has already happened in a
+ // previous call to this function.
+ if (RootS) {
+ DataSharingState.SlotPtr[WID] = RootS;
+ DataSharingState.TailPtr[WID] = RootS;
+ DataSharingState.StackPtr[WID] = (void *)&RootS->Data[0];
+ }
}
// Currently we only support the sharing of variables between master and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44754.139370.patch
Type: text/x-patch
Size: 2275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180321/a8edb5aa/attachment-0001.bin>
More information about the Openmp-commits
mailing list