[all-commits] [llvm/llvm-project] 94bde8: [HLSL] Add `Increment`/`DecrementCounter` methods ...

Helena Kotas via All-commits all-commits at lists.llvm.org
Sat Nov 23 09:33:59 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 94bde8cdc39ff7e9c59ee0cd5edda882955242aa
      https://github.com/llvm/llvm-project/commit/94bde8cdc39ff7e9c59ee0cd5edda882955242aa
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2024-11-23 (Sat, 23 Nov 2024)

  Changed paths:
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGHLSLRuntime.h
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    M clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl
    A clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-lib.hlsl
    A clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-ps.hlsl
    A clang/test/SemaHLSL/BuiltIns/buffer_update_counter-errors.hlsl
    M llvm/include/llvm/IR/IntrinsicsDirectX.td
    M llvm/include/llvm/IR/IntrinsicsSPIRV.td
    M llvm/lib/Target/DirectX/DXILOpLowering.cpp

  Log Message:
  -----------
  [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (#114148)

Introduces `__builtin_hlsl_buffer_update_counter` clang buildin that is
used to implement the `IncrementCounter` and `DecrementCounter` methods
on `RWStructuredBuffer` and `RasterizerOrderedStructuredBuffer` (see
Note).

The builtin is translated to LLVM intrisic `llvm.dx.bufferUpdateCounter`
or `llvm.spv.bufferUpdateCounter`.

Introduces `BuiltinTypeMethodBuilder` helper in `HLSLExternalSemaSource`
that enables adding methods to builtin types using builder pattern like
this:
```
   BuiltinTypeMethodBuilder(Sema, RecordBuilder, "MethodName", ReturnType)
       .addParam("param_name", Type, InOutModifier)
       .callBuiltin("buildin_name", { BuiltinParams })
       .finalizeMethod();
```

Fixes #113513



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