[all-commits] [llvm/llvm-project] 520773: [HLSL] Add resource constructor with implicit bind...

Helena Kotas via All-commits all-commits at lists.llvm.org
Wed May 14 18:41:38 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 520773b47eba0df02730b929df073e1a38474bae
      https://github.com/llvm/llvm-project/commit/520773b47eba0df02730b929df073e1a38474bae
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Sema/SemaHLSL.h
    M clang/lib/CodeGen/CGHLSLBuiltins.cpp
    M clang/lib/CodeGen/CGHLSLRuntime.h
    M clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
    M clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    M clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
    M clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
    M clang/test/AST/HLSL/TypedBuffers-AST.hlsl
    M clang/test/CodeGenHLSL/GlobalConstructorLib.hlsl
    M clang/test/CodeGenHLSL/builtins/ByteAddressBuffers-constructors.hlsl
    M clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl
    M clang/test/CodeGenHLSL/builtins/StructuredBuffers-constructors.hlsl
    M clang/test/CodeGenHLSL/static-local-ctor.hlsl
    M llvm/include/llvm/IR/IntrinsicsSPIRV.td

  Log Message:
  -----------
  [HLSL] Add resource constructor with implicit binding for global resources (#138976)

Adds constructor for resources with implicit binding and applies it to
all resources without binding at the global scope.
Adds Clang builtin function
`__builtin_hlsl_resource_handlefromimplicitbinding` that gets translated
to `llvm.dx|spv.resource.handlefromimplicitbinding` intrinsic calls.
Specific bindings are assigned in DXILResourceImplicitBinding pass.

Design proposals:

https://github.com/llvm/wg-hlsl/blob/main/proposals/0024-implicit-resource-binding.md

https://github.com/llvm/wg-hlsl/blob/main/proposals/0025-resource-constructors.md

One change from the proposals is that the `orderId` parameter is added
onto the constructor. Originally it was supposed to be generated in
codegen when the `llvm.dx|spv.resource.handlefromimplicitbinding` call
is emitted, but that is not possible because the call is inside a
constructor, and the constructor body is generated once per resource
type and not resource instance. So the only way to inject instance-based
data like `orderId` into the
`llvm.dx|spv.resource.handlefromimplicitbinding` call is that it must
come in via the constructor argument.

Closes #136784



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