HLSL Working Group

2026-07-02 - HLSL Working Group Minutes

Discussion Topics

Meeting Notes

SPIR-V Matrix Legalization Strategies

We discussed llvm/wg-hlsl#446, which proposes a new way to handle legalization of matrices for SPIR-V. The existing approach tries to expand the vector-representation of a matrix into powers of two and then split into 4-length vectors, whereas the new approach would use a largest common divisor between the source and destination. It was generally agreed that the new approach sounds like an improvement.

This Week in HLSL

32 PRs were merged this week across several areas:

  • HLSL Frontend
    • ConstantBuffer<T> copying, conversion, and method support.
    • Implemented Texture2DArray support.
  • DirectX Backend
    • Added DXContainer ObjectYAML PRIV part support.
    • Bug fixes regarding code motion of resource pointers.
    • Widened i1 indexable temps to i32 in DXILDataScalarization.
  • HLSL/DXIL Builtins
    • Implemented InterlockedOr and InterlockedOr64 builtins.
  • SPIR-V Backend
    • Multiple improvements to lowering and legalization.
  • Offload Test Suite
    • New tests in the Matrix and ConstantBuffer areas.
    • Further code cleanup to consolidate backend logic.
    • Raytracing improvements for Metal.
    • VK- and DX-only test tags for CI.
    • Fixed issues with stale tests being run.

For a full list of merged PRs, see the appendix.

There are 11 newly opened PRs and 54 currently ongoing PRs.

Appendix: Merged PRs

HLSL Frontend

  • [HLSL] Implement codegen for copying cbuffer structs with resources (llvm/llvm-project#204232)
  • [HLSL] Enable conversion of ConstantBuffer to T (llvm/llvm-project#205996)
  • [HLSL] Enable invoking a method on a constant buffer struct (llvm/llvm-project#206596)
  • [HLSL] Implement Texture2DArray for HLSL (llvm/llvm-project#203951)

DirectX Backend

  • [DirectX][ObjectYAML] Add PRIV part support (llvm/llvm-project#204899)
  • [DirectX][ObjectYAML] Attempt to fix flaky PRIVPart.yaml (llvm/llvm-project#206278)
  • [DirectX][SPIRV] Consolidate the use of resource pointers across backends (llvm/llvm-project#205433)
  • [DirectX] Widen i1 indexable temps to i32 in DXILDataScalarization (llvm/llvm-project#205444)

HLSL/DXIL Builtins

  • [HLSL][DXIL] InterlockedOr and InterlockedOr64 builtins (llvm/llvm-project#180804)

SPIR-V Backend

  • [SPIR-V] Avoid typed pointers for global variables (llvm/llvm-project#201203)
  • [SPIR-V] Support bfloat and double in parseTypeString (llvm/llvm-project#201919)
  • [SPIRV] Emit NonSemantic DebugFunctionDeclaration for DISubprograms (declarations) (llvm/llvm-project#203615)
  • [SPIR-V] Fix correction shift for i8 bitreverse in shader mode (llvm/llvm-project#203829)
  • [SPIR-V] Propagate intrinsic param attributes to generated helper functions (llvm/llvm-project#206061)
  • [SPIR-V] Reuse getIConstVal instead of custom one where applicable (NFC) (llvm/llvm-project#206131)
  • [SPIR-V] Allow FPFastMathMode decoration on OpFmaKHR (llvm/llvm-project#206143)
  • [SPIR-V] Allow NoUnsignedWrap decoration on OpShiftLeftLogical (llvm/llvm-project#206155)
  • [SPIR-V] Add –spirv-fp-contract option to control kernel ContractionOff emission (llvm/llvm-project#206404)
  • [SPIR-V] Extend runLowerI1Comparisons to cover vector i1 types (llvm/llvm-project#206409)
  • [SPIR-V] Fix removeCapabilityIf not pruning MinimalCaps (llvm/llvm-project#206478)
  • [SPIR-V] Lower G_SSHLSAT and G_USHLSAT (llvm/llvm-project#206490)
  • [SPIR-V] Lower G_SMULFIX and G_UMULFIX (llvm/llvm-project#206507)
  • [SPIR-V] Use llvm STLExtras range algorithms (NFC) (llvm/llvm-project#206969)
  • [SPIR-V] Use MathExtras helpers for bit arithmetic (NFC) (llvm/llvm-project#206968)

Offload Test Suite

  • [Matrix] Add boolean operator tests (llvm/offload-test-suite#1054)
  • [CI] Add a VK and DX only test all tag (llvm/offload-test-suite#1329)
  • Move resource creation, readbacks, and InvocationState from DX backend to shared file (llvm/offload-test-suite#1330)
  • [SplitBuild] Remove persistent install / dxc-dist directories (llvm/offload-test-suite#1336)
  • [Intel][Texture2D] Enable SRV to UAV tests (llvm/offload-test-suite#1342)
  • [Build] Update stale reference to abstract data type, fixing build errors (llvm/offload-test-suite#1344)
  • [Metal] Make dispatchRays a self-contained encoder operation (llvm/offload-test-suite#1346)
  • Add a few tests for ConstantBuffer (llvm/offload-test-suite#1348)