[all-commits] [llvm/llvm-project] aced94: [SPIRV] Add support for dynamic/heap resources (#2...

Helena Kotas via All-commits all-commits at lists.llvm.org
Wed Sep 23 10:16:12 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aced9473c0493aceeab07c97db10dfbd04a667b3
      https://github.com/llvm/llvm-project/commit/aced9473c0493aceeab07c97db10dfbd04a667b3
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicsSPIRV.td
    M llvm/lib/Target/SPIRV/SPIRVLegalizeResourceBinding.cpp
    A llvm/test/CodeGen/SPIRV/hlsl-resources/HeapBinding-cvb-srv-uav.ll
    A llvm/test/CodeGen/SPIRV/hlsl-resources/HeapBinding-texture-sampler.ll
    A llvm/test/CodeGen/SPIRV/hlsl-resources/HeapBinding-uav-counter.ll
    A llvm/test/CodeGen/SPIRV/passes/SPIRVLegalizeRegisterBinding-Heap.ll
    A llvm/test/CodeGen/SPIRV/passes/SPIRVLegalizeRegisterBinding-Heap2.ll

  Log Message:
  -----------
  [SPIRV] Add support for dynamic/heap resources (#224488)

Extends the `SPIRVLegalizeImplicitBinding` pass to support heap
resources and renames it to `SPIRVLegalizeImplicitAndHeapBinding`.

The pass scans the module for calls to
`llvm.spv.resource.handlefromheap` and groups them into CBV/SRV/UAV
resources and samplers. Calls to
`llvm.spv.resource.counterhandlefromheap` form a third group.

The SPIR-V backend represents descriptor heaps as unbounded resource
arrays. After resolving implicit bindings, the pass assigns the first
available binding to each heap group in the following order: CBV/SRV/UAV
resources, samplers, and counters.

For each group, the pass will replace the heap intrinsic calls with the
explicit `llvm.spv.resource.handlefrombinding` equivalents using the
assigned binding. The pass does not actually need to create the
unbounded resource-array globals itself. It only needs to assign a
unique array name shared by all resources belonging to the same array.
The existing `SPIRVInstructionSelector` will create the globals.

Because the CBV/SRV/UAV group can contain resources with different
types, the backend represents each unique resource type with a separate
array. These arrays share the same descriptor set and binding, so their
bindings intentionally overlap.

Fixes #208054

Assisted by GPT-5.6 Sol



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list