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

Helena Kotas via All-commits all-commits at lists.llvm.org
Mon Nov 25 16:11:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cac978331f533c53b3f909dde673bb2d7b2ccede
      https://github.com/llvm/llvm-project/commit/cac978331f533c53b3f909dde673bb2d7b2ccede
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2024-11-25 (Mon, 25 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
    A llvm/test/CodeGen/DirectX/bufferUpdateCounter.ll
    R llvm/test/CodeGen/DirectX/updateCounter.ll

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

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

[First version](llvm/llvm-project#114148) of this PR was reverted
because of build break.



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