From 7e0a5f9c00628fa44e7f25da021afe200aa7889e Mon Sep 17 00:00:00 2001 From: Jay Cornwall Date: Mon, 30 Jan 2017 16:36:28 -0600 Subject: [PATCH] Add support for gfx900 - Route AQL doorbell directly to HW doorbell - Reuse precompiled Gfx8 shaders on Gfx9 (ISA is compatible) - Add a warning for unimplemented code cache invalidation Change-Id: I92096584a1404e35779c96ae6bdc3e0e7fd04721 --- runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp | 6 ++++++ runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 1d1633f66e..6ca1ccfba0 100644 --- a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -370,6 +370,12 @@ uint64_t AqlQueue::AddWriteIndexRelease(uint64_t value) { } void AqlQueue::StoreRelaxed(hsa_signal_value_t value) { + if (doorbell_type_ == 2) { + // Hardware doorbell supports AQL semantics. + atomic::Store(signal_.hardware_doorbell_ptr, uint64_t(value), std::memory_order_release); + return; + } + // Acquire spinlock protecting the legacy doorbell. while (atomic::Cas(&amd_queue_.legacy_doorbell_lock, 1U, 0U, std::memory_order_acquire) != 0) { diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 140e37c989..cea5d8c7e3 100755 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -201,6 +201,7 @@ void GpuAgent::AssembleShader(const char* src_sp3, const char* func_name, asic_shader = &compiled_shader_it->second.compute_7; break; case 8: + case 9: // ISA-compatible with 8 asic_shader = &compiled_shader_it->second.compute_8; break; default: @@ -1176,6 +1177,12 @@ void GpuAgent::InvalidateCodeCaches() { // Microcode is handling code cache invalidation. return; } + } else if (isa_->GetMajorVersion() == 9) { + static std::once_flag once; + std::call_once(once, []() { + fprintf(stderr, "warning: code cache invalidation not implemented\n"); + }); + return; } else { assert(false && "Code cache invalidation not implemented for this agent"); }