[llvm] [AMDGPU] Remove s_set_inst_prefetch_distance support from GFX12 (PR #78786)

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 09:40:45 PST 2024


https://github.com/rampitec updated https://github.com/llvm/llvm-project/pull/78786

>From 79d25d611c23563571a64151a68a1222667dd1b7 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
Date: Fri, 19 Jan 2024 13:02:26 -0800
Subject: [PATCH 1/2] [AMDGPU] Remove s_set_inst_prefetch_distance support from
 GFX12

This instruction is not supported by GFX12.
---
 llvm/lib/Target/AMDGPU/SOPInstructions.td            | 2 +-
 llvm/test/MC/AMDGPU/gfx12_asm_sopp.s                 | 9 ---------
 llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sopp.txt | 9 ---------
 3 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td
index eae4800ade0dcef..2ce5851090ef870 100644
--- a/llvm/lib/Target/AMDGPU/SOPInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td
@@ -2618,7 +2618,7 @@ multiclass SOPP_Real_With_Relaxation_gfx11_gfx12<bits<7>op> :
 defm S_SETKILL                    : SOPP_Real_32_gfx11_gfx12<0x001>;
 defm S_SETHALT                    : SOPP_Real_32_gfx11_gfx12<0x002>;
 defm S_SLEEP                      : SOPP_Real_32_gfx11_gfx12<0x003>;
-defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11_gfx12<0x004, S_INST_PREFETCH, "s_set_inst_prefetch_distance">;
+defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11<0x004, S_INST_PREFETCH, "s_set_inst_prefetch_distance">;
 defm S_CLAUSE                     : SOPP_Real_32_gfx11_gfx12<0x005>;
 defm S_DELAY_ALU                  : SOPP_Real_32_gfx11_gfx12<0x007>;
 defm S_WAITCNT_DEPCTR             : SOPP_Real_32_gfx11<0x008>;
diff --git a/llvm/test/MC/AMDGPU/gfx12_asm_sopp.s b/llvm/test/MC/AMDGPU/gfx12_asm_sopp.s
index 41ed4de6be8a72f..f6c7c99847d6647 100644
--- a/llvm/test/MC/AMDGPU/gfx12_asm_sopp.s
+++ b/llvm/test/MC/AMDGPU/gfx12_asm_sopp.s
@@ -69,15 +69,6 @@ s_wait_alu depctr_va_sdst(3)
 s_wait_alu depctr_va_vdst(14) depctr_va_sdst(6) depctr_vm_vsrc(6)
 // GFX12: encoding: [0x9b,0xed,0x88,0xbf]
 
-s_inst_prefetch 0x1234
-// GFX12: s_set_inst_prefetch_distance 0x1234 ; encoding: [0x34,0x12,0x84,0xbf]
-
-s_set_inst_prefetch_distance 0x1234
-// GFX12: s_set_inst_prefetch_distance 0x1234 ; encoding: [0x34,0x12,0x84,0xbf]
-
-s_set_inst_prefetch_distance 0xc1d1
-// GFX12: s_set_inst_prefetch_distance 0xc1d1 ; encoding: [0xd1,0xc1,0x84,0xbf]
-
 s_singleuse_vdst 0x0000
 // GFX12: encoding: [0x00,0x00,0x93,0xbf]
 
diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sopp.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sopp.txt
index 6f4dc2423487e29..ea547fcd5d0ecf4 100644
--- a/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sopp.txt
+++ b/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sopp.txt
@@ -264,15 +264,6 @@
 # GFX12: s_sethalt 0xc1d1                        ; encoding: [0xd1,0xc1,0x82,0xbf]
 0xd1,0xc1,0x82,0xbf
 
-# GFX12: s_set_inst_prefetch_distance 0x0        ; encoding: [0x00,0x00,0x84,0xbf]
-0x00,0x00,0x84,0xbf
-
-# GFX12: s_set_inst_prefetch_distance 0x1234     ; encoding: [0x34,0x12,0x84,0xbf]
-0x34,0x12,0x84,0xbf
-
-# GFX12: s_set_inst_prefetch_distance 0xc1d1     ; encoding: [0xd1,0xc1,0x84,0xbf]
-0xd1,0xc1,0x84,0xbf
-
 # GFX12: s_setkill 0                             ; encoding: [0x00,0x00,0x81,0xbf]
 0x00,0x00,0x81,0xbf
 

>From 1d53d6cc2675d2d2596ce4982357a1b7e453a2c8 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
Date: Mon, 22 Jan 2024 09:37:33 -0800
Subject: [PATCH 2/2] Removed comment and added negative test

---
 llvm/lib/Target/AMDGPU/GCNSubtarget.h   | 2 --
 llvm/test/MC/AMDGPU/gfx12_unsupported.s | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 4886730c05c50f5..8019b98b1c68d66 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -856,8 +856,6 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
   }
 
   bool hasInstPrefetch() const {
-    // GFX12 can still encode the s_set_inst_prefetch_distance instruction but
-    // it has no effect.
     return getGeneration() == GFX10 || getGeneration() == GFX11;
   }
 
diff --git a/llvm/test/MC/AMDGPU/gfx12_unsupported.s b/llvm/test/MC/AMDGPU/gfx12_unsupported.s
index bf8f7437c042067..9d52a5dcb1a0a84 100644
--- a/llvm/test/MC/AMDGPU/gfx12_unsupported.s
+++ b/llvm/test/MC/AMDGPU/gfx12_unsupported.s
@@ -103,6 +103,9 @@ s_cmpk_lt_u32 s0, 0
 s_cmpk_le_u32 s0, 0
 // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
 
+s_inst_prefetch 1
+// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
+
 buffer_atomic_cmpswap_f32 v[5:6], off, s[96:99], s3
 // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
 



More information about the llvm-commits mailing list