From e2aca270b742a76a294d48bc1adae00ae14d98a1 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Tue, 2 Mar 2021 21:38:56 -0600 Subject: [PATCH] Insert scratch memory into scratch cache on full profile systems. Scratch cache was not updated for IOMMUv2 systems previously. This both negates the cache and causes segfault during scratch release. Change-Id: I71e81d6b642d65ca135868ff7225ea173529d458 [ROCm/ROCR-Runtime commit: 191664cd2065bd14898b0f6296fd96c01919222b] --- .../hsa-runtime/core/runtime/amd_gpu_agent.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 d64f0839bc..06265bda24 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 @@ -1136,15 +1136,13 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) { assert(((!scratch.large) | use_reclaim) && "Large scratch used with reclaim disabled."); if (scratch.queue_base != nullptr) { - if (profile_ == HSA_PROFILE_FULL) return; - if (profile_ == HSA_PROFILE_BASE) { - HSAuint64 alternate_va; - if (hsaKmtMapMemoryToGPU(scratch.queue_base, scratch.size, &alternate_va) == - HSAKMT_STATUS_SUCCESS) { - if (scratch.large) scratch_used_large_ += scratch.size; - scratch_cache_.insert(scratch); - return; - } + HSAuint64 alternate_va; + if ((profile_ == HSA_PROFILE_FULL) || + (hsaKmtMapMemoryToGPU(scratch.queue_base, scratch.size, &alternate_va) == + HSAKMT_STATUS_SUCCESS)) { + if (scratch.large) scratch_used_large_ += scratch.size; + scratch_cache_.insert(scratch); + return; } }