diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 061714070e..364db80537 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -78,6 +78,7 @@ int HIP_FORCE_P2P_HOST = 0; int HIP_FAIL_SOC = 0; int HIP_DENY_PEER_ACCESS = 0; +int HIP_HIDDEN_FREE_MEM = 0; // Force async copies to actually use the synchronous copy interface. int HIP_FORCE_SYNC_COPY = 0; @@ -1204,8 +1205,8 @@ void HipReadEnv() tokenize(HIP_LAUNCH_BLOCKING_KERNELS, ',', &g_hipLaunchBlockingKernels); } READ_ENV_I(release, HIP_API_BLOCKING, 0, "Make HIP APIs 'host-synchronous', so they block until completed. Impacts hipMemcpyAsync, hipMemsetAsync." ); - - + + READ_ENV_I(release, HIP_HIDDEN_FREE_MEM, 0, "Amount of memory to hide from the free memory reported by hipMemGetInfo, specified in MB. Impacts hipMemGetInfo." ); READ_ENV_C(release, HIP_DB, 0, "Print debug info. Bitmask (HIP_DB=0xff) or flags separated by '+' (HIP_DB=api+sync+mem+copy)", HIP_DB_callback); if ((HIP_DB & (1<_acc, &deviceMemSize, &hostMemSize, &userMemSize); *free = device->_props.totalGlobalMem - deviceMemSize; + + // Deduct the amount of memory from the free memory reported from the system + if(HIP_HIDDEN_FREE_MEM) + *free -= (size_t)HIP_HIDDEN_FREE_MEM*1024*1024; } else { e = hipErrorInvalidValue;