From 95e1c8eb3215d0da05b133fe1558c772b5ef3e2b Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Sat, 19 Mar 2016 04:11:39 -0500 Subject: [PATCH] Fix bug: test was allocating host mem instead of device mem. Caused assertion when checking free + allocated should not exceed total. Bug introduced in hipHostAlloc conversion. --- tests/src/hipPointerAttrib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/hipPointerAttrib.cpp b/tests/src/hipPointerAttrib.cpp index fdff643390..654b833be9 100644 --- a/tests/src/hipPointerAttrib.cpp +++ b/tests/src/hipPointerAttrib.cpp @@ -277,7 +277,7 @@ void clusterAllocs(int numAllocs, size_t minSize, size_t maxSize) void * ptr; if (isDevice) { totalDeviceAllocated[reference[i]._attrib.device] += reference[i]._sizeBytes; - HIPCHECK(hipHostAlloc((void**)&ptr, reference[i]._sizeBytes, hipHostAllocDefault)); + HIPCHECK(hipMalloc((void**)&ptr, reference[i]._sizeBytes)); reference[i]._attrib.memoryType = hipMemoryTypeDevice; reference[i]._attrib.devicePointer = ptr; reference[i]._attrib.hostPointer = NULL; @@ -304,7 +304,7 @@ void clusterAllocs(int numAllocs, size_t minSize, size_t maxSize) size_t free, total; HIPCHECK(hipSetDevice(i)); HIPCHECK(hipMemGetInfo(&free, &total)); - printf (" device#%d: hipMemGetInfo: free=%zu (%4.2fMB) clusterAllocTotalDevice=%lu (%4.2fMB) total=%zu (%4.2fMB)\n", + printf (" device#%d: hipMemGetInfo: free=%zu (%4.2fMB) totalDevice=%lu (%4.2fMB) total=%zu (%4.2fMB)\n", i, free, (float)(free/1024.0/1024.0), totalDeviceAllocated[i], (float)(totalDeviceAllocated[i])/1024.0/1024.0, total, (float)(total/1024.0/1024.0)); HIPASSERT(free + totalDeviceAllocated[i] <= total); }