[PATCH] D134326: [HLSL] Allow SV_GroupIndex for lib profile.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 16:45:18 PDT 2022


python3kgae created this revision.
python3kgae added reviewers: beanz, pow2clk, bogner, bob80905.
Herald added subscribers: Anastasia, arphaman.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Lib profile could include all kind of entry functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134326

Files:
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGenHLSL/GlobalDestructors.hlsl


Index: clang/test/CodeGenHLSL/GlobalDestructors.hlsl
===================================================================
--- clang/test/CodeGenHLSL/GlobalDestructors.hlsl
+++ clang/test/CodeGenHLSL/GlobalDestructors.hlsl
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s 
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CHECK
 
 struct Tail {
   Tail() {
Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -6895,7 +6895,10 @@
 static void handleHLSLSVGroupIndexAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   using llvm::Triple;
   Triple Target = S.Context.getTargetInfo().getTriple();
-  if (Target.getEnvironment() != Triple::Compute) {
+  if (Target.getEnvironment() != Triple::Compute &&
+      Target.getEnvironment() != Triple::Library) {
+    // FIXME: it is OK for a compute shader entry and pixel shader entry live in
+    // same HLSL file.
     uint32_t Pipeline =
         (uint32_t)S.Context.getTargetInfo().getTriple().getEnvironment() -
         (uint32_t)llvm::Triple::Pixel;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134326.461756.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220920/88f6eac4/attachment.bin>


More information about the cfe-commits mailing list