[PATCH] D131203: [HLSL] Initial codegen for SV_GroupIndex

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 15:35:36 PDT 2022


beanz updated this revision to Diff 451660.
beanz added a comment.

This is a fairly significant reworking of this patch to handle entry functions being called (which I hadn't anticipated). There may be some additional tweaks required, but the general flow here is:

(1) Don't prevent mangling of entry functions, this allows us to generate calls based on the mangled function name which makes things happy.
(2) Do codegen the function with parameters following the C++ codegen paths with no alterations
(3) Also generate a c-exported, unmanged, void(void) function for each entry which populates semantic arguments and calls into the mangled entry function

This solution results in code generation that covers the required cases, and the optimizer can (and will) eliminate the wrapper function in all cases that it can, and in any case that it can't the compiler will explode because recurison is not allowed in HLSL unless it can be translated to a loop by the compiler.

Fun right?

This now depends on D131625 <https://reviews.llvm.org/D131625>, which is a small change to enforce that all entry parameters have semantic annotations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131203/new/

https://reviews.llvm.org/D131203

Files:
  clang/lib/AST/Mangle.cpp
  clang/lib/CodeGen/CGHLSLRuntime.cpp
  clang/lib/CodeGen/CGHLSLRuntime.h
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/test/CodeGenHLSL/semantics/GroupIndex-codegen.hlsl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131203.451660.patch
Type: text/x-patch
Size: 4957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220810/12c4febf/attachment.bin>


More information about the cfe-commits mailing list