Add support of HIP_HIDDEN_FREE_MEM, to deduct the returned available
memory from hipMemGetInfo API, measured in MB. Change-Id: I7a8260c12e032e04e26611db4c38c893a29f2653
This commit is contained in:
+3
-2
@@ -78,6 +78,7 @@ int HIP_FORCE_P2P_HOST = 0;
|
|||||||
int HIP_FAIL_SOC = 0;
|
int HIP_FAIL_SOC = 0;
|
||||||
int HIP_DENY_PEER_ACCESS = 0;
|
int HIP_DENY_PEER_ACCESS = 0;
|
||||||
|
|
||||||
|
int HIP_HIDDEN_FREE_MEM = 0;
|
||||||
// Force async copies to actually use the synchronous copy interface.
|
// Force async copies to actually use the synchronous copy interface.
|
||||||
int HIP_FORCE_SYNC_COPY = 0;
|
int HIP_FORCE_SYNC_COPY = 0;
|
||||||
|
|
||||||
@@ -1204,8 +1205,8 @@ void HipReadEnv()
|
|||||||
tokenize(HIP_LAUNCH_BLOCKING_KERNELS, ',', &g_hipLaunchBlockingKernels);
|
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_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);
|
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<<DB_API)) && (HIP_TRACE_API == 0)) {
|
if ((HIP_DB & (1<<DB_API)) && (HIP_TRACE_API == 0)) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ extern int HIP_FORCE_P2P_HOST;
|
|||||||
|
|
||||||
extern int HIP_COHERENT_HOST_ALLOC;
|
extern int HIP_COHERENT_HOST_ALLOC;
|
||||||
|
|
||||||
|
extern int HIP_HIDDEN_FREE_MEM;
|
||||||
//---
|
//---
|
||||||
// Chicken bits for disabling functionality to work around potential issues:
|
// Chicken bits for disabling functionality to work around potential issues:
|
||||||
extern int HIP_SYNC_HOST_ALLOC;
|
extern int HIP_SYNC_HOST_ALLOC;
|
||||||
|
|||||||
@@ -1130,6 +1130,10 @@ hipError_t hipMemGetInfo (size_t *free, size_t *total)
|
|||||||
hc::am_memtracker_sizeinfo(device->_acc, &deviceMemSize, &hostMemSize, &userMemSize);
|
hc::am_memtracker_sizeinfo(device->_acc, &deviceMemSize, &hostMemSize, &userMemSize);
|
||||||
|
|
||||||
*free = device->_props.totalGlobalMem - deviceMemSize;
|
*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 {
|
else {
|
||||||
e = hipErrorInvalidValue;
|
e = hipErrorInvalidValue;
|
||||||
|
|||||||
مرجع در شماره جدید
Block a user