[llvm] [AMDGPU][MC] Disable sendmsg SYSMSG_OP_HOST_TRAP_ACK on gfx9+ (PR #90203)

Emma Pilkington via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 05:44:46 PDT 2024


https://github.com/epilk created https://github.com/llvm/llvm-project/pull/90203

This is no longer supported as of gfx9. Fixes #52903

>From 1e45c40bcb1b7c38dec4b191191c4715533ec09d Mon Sep 17 00:00:00 2001
From: Emma Pilkington <emma.pilkington95 at gmail.com>
Date: Fri, 26 Apr 2024 07:55:55 -0400
Subject: [PATCH] [AMDGPU][MC] Disable sendmsg SYSMSG_OP_HOST_TRAP_ACK on gfx9+

This is no longer supported as of gfx9. Fixes #52903
---
 llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 4 +++-
 llvm/test/MC/AMDGPU/gfx9-asm-err.s              | 3 +++
 llvm/test/MC/AMDGPU/sopp-err.s                  | 4 ++++
 llvm/test/MC/AMDGPU/sopp-gfx9.s                 | 3 +++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
index 4e0074451aa58c..63b6cdec105769 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
@@ -1953,7 +1953,9 @@ bool isValidMsgOp(int64_t MsgId, int64_t OpId, const MCSubtargetInfo &STI,
     return 0 <= OpId && isUInt<OP_WIDTH_>(OpId);
 
   if (MsgId == ID_SYSMSG)
-    return OP_SYS_FIRST_ <= OpId && OpId < OP_SYS_LAST_;
+    return OP_SYS_FIRST_ <= OpId && OpId < OP_SYS_LAST_ &&
+           (!isGFX9Plus(STI) || OpId != OP_SYS_HOST_TRAP_ACK);
+
   if (!isGFX11Plus(STI)) {
     switch (MsgId) {
     case ID_GS_PreGFX11:
diff --git a/llvm/test/MC/AMDGPU/gfx9-asm-err.s b/llvm/test/MC/AMDGPU/gfx9-asm-err.s
index 93138a82918504..bb87898730c54d 100644
--- a/llvm/test/MC/AMDGPU/gfx9-asm-err.s
+++ b/llvm/test/MC/AMDGPU/gfx9-asm-err.s
@@ -41,3 +41,6 @@ global_load_dword v[2:3], off
 
 scratch_load_dword v2, off, offset:256
 // GFX9ERR: :[[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+
+s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_HOST_TRAP_ACK)
+// GFX9ERR: :[[@LINE-1]]:{{[0-9]+}}: error: invalid operation id
diff --git a/llvm/test/MC/AMDGPU/sopp-err.s b/llvm/test/MC/AMDGPU/sopp-err.s
index bd044cb7434025..b0ff379251dec4 100644
--- a/llvm/test/MC/AMDGPU/sopp-err.s
+++ b/llvm/test/MC/AMDGPU/sopp-err.s
@@ -199,6 +199,10 @@ s_sendmsg sendmsg(MSG_SYSMSG, 0)
 s_sendmsg sendmsg(MSG_SYSMSG, 5)
 // GCN: :[[@LINE-1]]:{{[0-9]+}}: error: invalid operation id
 
+s_sendmsg sendmsg(MSG_SYSMSG, SYSMSG_OP_HOST_TRAP_ACK)
+// GFX10: :[[@LINE-1]]:{{[0-9]+}}: error: invalid operation id
+// GFX11PLUS: :[[@LINE-2]]:{{[0-9]+}}: error: invalid operation id
+
 //===----------------------------------------------------------------------===//
 // waitcnt
 //===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/AMDGPU/sopp-gfx9.s b/llvm/test/MC/AMDGPU/sopp-gfx9.s
index e760d497896fa5..2ba6d0043f35e6 100644
--- a/llvm/test/MC/AMDGPU/sopp-gfx9.s
+++ b/llvm/test/MC/AMDGPU/sopp-gfx9.s
@@ -109,3 +109,6 @@ s_sendmsg 10
 
 s_sendmsg sendmsg(MSG_GET_DOORBELL)
 // GFX9: s_sendmsg sendmsg(MSG_GET_DOORBELL) ; encoding: [0x0a,0x00,0x90,0xbf]
+
+s_sendmsg sendmsg(15, 3, 0)
+// GFX9: s_sendmsg sendmsg(15, 3, 0) ; encoding: [0x3f,0x00,0x90,0xbf]



More information about the llvm-commits mailing list