SWDEV-408283 - Sync scratchRegs_, privateMemSize_ and workitemPrivateSegmentSize.

Change-Id: I623a7140810ff9867f8816bf4c8621a1fe921744


[ROCm/clr commit: ff1a999f66]
This commit is contained in:
Jaydeep Patel
2023-07-25 18:45:03 +00:00
committed by Jaydeepkumar Patel
parent 2b78a9c443
commit 1d785911ed
2 changed files with 6 additions and 7 deletions
@@ -552,6 +552,12 @@ bool LightningKernel::postLoad() {
if (workGroupInfo_.size_ == 0) {
return false;
}
if ((workGroupInfo_.usedStackSize_ & 0x1) == 0x1) {
workGroupInfo_.scratchRegs_ =
std::max<uint32_t>(device().StackSize(), workGroupInfo_.scratchRegs_ * sizeof(uint32_t)) ;
workGroupInfo_.scratchRegs_ = amd::alignUp(workGroupInfo_.scratchRegs_, 16) / sizeof(uint32_t);
workGroupInfo_.privateMemSize_ = workGroupInfo_.scratchRegs_ * sizeof(uint32_t);
}
// handle the printf metadata if any
std::vector<std::string> printfStr;
@@ -2678,13 +2678,6 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
dispatchParam.scratchSize = scratch->size_;
dispatchParam.scratchOffset = scratch->offset_;
dispatchParam.workitemPrivateSegmentSize = hsaKernel.spillSegSize();
if ((hsaKernel.workGroupInfo()->usedStackSize_ & 0x1) == 0x1) {
dispatchParam.workitemPrivateSegmentSize =
std::max<uint64_t>(dev().StackSize(), dispatchParam.workitemPrivateSegmentSize);
if (dispatchParam.workitemPrivateSegmentSize > 16 * Ki) {
dispatchParam.workitemPrivateSegmentSize = 16 * Ki;
}
}
}
dispatchParam.pCpuAqlCode = hsaKernel.cpuAqlCode();
dispatchParam.hsaQueueVa = hsaQueueMem_->vmAddress();