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);