SWDEV-491149 - OCL does not need to update scratch as it can't update stack size using API unlike hipDeviceSetLimit.

for HIP, Update should be only if compiler notifies use of stack size.

Change-Id: Ic781bcac6fcf586da39ec4aafd4809da3652ede3
This commit is contained in:
Jaydeep Patel
2024-10-17 08:56:31 +00:00
committed by Jaydeepkumar Patel
parent f6c8bbf4dc
commit 4aa52155ee
+6 -1
View File
@@ -2293,7 +2293,12 @@ bool Device::validateKernel(const amd::Kernel& kernel, const device::VirtualDevi
// Find the number of scratch registers used in the kernel
const device::Kernel* devKernel = kernel.getDeviceKernel(*this);
uint32_t regNum = static_cast<uint32_t>(devKernel->workGroupInfo()->scratchRegs_);
regNum = std::max<uint32_t>(static_cast<uint32_t>(stack_size_) / sizeof(uint32_t), regNum);
// OCL does not have API to set dynamic stack size i.e. hipDeviceSetLimit and hence there
// is no need for OCL to refresh value here and even for HIP, Update should be only if
// compiler notifies use of stack size.
if (IS_HIP && (devKernel->workGroupInfo()->usedStackSize_ & 0x1) == 0x1) {
regNum = std::max<uint32_t>(static_cast<uint32_t>(stack_size_) / sizeof(uint32_t), regNum);
}
const VirtualGPU* vgpu = static_cast<const VirtualGPU*>(vdev);
if (!allocScratch(regNum, vgpu, devKernel->workGroupInfo()->usedVGPRs_)) {