[llvm] r251858 - AMDGPU: Error on graphics shaders with HSA

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 15:23:03 PST 2015


Author: arsenm
Date: Mon Nov  2 17:23:02 2015
New Revision: 251858

URL: http://llvm.org/viewvc/llvm-project?rev=251858&view=rev
Log:
AMDGPU: Error on graphics shaders with HSA

I've found myself pointlessly debugging problems from running
graphics tests with an HSA triple a few times, so stop this from
happening again.

Added:
    llvm/trunk/test/CodeGen/AMDGPU/no-hsa-graphics-shaders.ll
Modified:
    llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=251858&r1=251857&r2=251858&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Mon Nov  2 17:23:02 2015
@@ -20,6 +20,7 @@
 
 #include "SIISelLowering.h"
 #include "AMDGPU.h"
+#include "AMDGPUDiagnosticInfoUnsupported.h"
 #include "AMDGPUIntrinsicInfo.h"
 #include "AMDGPUSubtarget.h"
 #include "SIInstrInfo.h"
@@ -510,6 +511,13 @@ SDValue SITargetLowering::LowerFormalArg
   FunctionType *FType = MF.getFunction()->getFunctionType();
   SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
 
+  if (Subtarget->isAmdHsaOS() && Info->getShaderType() != ShaderType::COMPUTE) {
+    const Function *Fn = MF.getFunction();
+    DiagnosticInfoUnsupported NoGraphicsHSA(*Fn, "non-compute shaders with HSA");
+    DAG.getContext()->diagnose(NoGraphicsHSA);
+    return SDValue();
+  }
+
   // FIXME: We currently assume all calling conventions are kernels.
 
   SmallVector<ISD::InputArg, 16> Splits;

Added: llvm/trunk/test/CodeGen/AMDGPU/no-hsa-graphics-shaders.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/no-hsa-graphics-shaders.ll?rev=251858&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/no-hsa-graphics-shaders.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/no-hsa-graphics-shaders.ll Mon Nov  2 17:23:02 2015
@@ -0,0 +1,18 @@
+; RUN: not llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa < %s 2>&1 | FileCheck %s
+
+; CHECK: error: unsupported non-compute shaders with HSA in pixel_shader
+define void @pixel_shader() #0 {
+  ret void
+}
+
+define void @vertex_shader() #1 {
+  ret void
+}
+
+define void @geometry_shader() #2 {
+  ret void
+}
+
+attributes #0 = { nounwind "ShaderType"="0" }
+attributes #1 = { nounwind "ShaderType"="1" }
+attributes #2 = { nounwind "ShaderType"="2" }




More information about the llvm-commits mailing list