From ef38e563baa514e0f7d9f46ef2e2c3cf442bdb3a Mon Sep 17 00:00:00 2001 From: hthangir Date: Tue, 18 Apr 2017 22:37:56 -0500 Subject: [PATCH] On GFX9+ amd_queue_t.scratch_backing_memory_location must store the queue's scratch backing store VA, not the offset. Also fix permission in couple files. Change-Id: I4203f8e5a36406b20562d8943ea5c341847f039a [ROCm/ROCR-Runtime commit: 8aa19388a94451b01f4f90cd8621e66527ff07b2] --- .../hsa-runtime/core/runtime/amd_cpu_agent.cpp | 0 .../hsa-runtime/core/runtime/amd_gpu_agent.cpp | 11 +++++++++-- .../runtime/hsa-runtime/core/runtime/runtime.cpp | 0 3 files changed, 9 insertions(+), 2 deletions(-) mode change 100755 => 100644 projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp mode change 100755 => 100644 projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp mode change 100755 => 100644 projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index 13097f2744..08ea936a50 --- 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 @@ -936,6 +936,8 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, } void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) { + bool need_queue_scratch_base = (isa_->GetMajorVersion() > 8); + if (scratch.size == 0) { scratch.size = queue_scratch_len_; scratch.size_per_thread = scratch_per_thread_; @@ -943,7 +945,10 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) { ScopedAcquire lock(&scratch_lock_); scratch.queue_base = scratch_pool_.alloc(scratch.size); - scratch.queue_process_offset = uintptr_t(scratch.queue_base) - uintptr_t(scratch_pool_.base()); + scratch.queue_process_offset = + (need_queue_scratch_base) + ? uintptr_t(scratch.queue_base) + : uintptr_t(scratch.queue_base) - uintptr_t(scratch_pool_.base()); if (scratch.queue_base != NULL) { if (profile_ == HSA_PROFILE_FULL) return; @@ -981,7 +986,9 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) { scratch.queue_base = base; scratch.size = size; scratch.queue_process_offset = - uintptr_t(scratch.queue_base) - uintptr_t(scratch_pool_.base()); + (need_queue_scratch_base) + ? uintptr_t(scratch.queue_base) + : uintptr_t(scratch.queue_base) - uintptr_t(scratch_pool_.base()); return; } scratch_pool_.free(base); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp old mode 100755 new mode 100644