From 6015efe6f5caf8169ecd779f91cae5f0dd23c496 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Fri, 13 Dec 2019 21:38:27 -0500 Subject: [PATCH] Add comments explaining choice on the cap for system memory on Windows. [ROCm/hip commit: bf3df9d7c06428f474b9a97aa519e4bbf681c044] --- projects/hip/tests/src/runtimeApi/memory/hipMemcpy.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/hip/tests/src/runtimeApi/memory/hipMemcpy.cpp b/projects/hip/tests/src/runtimeApi/memory/hipMemcpy.cpp index 411aec3645..2d03b95e0f 100644 --- a/projects/hip/tests/src/runtimeApi/memory/hipMemcpy.cpp +++ b/projects/hip/tests/src/runtimeApi/memory/hipMemcpy.cpp @@ -292,6 +292,10 @@ void memcpytest2_get_host_memory(size_t& free, size_t& total) { MEMORYSTATUSEX status; status.dwLength = sizeof(status); GlobalMemoryStatusEx(&status); + // Windows doesn't allow allocating more than half of system memory to the gpu. + // Since the runtime also needs space for its internal allocations, + // we should not try to allocate more than 40% of reported system memory, + // otherwise we can run into OOM issues. free = static_cast(0.4 * status.ullAvailPhys); total = static_cast(0.4 * status.ullTotalPhys); }