SWDEV-269400 - handle nullptr in hipFuncGetAttributes and blockSizeLimit<0 in hipModuleOccupancyMaxPotentialBlockSize

Change-Id: Ia1c6e5713f40876b4a9c7a1c56b7b3a589c4497a


[ROCm/clr commit: 160f0edffa]
This commit is contained in:
agodavar
2021-01-27 10:48:16 -05:00
committed by Anusha Godavarthy Surya
parent 3cd436f7a4
commit 4017a88253
+5 -2
View File
@@ -298,7 +298,7 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(
const device::Kernel::WorkGroupInfo* wrkGrpInfo = kernel.getDeviceKernel(device)->workGroupInfo();
if (bCalcPotentialBlkSz == false) {
if (inputBlockSize == 0) {
if (inputBlockSize <= 0) {
return hipErrorInvalidValue;
}
*bestBlockSize = 0;
@@ -311,7 +311,7 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(
}
else {
if (inputBlockSize > int(device.info().maxWorkGroupSize_) ||
inputBlockSize == 0) {
inputBlockSize <= 0) {
// The user wrote the kernel to work with a workgroup size
// bigger than this hardware can support. Or they do not care
// about the size So just assume its maximum size is
@@ -858,6 +858,9 @@ hipError_t PlatformState::getStatFunc(hipFunction_t* hfunc, const void* hostFunc
}
hipError_t PlatformState::getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId) {
if(func_attr == nullptr || hostFunction == nullptr) {
return hipErrorInvalidValue;
}
return statCO_.getStatFuncAttr(func_attr, hostFunction, deviceId);
}