[all-commits] [llvm/llvm-project] acde20: [HLSL][SPIRV] Add vk::constant_id attribute. (#143...

Steven Perron via All-commits all-commits at lists.llvm.org
Wed Jun 18 03:40:13 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: acde20b5605f3a3a8da2217e4526fc045e6603ed
      https://github.com/llvm/llvm-project/commit/acde20b5605f3a3a8da2217e4526fc045e6603ed
  Author: Steven Perron <stevenperron at google.com>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/SemaHLSL.h
    M clang/lib/CodeGen/CGHLSLBuiltins.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    A clang/test/AST/HLSL/vk.spec-constant.usage.hlsl
    R clang/test/CodeGenHLSL/inline-spirv/SpirvType.alignment.hlsl
    R clang/test/CodeGenHLSL/inline-spirv/SpirvType.hlsl
    A clang/test/CodeGenHLSL/vk-features/SpirvType.alignment.hlsl
    A clang/test/CodeGenHLSL/vk-features/SpirvType.hlsl
    A clang/test/CodeGenHLSL/vk-features/vk.spec-constant.hlsl
    A clang/test/SemaHLSL/vk.spec-constant.error.hlsl

  Log Message:
  -----------
  [HLSL][SPIRV] Add vk::constant_id attribute. (#143544)

The vk::constant_id attribute is used to indicate that a global const
variable
represents a specialization constant in SPIR-V. This PR adds this
attribute to clang.

The documentation for the attribute is
[here](https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#specialization-constants).

The strategy is to to modify the initializer to get the value of a
specialize constant for a builtin defined in the SPIR-V backend.

Implements https://github.com/llvm/wg-hlsl/pull/287

Fixes https://github.com/llvm/llvm-project/issues/142448

---------

Co-authored-by: Nathan Gauër <github at keenuts.net>



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