[llvm] [AMDGPU][Disassembler] Use target feature for `.amdhsa_reserve_xnack_mask` instead of hard code zero (PR #161771)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 20:38:14 PDT 2025


https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/161771

There is no test change at this moment because we don't have a target that has this feature by default yet.

>From 7ad7712f419543f7a9f8ae26de7c4fc56b3d7d2a Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Thu, 2 Oct 2025 23:36:46 -0400
Subject: [PATCH] [AMDGPU][Disassembler] Use target feature for
 `.amdhsa_reserve_xnack_mask` instead of hard code zero

There is no test change at this moment because we don't have a target that has this feature by default yet.
---
 llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
index 2d5ae29c1037c..3d86e41e9e1b7 100644
--- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
@@ -2303,7 +2303,12 @@ Expected<bool> AMDGPUDisassembler::decodeCOMPUTE_PGM_RSRC1(
   KdStream << Indent << ".amdhsa_reserve_vcc " << 0 << '\n';
   if (!hasArchitectedFlatScratch())
     KdStream << Indent << ".amdhsa_reserve_flat_scratch " << 0 << '\n';
-  KdStream << Indent << ".amdhsa_reserve_xnack_mask " << 0 << '\n';
+  bool ReservedXnackMask = STI.hasFeature(AMDGPU::FeatureXNACK);
+#ifndef NDEBUG
+  assert(!ReservedXnackMask || STI.hasFeature(AMDGPU::FeatureSupportsXNACK));
+#endif
+  KdStream << Indent << ".amdhsa_reserve_xnack_mask " << ReservedXnackMask
+           << '\n';
   KdStream << Indent << ".amdhsa_next_free_sgpr " << NextFreeSGPR << "\n";
 
   CHECK_RESERVED_BITS(COMPUTE_PGM_RSRC1_PRIORITY);



More information about the llvm-commits mailing list