SWDEV-493275 - Support scratch limit (#20)

Support programmatic query and change of scratch limit on
AMD devices.

Change-Id: Id5da355a77366f97868e462847f3916e87fd2af6
This commit is contained in:
Sang, Tao
2025-04-24 17:15:25 -04:00
committed by GitHub
parent 4f2a4b12a9
commit 1113eff3f9
4 changed files with 57 additions and 1 deletions
+14
View File
@@ -519,6 +519,15 @@ hipError_t hipDeviceGetLimit(size_t* pValue, hipLimit_t limit) {
case hipLimitStackSize:
*pValue = hip::getCurrentDevice()->devices()[0]->StackSize();
break;
case hipExtLimitScratchMin:
*pValue = hip::getCurrentDevice()->devices()[0]->info().scratchLimitMin;
break;
case hipExtLimitScratchMax:
*pValue = hip::getCurrentDevice()->devices()[0]->info().scratchLimitMax;;
break;
case hipExtLimitScratchCurrent:
*pValue = hip::getCurrentDevice()->devices()[0]->ScratchLimitCurrent();
break;
default:
LogPrintfError("UnsupportedLimit = %d is passed", limit);
HIP_RETURN(hipErrorUnsupportedLimit);
@@ -601,6 +610,11 @@ hipError_t hipDeviceSetLimit(hipLimit_t limit, size_t value) {
HIP_RETURN(hipErrorInvalidValue);
}
break;
case hipExtLimitScratchCurrent:
if (!hip::getCurrentDevice()->devices()[0]->UpdateScratchLimitCurrent(value)) {
HIP_RETURN(hipErrorInvalidValue);
}
break;
default:
LogPrintfError("UnsupportedLimit = %d is passed", limit);
HIP_RETURN(hipErrorUnsupportedLimit);