[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 11:24:52 PST 2024


https://github.com/llvm-beanz commented:

I think we need to think a bit about the IR metadata in the middle of the compiler and how it will be used in various scenarios.

DXIL and SPIR-V both have branch hints that indicate to the GPU backends if a branch should be profitable to flatten or preserve.

1) We shouldn't use a DirectX-named metadata field to drive behaviors in the SPIR-V backend.
2) In the case where we load SPIR-V or DXIL into LLVM and then lower to a GPU ISA (like AMDGPU), we'll want to translate SPIR-V and DXIL's annotations into a generic LLVM annotation that backends can broadly accept. This same case comes into play if we ever support direct from HLSL -> ISA compiling where we'll want the backends to respect the metadata.
 

https://github.com/llvm/llvm-project/pull/116331


More information about the cfe-commits mailing list