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
2019-08-27 11:55:54 -04:00
parent 6547f9e31b
commit 07aff986ce
3 changed files with 16 additions and 23 deletions
+3 -8
View File
@@ -1994,8 +1994,9 @@ bool Device::allocScratch(uint regNum, const VirtualGPU* vgpu, uint vgprs) {
regNum = threadSizeLimit;
}
// The algorithm below attempts to keep max possible size to allow concurrent execution,
// where the scratch offset will be kept constant - wave_slot * COMPUTE_TMPRING_SIZE.WAVESIZE
// The algorithm below finds the most optimal size for the current execution.
// PAL reprograms COMPUTE_TMPRING_SIZE.WAVESIZE and COMPUTE_TMPRING_SIZE.WAVES on
// every dispatch and sync mode is enabled in runtime
// Calculate the size of the scratch buffer for a queue
uint32_t numTotalCUs = properties().gfxipProperties.shaderCore.numAvailableCus;
@@ -2005,12 +2006,8 @@ bool Device::allocScratch(uint regNum, const VirtualGPU* vgpu, uint vgprs) {
numMaxWaves *= properties().gfxipProperties.shaderCore.numSimdsPerCu;
// Find max waves per device
numMaxWaves = std::min(settings().numScratchWavesPerCu_, numMaxWaves);
// Find max between current alloc and the new limit
numMaxWaves = std::max(numMaxWaves, scratch_[sb]->numMaxWaves_);
// Current private mem size
uint32_t privateMemSize = regNum * sizeof(uint32_t);
// Max between the allocation and current
privateMemSize = std::max(privateMemSize, scratch_[sb]->privateMemSize_);
uint64_t newSize =
static_cast<uint64_t>(info().wavefrontWidth_) * privateMemSize * numMaxWaves * numTotalCUs;
@@ -2035,8 +2032,6 @@ bool Device::allocScratch(uint regNum, const VirtualGPU* vgpu, uint vgprs) {
scratchBuf->size_ = std::min(newSize, uint64_t(3 * Gi));
// Note: Generic address space setup in HW requires 64KB alignment for scratch
scratchBuf->size_ = amd::alignUp(newSize, 64 * Ki);
scratchBuf->privateMemSize_ = privateMemSize;
scratchBuf->numMaxWaves_ = numMaxWaves;
}
scratchBuf->offset_ = offset;
size += scratchBuf->size_;