| Issue |
172577
|
| Summary |
[HLSL][SPIR-V] Assert in SPIRVInstructionSelector::selectGEP for some cbuffer and groupshared accesses
|
| Labels |
HLSL,
backend:SPIR-V
|
| Assignees |
|
| Reporter |
bogner
|
A few tests in the HLSL offload suite that use cbuffers or groupshared are hitting an assert in the SPIR-V backend:
```
Assertion failed: ((Opcode == SPIRV::OpPtrAccessChain || Opcode == SPIRV::OpInBoundsPtrAccessChain || (getImm(I.getOperand(4), MRI) && foldImm(I.getOperand(4), MRI) == 0)) && "Cannot translate GEP to OpAccessChain. First index must be 0."), function selectGEP, file SPIRVInstructionSelector.cpp, line 3362.
```
---
[test/Feature/CBuffer/dynamic-struct.test](https://github.com/llvm/offload-test-suite/blob/main/test/Feature/CBuffer/dynamic-struct.test):
```hlsl
// clang-dxc -T cs_6_4 -spirv %s
RWStructuredBuffer<uint> WOut : register(u1);
RWStructuredBuffer<uint> QOut : register(u2);
RWStructuredBuffer<float> XOut : register(u3);
struct S {
float x[2];
uint q;
};
cbuffer cb0 : register(b0) {
uint32_t3 w[4];
S v[4];
}
[numthreads(4, 1, 1)]
void main(uint GI : SV_GroupIndex) {
WOut[GI] = w[GI].z;
QOut[GI] = v[GI].q;
XOut[GI] = v[GI].x[1];
}
```
[test/WaveOps/ComponentAccumulationDataRace.test](https://github.com/llvm/offload-test-suite/blob/main/test/WaveOps/ComponentAccumulationDataRace.test):
```hlsl
// clang-dxc -T cs_6_4 -spirv %s
RWStructuredBuffer<uint4> Out : register(u0);
groupshared uint4 SharedData;
[numthreads(128, 4, 1)]
void main(uint3 ThreadID : SV_GroupThreadID) {
if (ThreadID.x == 0 && ThreadID.y == 0) {
SharedData = 0;
}
GroupMemoryBarrierWithGroupSync();
for (uint I = 0; I < 128; I++) {
if (ThreadID.x == I) {
SharedData[ThreadID.y] = SharedData[ThreadID.y] + 1;
}
GroupMemoryBarrierWithGroupSync();
}
if (ThreadID.x == 0) {
Out[0][ThreadID.y] = SharedData[ThreadID.y];
}
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs