summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Chesterfield <jonathanchesterfield@gmail.com>2019-10-30 13:31:56 +0000
committerJonChesterfield <jonathanchesterfield@gmail.com>2019-10-30 13:35:34 +0000
commit62a161cc00070acf057513deb6cabfb513d49af4 (patch)
tree08133fcbe355389feb18b9f86e858dc0822f4ebd
parent6c0a160c2d33e54aecf1538bf7c85d8da92051be (diff)
downloadbcm5719-llvm-62a161cc00070acf057513deb6cabfb513d49af4.tar.gz
bcm5719-llvm-62a161cc00070acf057513deb6cabfb513d49af4.zip
[libomptarget] Always call malloc, free via SafeMalloc, SafeFree wrapper
Summary: [libomptarget] Always call malloc, free via SafeMalloc, SafeFree wrapper NFC for release, adds some verbosity to debug printing. Motivation is to provide one place where local modifications can be made to the behaviour of all heap allocation or deallocation while debugging. Reviewers: jdoerfert, ABataev, grokos Reviewed By: ABataev Subscribers: openmp-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D69492
-rw-r--r--openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu11
1 files changed, 6 insertions, 5 deletions
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
index 5e936b01615..78b04ec5cff 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu
@@ -180,13 +180,14 @@ EXTERN void *__kmpc_data_sharing_environment_begin(
} else {
DSPRINT(DSFLAG, "Cleaning up -failed reuse - %016llx\n",
(unsigned long long)SlotP->Next);
- free(ExistingSlot);
+ SafeFree(ExistingSlot, "Failed reuse");
}
}
if (!NewSlot) {
- NewSlot = (__kmpc_data_sharing_slot *)malloc(
- sizeof(__kmpc_data_sharing_slot) + NewSize);
+ NewSlot = (__kmpc_data_sharing_slot *)SafeMalloc(
+ sizeof(__kmpc_data_sharing_slot) + NewSize,
+ "Warp master slot allocation");
DSPRINT(DSFLAG, "New slot allocated %016llx (data size=%016llx)\n",
(unsigned long long)NewSlot, NewSize);
}
@@ -205,7 +206,7 @@ EXTERN void *__kmpc_data_sharing_environment_begin(
if (SlotP->Next) {
DSPRINT(DSFLAG, "Cleaning up - old not required - %016llx\n",
(unsigned long long)SlotP->Next);
- free(SlotP->Next);
+ SafeFree(SlotP->Next, "Old slot not required");
SlotP->Next = 0;
}
@@ -243,7 +244,7 @@ EXTERN void __kmpc_data_sharing_environment_end(
: DataSharingState.SlotPtr[WID];
if (S->Next) {
- free(S->Next);
+ SafeFree(S->Next, "Sharing environment end");
S->Next = 0;
}
}
OpenPOWER on IntegriCloud