llvm / llvm/llvm-project

[HLSL][Sema] Add semantic validation for unbounded resource array accesses exceeding register slot number limit

Open
#174,071 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend HLSL
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider this shader:
```
RWBuffer A[] : register(u4294967294);

RWStructuredBuffer Out;

[numthreads(4,1,1)]
void main() {
Out[0] = A[0][0];
Out[0] = A[1][0];
Out[0] = A[2][0];
}
```

It declares an unbounded resource array starting right below the maximum threshold of UINT32_MAX, but there are accesses in the main function that would require resources bound past this limit.
We need to decide whether such accesses should be detected and diagnosed.
We could look at all uses of a resource, and see if its offset added to the starting register slot exceeds the limit.
It is unclear what ought to be done, because currently DXC nor clang check for this behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.