P4 to Git Change 1989702 by gandryey@gera-win10 on 2019/08/27 11:49:38

SWDEV-200489 - [CQE OCL][QR][Windows][Vega20][19H1] Performance drop is observed while running Blender on Vega20 due to faulty CL#1981122
	- Switch scratch buffer allocation algorithm back to the optimal size calculation with sync mode. Some kernels will run slower if max scratch per queue is programmed unconditionally due to possible lower memory efficiency with fetches

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#160 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#45 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#149 edit
This commit is contained in:
foreman committed 2019-08-27 11:55:54 -04:00
1 parent 6547f9e31b
commit 07aff986ce
3 files changed
+16 -23

No files matched your search

+12 -12
View File
@@ -2426,24 +2426,16 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
return false;
}
const Device::ScratchBuffer* scratch = nullptr;
// Check if the device allocated more registers than the old setup
if (hsaKernel.workGroupInfo()->scratchRegs_ > 0) {
scratch = dev().scratch(hwRing());
addVmMemory(scratch->memObj_);
}
// Set up the dispatch information
Pal::DispatchAqlParams dispatchParam = {};
dispatchParam.pAqlPacket = aqlPkt;
if (nullptr != scratch) {
if (hsaKernel.workGroupInfo()->scratchRegs_ > 0) {
const Device::ScratchBuffer* scratch = nullptr;
scratch = dev().scratch(hwRing());
dispatchParam.scratchAddr = scratch->memObj_->vmAddress();
dispatchParam.scratchSize = scratch->size_;
dispatchParam.scratchOffset = scratch->offset_;
// Use maximum available slots for all dispatches to allow async on the same queue
// HW value loaded into SGPR is an offset value calculated as
// wave_slot * COMPUTE_TMPRING_SIZE.WAVESIZE
dispatchParam.workitemPrivateSegmentSize = std::max(hsaKernel.spillSegSize(), scratch->privateMemSize_);
dispatchParam.workitemPrivateSegmentSize = hsaKernel.spillSegSize();
}
dispatchParam.pCpuAqlCode = hsaKernel.cpuAqlCode();
dispatchParam.hsaQueueVa = hsaQueueMem_->vmAddress();
@@ -3462,6 +3454,14 @@ bool VirtualGPU::processMemObjectsHSA(const amd::Kernel& kernel, const_address p
}
addVmMemory(&hsaKernel.prog().codeSegGpu());
if (hsaKernel.workGroupInfo()->scratchRegs_ > 0) {
const Device::ScratchBuffer* scratch = dev().scratch(hwRing());
// Validate scratch buffer to force sync mode, because
// the current scratch logic is optimized for size and performance
memoryDependency().validate(*this, scratch->memObj_, IsReadOnly);
addVmMemory(scratch->memObj_);
}
return true;
}