[polly] r310340 - [NFC] [GPUJIT] Print line number & size information on allocateMemoryForDeviceCuda failure

Siddharth Bhat via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 02:03:27 PDT 2017


Author: bollu
Date: Tue Aug  8 02:03:27 2017
New Revision: 310340

URL: http://llvm.org/viewvc/llvm-project?rev=310340&view=rev
Log:
[NFC] [GPUJIT] Print line number & size information on allocateMemoryForDeviceCuda failure

- It's useful to know the amount of memory asked for since, for example,
  asking for `0` bytes of memory is illegal.

- Line number is helpful since we print the same message in the function
  at different points.

Modified:
    polly/trunk/tools/GPURuntime/GPUJIT.c

Modified: polly/trunk/tools/GPURuntime/GPUJIT.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/tools/GPURuntime/GPUJIT.c?rev=310340&r1=310339&r2=310340&view=diff
==============================================================================
--- polly/trunk/tools/GPURuntime/GPUJIT.c (original)
+++ polly/trunk/tools/GPURuntime/GPUJIT.c Tue Aug  8 02:03:27 2017
@@ -1478,12 +1478,18 @@ static PollyGPUDevicePtr *allocateMemory
 
   PollyGPUDevicePtr *DevData = malloc(sizeof(PollyGPUDevicePtr));
   if (DevData == 0) {
-    fprintf(stderr, "Allocate memory for GPU device memory pointer failed.\n");
+    fprintf(stderr,
+            "Allocate memory for GPU device memory pointer failed."
+            " Line: %d | Size: %ld\n",
+            __LINE__, MemSize);
     exit(-1);
   }
   DevData->DevicePtr = (CUDADevicePtr *)malloc(sizeof(CUDADevicePtr));
   if (DevData->DevicePtr == 0) {
-    fprintf(stderr, "Allocate memory for GPU device memory pointer failed.\n");
+    fprintf(stderr,
+            "Allocate memory for GPU device memory pointer failed."
+            " Line: %d | Size: %ld\n",
+            __LINE__, MemSize);
     exit(-1);
   }
 
@@ -1491,7 +1497,10 @@ static PollyGPUDevicePtr *allocateMemory
       CuMemAllocFcnPtr(&(((CUDADevicePtr *)DevData->DevicePtr)->Cuda), MemSize);
 
   if (Res != CUDA_SUCCESS) {
-    fprintf(stderr, "Allocate memory for GPU device memory pointer failed.\n");
+    fprintf(stderr,
+            "Allocate memory for GPU device memory pointer failed."
+            " Line: %d | Size: %ld\n",
+            __LINE__, MemSize);
     exit(-1);
   }
 




More information about the llvm-commits mailing list