HLSL Working Group

2025-07-24 - HLSL Working Group Minutes

Propose a discussion topic by making an edit suggestion on the GitHub PR.

  • Discussion topics
    • Lowering of structs to DXIL: https://github.com/llvm/llvm-project/issues/147109
      • @Icohedron: When structs contain array types or shaders are compiled with optimization level O0, the struct type remains in the IR, causing validation errors in the DirectX backend due to inserted bit casts. This issue does not occur when structs contain only scalar types, as SROA eliminates them.
      • We discussed possible approaches to perform scalarization in the backend including possibly a DX-specific scalar replacement pass.
      • @bogner noted that DXC uses an extended SROA to address this problem.
      • @llvm-beanz & @s-perron noted that SPIR-V does not have this problem since it doesn’t require scalarization.
      • Next step: @Icohedron is going to consider this as a possible bug in SROA and investigate further.
      • Olga raised a question about supporting pointers to structs. Currently this is not allowed in DXIL
        • Editor’s note: Negative or out of bounds indexing of arrays in a struct did not come up during the meeting, but (as I’m writing this) it is clearly a problem we need to define in the language spec.
        • There are no plans for native pointer support for HLSL in the forseeable future, and likely never for DXIL.
    • Bit cast restrictions
      • A related problem was discussed around restrictions for bitcasts enforced by the DXIL validator.
      • @llvm-beanz suggested maybe we should relax the validator in future shader models
    • Float Controls in older vulkan versions - https://github.com/llvm/llvm-project/issues/149561
      • Currently Clang defaults to enabling any extension that is used by the code, but for extensions like SPV_KHR_float_controls2, there is no way to signal intentional use since the same code is valid with or without the extension.
      • The current behavior introduces some challenges for deploying to older GPU drivers.
      • @llvm-beanz suggested adding a DXC compatability mode to match DXC’s extension usage making it easier for users to migrate compilers.
      • @s-perron mentioned plans to add options to match Vulkan profiles for platform-speicifc extension sets.
    • CBuffer Layout AST representation progress:
      • Justin is still working on this and expects a patch to be ready soon.
    • Shader Semantics (https://github.com/llvm/wg-hlsl/pull/296)
      • @Keenuts asked if there was any feedback.
      • The last discussions seemed to be aligned.
      • Action item: @llvm-beanz to review the proposal in @tex3d’s absence