microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Support global structures containing buffers

Open
#8,301 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

The following code works when targeting DXC:

https://hlsl.godbolt.org/z/MdMvsfe6z

struct B {
  RWStructuredBuffer<float3x4> Bufs[2];
};

B b1;
B b2;

[numthreads(1,1,1)]
void main() {

  float3x4 x = b1.Bufs[0][0];
  float3x4 y = b1.Bufs[1][0];
  b2.Bufs[0][0] = x + y;
  b2.Bufs[1][0] = x - y;
}

We intentionally fail when targeting SPIR-V
https://github.com/microsoft/DirectXShaderCompiler/blob/b87d15dbd0bca2a1ef9c9f4d957de8784ec13fe5/tools/clang/test/CodeGenSPIRV/vk.binding.global-struct-of-resources.contains-buffer-error.hlsl#L11

For now the plan is to mark this as not supported in SPIR-V for the offload test suite.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tools/clang/test/CodeGenSPIRV/vk.binding.global-struct-of-resources.contains-buffer-error.hlsl at the referenced failure and review the linked HLSL example. Then inspect the offload test suite plan mentioned in the issue; done means the unsupported SPIR-V behavior is represented there consistently.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.