[all-commits] [llvm/llvm-project] 4b692a: [SPIRV] Expand RWBuffer load and store from HLSL (...

Steven Perron via All-commits all-commits at lists.llvm.org
Fri Jan 17 09:22:50 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4b692a95d103f3ad30d6be1ce6d5dda0bd90bc1f
      https://github.com/llvm/llvm-project/commit/4b692a95d103f3ad30d6be1ce6d5dda0bd90bc1f
  Author: Steven Perron <stevenperron at google.com>
  Date:   2025-01-17 (Fri, 17 Jan 2025)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
    M llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
    M llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
    A llvm/test/CodeGen/SPIRV/hlsl-resources/BufferLoadStore.ll
    M llvm/test/CodeGen/SPIRV/hlsl-resources/BufferStore.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/CombinedSamplerImageDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/CombinedSamplerImageNonUniformIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/InputAttachmentImageDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/InputAttachmentImageNonUniformIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/SampledImageDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/SampledImageNonUniformIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/SamplerArrayDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/SamplerArrayNonUniformIdx.ll
    M llvm/test/CodeGen/SPIRV/hlsl-resources/ScalarResourceType.ll
    M llvm/test/CodeGen/SPIRV/hlsl-resources/StorageImageDynIdx.ll
    M llvm/test/CodeGen/SPIRV/hlsl-resources/StorageImageNonUniformIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/StorageTexelBufferDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/StorageTexelBufferNonUniformIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/UniformTexelBufferDynIdx.ll
    R llvm/test/CodeGen/SPIRV/hlsl-resources/UniformTexelBufferNonUniformIdx.ll
    M llvm/test/CodeGen/SPIRV/hlsl-resources/UnknownBufferStore.ll

  Log Message:
  -----------
  [SPIRV] Expand RWBuffer load and store from HLSL (#122355)

The code pattern that clang will generate for HLSL has changed from the
original plan. This allows the SPIR-V backend to generate code for the
current code generation.

It looks for patterns of the form:

```
%1 = @llvm.spv.resource.handlefrombinding
%2 = @llvm.spv.resource.getpointer(%1, index)
load/store %2
```

These three llvm-ir instruction are treated as a single unit that will

1. Generate or find the global variable identified by the call to
   `resource.handlefrombinding`.
2. Generate an OpLoad of the variable to get the handle to the image.
3. Generate an OpImageRead or OpImageWrite using that handle with the
   given index.

This will generate the OpLoad in the same BB as the read/write.

Note: Now that `resource.handlefrombinding` is not processed on its own,
many existing tests had to be removed. We do not have intrinsics that
are able to use handles to sampled images, input attachments, etc., so
we cannot generate the load of the handle. These tests are removed for
now, and will be added when those resource types are fully implemented.



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