Skip to content

Conversation

@rampitec
Copy link
Collaborator

@rampitec rampitec commented Sep 6, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Sep 6, 2024

@llvm/pr-subscribers-llvm-support
@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-amdgpu

Author: Stanislav Mekhanoshin (rampitec)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/107624.diff

3 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+2-2)
  • (added) llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.err.ll (+8)
  • (modified) llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.ll (-9)
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index accc3084217f2b..27536dbcfd3a49 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -9929,9 +9929,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
     return SDValue(NewMI, 0);
   }
   case Intrinsic::amdgcn_s_prefetch_data: {
-    // For non-global address space preserve the chain and remove the call.
     if (!AMDGPU::isFlatGlobalAddrSpace(cast<MemSDNode>(Op)->getAddressSpace()))
-      return Op.getOperand(0);
+      report_fatal_error("s_prefetch_data only supports global or constant"
+                         " memory");
     return Op;
   }
   default: {
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.err.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.err.ll
new file mode 100644
index 00000000000000..d135bc49db4937
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.err.ll
@@ -0,0 +1,8 @@
+; RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 < %s 2>&1 | FileCheck --check-prefixes=GCN-ERR %s
+
+; GCN-ERR: LLVM ERROR: s_prefetch_data only supports global or constant memory
+define amdgpu_ps void @prefetch_data_sgpr_base_imm_len_local(ptr addrspace(3) inreg %ptr) {
+entry:
+  tail call void @llvm.amdgcn.s.prefetch.data.p3(ptr addrspace(3) %ptr, i32 31)
+  ret void
+}
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.ll
index 54c39d78adb583..b677f7863c14dc 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.prefetch.data.ll
@@ -110,15 +110,6 @@ entry:
   ret void
 }
 
-define amdgpu_ps void @prefetch_data_sgpr_base_imm_len_local(ptr addrspace(3) inreg %ptr) {
-; GCN-LABEL: prefetch_data_sgpr_base_imm_len_local:
-; GCN:       ; %bb.0: ; %entry
-; GCN-NEXT:    s_endpgm
-entry:
-  tail call void @llvm.amdgcn.s.prefetch.data.p3(ptr addrspace(3) %ptr, i32 31)
-  ret void
-}
-
 define amdgpu_ps void @prefetch_data_vgpr_base_imm_len(ptr addrspace(4) %ptr) {
 ; GCN-LABEL: prefetch_data_vgpr_base_imm_len:
 ; GCN:       ; %bb.0: ; %entry

@llvmbot llvmbot added the llvm:ir label Sep 9, 2024
- Using llvm/Support/AMDGPUAddrSpace.h
- Moved isFlatGlobalAddrSpace/isExtendedGlobalAddrSpace there
- Using intrinsic name in the error message
@github-actions

This comment was marked as resolved.

@rampitec rampitec merged commit d0e7714 into llvm:main Sep 13, 2024
@rampitec rampitec deleted the s_prefgetch_data_err branch September 13, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants