microsoft / microsoft/DirectXShaderCompiler
[DirectX] compute shader errors when indexing cbuffer matrix with non constant index.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Repro: https://hlsl.godbolt.org/z/bMx7vaE4j
A cbuffer matrix (float4x2) indexed via a dynamic index derived from SV_GroupIndex and writes to an RWStructuredBuffer causes The following error:
error: validation errors
<source>:9:15: error: Access to out-of-bounds memory is disallowed.
note: at '%12 = getelementptr inbounds [2 x float], [2 x float]* %3, i32 0, i32 2' in block '#0' of function 'main'.
Validation failed.
We do not see this error when targeting SPIR-V. Similarly Clang does not error on this same case
https://hlsl.godbolt.org/z/4W17rPrzv
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the HLSL Godbolt reproducer at https://hlsl.godbolt.org/z/bMx7vaE4j and compare its behavior with the SPIR-V and Clang result at https://hlsl.godbolt.org/z/4W17rPrzv. Trace why dynamic indexing of the cbuffer matrix is reported as out-of-bounds, then confirm the valid case no longer fails validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100