[llvm] 6f23116 - [SPIR-V] Add Vertex execution model (#142369)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 05:48:29 PDT 2025


Author: Nathan Gauër
Date: 2025-06-10T14:48:25+02:00
New Revision: 6f231165072ec8a4f725056c6deccce3c1a21f09

URL: https://github.com/llvm/llvm-project/commit/6f231165072ec8a4f725056c6deccce3c1a21f09
DIFF: https://github.com/llvm/llvm-project/commit/6f231165072ec8a4f725056c6deccce3c1a21f09.diff

LOG: [SPIR-V] Add Vertex execution model (#142369)

Adds backend handling of the vertex shader type compiling from HLSL.

Fixes #136961

Added: 
    llvm/test/CodeGen/SPIRV/ExecutionMode_Vertex.ll

Modified: 
    llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp b/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
index 17be86db54062..98d3720df9361 100644
--- a/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
@@ -280,6 +280,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
     const auto value = attribute.getValueAsString();
     if (value == "compute")
       return SPIRV::ExecutionModel::GLCompute;
+    if (value == "vertex")
+      return SPIRV::ExecutionModel::Vertex;
 
     report_fatal_error(
         "This HLSL entry point is not supported by this backend.");
@@ -302,6 +304,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
   const auto value = attribute.getValueAsString();
   if (value == "compute")
     return SPIRV::ExecutionModel::GLCompute;
+  if (value == "vertex")
+    return SPIRV::ExecutionModel::Vertex;
 
   report_fatal_error("This HLSL entry point is not supported by this backend.");
 }

diff  --git a/llvm/test/CodeGen/SPIRV/ExecutionMode_Vertex.ll b/llvm/test/CodeGen/SPIRV/ExecutionMode_Vertex.ll
new file mode 100644
index 0000000000000..e93e7a9c302e2
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/ExecutionMode_Vertex.ll
@@ -0,0 +1,12 @@
+; RUN: llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}
+
+; CHECK: OpCapability Shader
+; CHECK: OpEntryPoint Vertex %[[#entry:]] "main"
+
+define void @main() #1 {
+entry:
+  ret void
+}
+
+attributes #1 = { "hlsl.shader"="vertex" }


        


More information about the llvm-commits mailing list