SWDEV-325711 - add Graph memory APIs skeleton

- hipDeviceGet/SetGraphMemAttr

- hipDeviceGraphMemTrim

- there is no memory pool for graphs currently

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I11db76ea7ea1c7732175fc93264448052357e8dc


[ROCm/clr commit: e8194dca76]
This commit is contained in:
sdashmiz
2022-04-04 16:22:16 -04:00
committed by Shadi Dashmiz
parent 2c9c07aaa8
commit 57a0d997d3
6 changed files with 142 additions and 1 deletions
+3
View File
@@ -361,6 +361,9 @@ hipGraphExecHostNodeSetParams
hipGraphExecUpdate
hipGraphInstantiateWithFlags
hipGraphExecMemsetNodeSetParams
hipDeviceGetGraphMemAttribute
hipDeviceSetGraphMemAttribute
hipDeviceGraphMemTrim
amd_dbgapi_get_build_name
amd_dbgapi_get_git_hash
amd_dbgapi_get_build_id
+53
View File
@@ -1836,3 +1836,56 @@ hipError_t hipGraphExecUpdate(hipGraphExec_t hGraphExec, hipGraph_t hGraph,
*updateResult_out = hipGraphExecUpdateSuccess;
HIP_RETURN(hipSuccess);
}
hipError_t hipDeviceGetGraphMemAttribute(int device, hipGraphMemAttributeType attr, void* value) {
HIP_INIT_API(hipDeviceGetGraphMemAttribute, device, attr, value);
if ((static_cast<size_t>(device) >= g_devices.size()) || device < 0 || value == nullptr) {
HIP_RETURN(hipErrorInvalidDevice);
}
// later use this to access memory pool
auto* deviceHandle = g_devices[device]->devices()[0];
switch (attr) {
case hipGraphMemAttrUsedMemCurrent:
*reinterpret_cast<int32_t*>(value) = 0;
break;
case hipGraphMemAttrUsedMemHigh:
*reinterpret_cast<int32_t*>(value) = 0;
break;
case hipGraphMemAttrReservedMemCurrent:
*reinterpret_cast<int32_t*>(value) = 0;
break;
case hipGraphMemAttrReservedMemHigh:
*reinterpret_cast<int32_t*>(value) = 0;
break;
default:
return HIP_RETURN(hipErrorInvalidValue);
}
return HIP_RETURN(hipSuccess);
}
hipError_t hipDeviceSetGraphMemAttribute(int device, hipGraphMemAttributeType attr, void* value) {
HIP_INIT_API(hipDeviceSetGraphMemAttribute, device, attr, value);
if ((static_cast<size_t>(device) >= g_devices.size()) || device < 0 || value == nullptr) {
HIP_RETURN(hipErrorInvalidDevice);
}
// later use this to access memory pool
auto* deviceHandle = g_devices[device]->devices()[0];
switch (attr) {
case hipGraphMemAttrUsedMemHigh:
break;
case hipGraphMemAttrReservedMemHigh:
break;
default:
return HIP_RETURN(hipErrorInvalidValue);
}
return HIP_RETURN(hipSuccess);
}
hipError_t hipDeviceGraphMemTrim(int device) {
HIP_INIT_API(hipDeviceGraphMemTrim, device);
if ((static_cast<size_t>(device) >= g_devices.size()) || device < 0) {
HIP_RETURN(hipErrorInvalidDevice);
}
// not implemented yet
return HIP_RETURN(hipSuccess);
}
+3
View File
@@ -372,6 +372,9 @@ hipGraphExecHostNodeSetParams
hipGraphExecUpdate
hipGraphInstantiateWithFlags
hipGraphExecMemsetNodeSetParams
hipDeviceGetGraphMemAttribute
hipDeviceSetGraphMemAttribute
hipDeviceGraphMemTrim
amd_dbgapi_get_build_name
amd_dbgapi_get_git_hash
amd_dbgapi_get_build_id
+3
View File
@@ -382,6 +382,9 @@ global:
hipGraphExecUpdate;
hipGraphInstantiateWithFlags;
hipGraphExecMemsetNodeSetParams;
hipDeviceGetGraphMemAttribute;
hipDeviceSetGraphMemAttribute;
hipDeviceGraphMemTrim;
amd_dbgapi_get_build_name;
amd_dbgapi_get_git_hash;
amd_dbgapi_get_build_id;