From 9c6f904413928ea7f63dad3ecf619e0696108049 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Wed, 4 Sep 2019 19:46:41 -0500 Subject: [PATCH] Correct doorbell_queue_map allocation. doorbell_queue_map should always be allocated or we will need to add branches around all accesses. Change-Id: I994c0eaf4be62c1a4a37bd06894272dba1fc1da6 [ROCm/ROCR-Runtime commit: f9d3796db8a77dbc51e98b43eaa1238be01c7ce9] --- .../core/runtime/amd_gpu_agent.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 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 1401ff1f94..8ac921b824 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 @@ -1149,19 +1149,6 @@ void GpuAgent::SyncClocks() { } void GpuAgent::BindTrapHandler() { - if (isa_->GetMajorVersion() == 7) { - // No trap handler support on Gfx7, soft error. - return; - } - - // Disable trap handler on Carrizo until KFD is fixed. - if (profile_ == HSA_PROFILE_FULL) { - return; - } - - // Assemble the trap handler source code. - AssembleShader("TrapHandler", AssembleTarget::ISA, trap_code_buf_, trap_code_buf_size_); - // Make an empty map from doorbell index to queue. // The trap handler uses this to retrieve a wave's amd_queue_t*. auto doorbell_queue_map_size = MAX_NUM_DOORBELLS * sizeof(amd_queue_t*); @@ -1172,6 +1159,19 @@ void GpuAgent::BindTrapHandler() { memset(doorbell_queue_map_, 0, doorbell_queue_map_size); + if (isa_->GetMajorVersion() == 7) { + // No trap handler support on Gfx7, soft error. + return; + } + + // Disable trap handler on APUs until KFD is fixed. + if (profile_ == HSA_PROFILE_FULL) { + return; + } + + // Assemble the trap handler source code. + AssembleShader("TrapHandler", AssembleTarget::ISA, trap_code_buf_, trap_code_buf_size_); + // Bind the trap handler to this node. HSAKMT_STATUS err = hsaKmtSetTrapHandler(node_id(), trap_code_buf_, trap_code_buf_size_, doorbell_queue_map_, doorbell_queue_map_size);