Add comments explaining choice on the cap for system memory on Windows.

[ROCm/hip commit: bf3df9d7c0]
这个提交包含在:
Vladislav Sytchenko 于 2019-12-13 21:38:27 -05:00 提交
1 父节点 29ca9f7d53
当前提交 6015efe6f5
1 个文件已更改
+4
@@ -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<size_t>(0.4 * status.ullAvailPhys);
total = static_cast<size_t>(0.4 * status.ullTotalPhys);
}