llvm / llvm/offload-test-suite

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

Open
#1,334 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

In this shader:
```
RWByteAddressBuffer gBufArray[4] : register(u0);

[numthreads(4,1,1)]
void main(uint3 tid : SV_DispatchThreadID) {
RWByteAddressBuffer buf = gBufArray[tid.x];
buf.Store(0, 42);
}
```
gBufArray is always indexed at 0, when the index should range from 0-3 depending on the executing lane.
The result is that the output array's first buffer has 42 at pos 0, but the other 3 buffers start with 0.
We should expect all buffers within gBufArray to have a 42 at pos 0.

The same behavior manifests in this shader as well:
```
RWByteAddressBuffer gBufArray[4] : register(u0);

[numthreads(4,1,1)]
void main(uint3 tid : SV_DispatchThreadID) {
RWByteAddressBuffer arr[4];
arr[0] = gBufArray[0];
arr[1] = gBufArray[1];
arr[2] = gBufArray[2];
arr[3] = gBufArray[3];
arr[tid.x].Store(0, 42);
}
```
Only arr[0] has 42 at pos 0, the rest should, but don't.

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.