SWDEV-331066- Added hipDeviceSetLimit
Change-Id: I4de099387ad34ca7c195588274b546649038e2aa
Этот коммит содержится в:
@@ -395,18 +395,24 @@ hipError_t hipDeviceGetLimit ( size_t* pValue, hipLimit_t limit ) {
|
||||
|
||||
HIP_INIT_API(hipDeviceGetLimit, pValue, limit);
|
||||
|
||||
if(pValue == nullptr) {
|
||||
if (pValue == nullptr || limit >= hipLimitRange) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if(limit == hipLimitMallocHeapSize) {
|
||||
hipDeviceProp_t prop;
|
||||
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, ihipGetDevice()));
|
||||
|
||||
*pValue = prop.totalGlobalMem;
|
||||
HIP_RETURN(hipSuccess);
|
||||
} else {
|
||||
HIP_RETURN(hipErrorUnsupportedLimit);
|
||||
switch (limit) {
|
||||
case hipLimitMallocHeapSize:
|
||||
hipDeviceProp_t prop;
|
||||
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, ihipGetDevice()));
|
||||
*pValue = prop.totalGlobalMem;
|
||||
break;
|
||||
case hipLimitStackSize:
|
||||
*pValue = hip::getCurrentDevice()->devices()[0]->StackSize();
|
||||
break;
|
||||
default:
|
||||
LogPrintfError("UnsupportedLimit = %d is passed", limit);
|
||||
HIP_RETURN(hipErrorUnsupportedLimit);
|
||||
}
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
hipError_t hipDeviceGetPCIBusId ( char* pciBusId, int len, int device ) {
|
||||
@@ -463,7 +469,22 @@ hipError_t hipDeviceSetCacheConfig ( hipFuncCache_t cacheConfig ) {
|
||||
}
|
||||
|
||||
hipError_t hipDeviceSetLimit ( hipLimit_t limit, size_t value ) {
|
||||
HIP_RETURN(hipErrorNotSupported);
|
||||
HIP_INIT_API(hipDeviceSetLimit, limit, value);
|
||||
if (limit >= hipLimitRange) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
switch(limit) {
|
||||
case hipLimitStackSize :
|
||||
// need to query device size and take action
|
||||
if (!hip::getCurrentDevice()->devices()[0]->UpdateStackSize(value)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LogPrintfError("UnsupportedLimit = %d is passed", limit);
|
||||
HIP_RETURN(hipErrorUnsupportedLimit);
|
||||
}
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
hipError_t hipDeviceSetSharedMemConfig ( hipSharedMemConfig config ) {
|
||||
|
||||
Ссылка в новой задаче
Block a user