From f9edf73cd7dd9534dbc6d6c8c24536435f15ff9d Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 2 Nov 2022 07:04:30 -0400 Subject: [PATCH] Fix doorbell offset fetch for GFX11 Transient exec usage is not required for GFX11 and will result in a NULL return of s_sendmsg_rtn if directly returned to exec_lo. Directly fetch and mask the doorbell ID to ttmp3 for GFX11 instead. Change-Id: Ie17ed69d68d84ab18869b1c7871a0ed0482cd661 --- .../core/runtime/trap_handler/trap_handler.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/trap_handler/trap_handler.s b/runtime/hsa-runtime/core/runtime/trap_handler/trap_handler.s index b57f6733e7..9e1d56bd4b 100644 --- a/runtime/hsa-runtime/core/runtime/trap_handler/trap_handler.s +++ b/runtime/hsa-runtime/core/runtime/trap_handler/trap_handler.s @@ -134,24 +134,24 @@ trap_entry: s_or_b32 ttmp6, ttmp6, ttmp2 // Fetch doorbell id for our queue. +.if .amdgcn.gfx_generation_number < 11 s_mov_b32 ttmp2, exec_lo s_mov_b32 ttmp3, exec_hi -.if .amdgcn.gfx_generation_number < 11 s_mov_b32 exec_lo, 0x80000000 s_sendmsg sendmsg(MSG_GET_DOORBELL) .wait_sendmsg: s_nop 0x7 s_bitcmp0_b32 exec_lo, 0x1F s_cbranch_scc0 .wait_sendmsg -.else - s_sendmsg_rtn_b32 exec_lo, sendmsg(MSG_RTN_GET_DOORBELL) - s_waitcnt lgkmcnt(0) -.endif s_mov_b32 exec_hi, ttmp3 - // Restore exec_lo, move the doorbell_id into ttmp3 s_and_b32 ttmp3, exec_lo, DOORBELL_ID_MASK s_mov_b32 exec_lo, ttmp2 +.else + s_sendmsg_rtn_b32 ttmp3, sendmsg(MSG_RTN_GET_DOORBELL) + s_waitcnt lgkmcnt(0) + s_and_b32 ttmp3, ttmp3, DOORBELL_ID_MASK +.endif // Map trap reason to an exception code. s_getreg_b32 ttmp2, hwreg(HW_REG_TRAPSTS)