From d41836a4a16d322a0b6bf3590be309fc25d52c59 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. [ROCm/clr commit: 4c6fd4e7ec6f032406ff78007e5cd47f750d6e07] --- projects/clr/hipamd/tests/src/hipPointerAttrib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/tests/src/hipPointerAttrib.cpp b/projects/clr/hipamd/tests/src/hipPointerAttrib.cpp index fdff643390..654b833be9 100644 --- a/projects/clr/hipamd/tests/src/hipPointerAttrib.cpp +++ b/projects/clr/hipamd/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); }