From dec51d2db43c4f91a882c4deadf981b1443e8583 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 27 Apr 2018 18:42:02 -0500 Subject: [PATCH] Relax large scratch cutoff. Optimize for few queues rather than max. Change-Id: I6531427319d3b2109b70d98fdb51daee7ffe4403 [ROCm/ROCR-Runtime commit: a20cceb4258b8d9f020e06512c950f4d2f772051] --- .../runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 3ae2640e4f..68d5ca5aea 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -974,8 +974,11 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) { scratch.retry = false; ScopedAcquire lock(&scratch_lock_); - bool large = (scratch.size > 6 * 1024 * 1024) || - (scratch_pool_.size() - scratch_pool_.remaining() > 24 * 6 * 1024 * 1024); + // Limit to 1/8th of scratch pool for small scratch and 1/4 of that for a single queue. + size_t small_limit = scratch_pool_.size() >> 3; + size_t single_limit = small_limit >> 2; + bool large = (scratch.size > single_limit) || + (scratch_pool_.size() - scratch_pool_.remaining() + scratch.size > small_limit); large = (isa_->GetMajorVersion() < 8) ? false : large; if (large) scratch.queue_base = scratch_pool_.alloc_high(scratch.size);