From ee526f9212a26c910e699c0980d4f2bbce8bbb37 Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Thu, 30 Jul 2020 12:32:15 -0400 Subject: [PATCH] Added free device memory info Recently there were few OOM(out of Memory) issues poped. Adding trace will help know genuine OOM issue. Change-Id: Ie2a56bba95cead24caf1af5c807e73c383c2f5d9 [ROCm/clr commit: bc76760452b4b94b47a3e386debe59b68b00f5ef] --- projects/clr/hipamd/rocclr/hip_memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/clr/hipamd/rocclr/hip_memory.cpp b/projects/clr/hipamd/rocclr/hip_memory.cpp index c909928a05..c26643071c 100755 --- a/projects/clr/hipamd/rocclr/hip_memory.cpp +++ b/projects/clr/hipamd/rocclr/hip_memory.cpp @@ -122,6 +122,9 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags) *ptr = amd::SvmBuffer::malloc(*amdContext, flags, sizeBytes, amdContext->devices()[0]->info().memBaseAddrAlign_, useHostDevice ? curDevContext->svmDevices()[0] : nullptr); if (*ptr == nullptr) { + size_t free = 0, total =0; + hipMemGetInfo(&free, &total); + LogPrintfError("Allocation failed : Device memory : required :%u | free :%u | total :%u \n", sizeBytes, free, total); return hipErrorOutOfMemory; }