[all-commits] [llvm/llvm-project] ad4911: [HLSL][DirectX] Add support for `rootsig` as a tar...

Finn Plummer via All-commits all-commits at lists.llvm.org
Tue Sep 9 08:15:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad491118df1304c7d6bcce5b2207895f57204c16
      https://github.com/llvm/llvm-project/commit/ad491118df1304c7d6bcce5b2207895f57204c16
  Author: Finn Plummer <mail at inbelic.dev>
  Date:   2025-09-09 (Tue, 09 Sep 2025)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Parse/ParseHLSLRootSignature.h
    M clang/include/clang/Sema/SemaHLSL.h
    M clang/lib/CodeGen/CGHLSLRuntime.cpp
    M clang/lib/CodeGen/CGHLSLRuntime.h
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/HLSL.cpp
    M clang/lib/Frontend/FrontendActions.cpp
    M clang/lib/Parse/ParseHLSLRootSignature.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    A clang/test/AST/HLSL/RootSignature-Target-AST.hlsl
    A clang/test/CodeGenHLSL/RootSignature-Target.hlsl
    A clang/test/Driver/dxc_rootsignature_target.hlsl
    A clang/test/SemaHLSL/RootSignature-target-err.hlsl
    M llvm/include/llvm/BinaryFormat/DXContainer.h
    M llvm/include/llvm/TargetParser/Triple.h
    M llvm/lib/Target/DirectX/DXContainerGlobals.cpp
    M llvm/lib/Target/DirectX/DXILRootSignature.cpp
    M llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp
    M llvm/lib/TargetParser/Triple.cpp
    A llvm/test/CodeGen/DirectX/ContainerData/RootSignature-Target.ll
    M llvm/unittests/TargetParser/TripleTest.cpp

  Log Message:
  -----------
  [HLSL][DirectX] Add support for `rootsig` as a target environment (#156373)

This pr implements support for a root signature as a target, as specified
[here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#target-root-signature-version).

This is implemented in the following steps:
1. Add `rootsignature` as a shader model environment type and define
`rootsig` as a `target_profile`. Only valid as versions 1.0 and 1.1
2. Updates `HLSLFrontendAction` to invoke a special handling of
constructing the `ASTContext` if we are considering an `hlsl` file and
with a `rootsignature` target
3. Defines the special handling to minimally instantiate the `Parser`
and `Sema` to insert the `RootSignatureDecl`
4. Updates `CGHLSLRuntime` to emit the constructed root signature decl
as part of `dx.rootsignatures` with a `null` entry function
5. Updates `DXILRootSignature` to handle emitting a root signature
without an entry function
6. Updates `ToolChains/HLSL` to invoke `only-section=RTS0` to strip any
other generated information

Resolves: https://github.com/llvm/llvm-project/issues/150286.

##### Implementation Considerations
Ideally we could invoke this as part of `clang-dxc` without the need of
a source file. However, the initialization of the `Parser` and `Lexer`
becomes quite complicated to handle this.

Technically, we could avoid generating any of the extra information that
is removed in step 6. However, it seems better to re-use the logic in
`llvm-objcopy` without any need for additional custom logic in
`DXILRootSignature`.



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