llvm / llvm/offload-test-suite

[AMD] Dynamic local resource assignment based on thread ID is incorrect

Open
#1,375 0 comments 0 reactions 1 assignee View on GitHub

@tcorringham is already working on this.

Since Jul 28, 2026.

Dominant language
C++
Stars
18
Forks
39
Avg merge
2d 18h
Merged PRs (30d)
40

Description

Consider this shader:

RWByteAddressBuffer In : register(u0);
RWByteAddressBuffer OutArr[] : register(u1);

[numthreads(2,1,1)]
void main(uint3 Tid : SV_DispatchThreadID) {
    RWByteAddressBuffer Out;
    if (Tid.x == 0) {
        Out = OutArr[NonUniformResourceIndex(0)];
    } else {
        Out = OutArr[NonUniformResourceIndex(1)];
    }
    Out.Store(0, In.Load(0) + Tid.x);
}

Given that In is a resource with its first element = 42, we would expect OutArr[0] = 42, and OutArr[1] = 43.
Instead, we get:

# | Name:            ExpectedOutArr
# | Format:          Int32
# | Stride:          4
# | ArraySize:       2
# | Data:
# |   - [ 42 ]
# |   - [ 43 ]
# | OutputProps:
# |   Height:          0
# |   Width:           0
# |   Depth:           0
# | ...
# | Got:
# | ---
# | Name:            OutArr
# | Format:          Int32
# | Stride:          4
# | ArraySize:       2
# | Data:
# |   - [ 43 ]
# |   - [ 0 ]

It looks like Out isn't being assigned correctly, since OutArr[1] is 0, but we expect it to be at least 1, since Tid.x should be 1 in that case.
This was found using the DXC compiler, with the d3d12 target, here:
https://github.com/llvm/offload-test-suite/actions/runs/29453229428/job/87483262159?pr=1090#step:13:580

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.