Issue |
147114
|
Summary |
[DirectX] Direct stores to array allocas cause validation error: Explicit load/store type does not match pointee type of pointer operand
|
Labels |
new issue
|
Assignees |
|
Reporter |
Icohedron
|
## The Problem
This shader fails to validate due to the validation error: `Explicit load/store type does not match pointee type of pointer operand`
Surprisingly, no DML shaders are failing to validate due to this error.
```hlsl
uint2 Foo(uint2 a[2], uint i) {
return a[i];
}
RWStructuredBuffer<uint2> output;
[numthreads(1, 1, 1)]
void CSMain(uint3 Tid : SV_DispatchThreadID) {
uint2 arr[2] = {Tid.xy, Tid.yx};
output[0] = Foo(arr, Tid.z);
}
```
https://godbolt.org/z/PdW9d7brE
Using lldb, I have found that the validation error is due to direct scalar stores into array allocas:
```llvm
%1 = alloca [4 x i32], align 8
%4 = call i32 @dx.op.threadId.i32(i32 93, i32 0) #3, !dbg !86
store i32 %4, ptr %1, align 8, !dbg !105
```
returning this error https://github.com/microsoft/DirectXShaderCompiler/blob/4fcf67f78f7d6ffd286316112694a3ae000860e2/lib/Bitcode/Reader/BitcodeReader.cpp#L3693
## Proposed solution
The dxil-flatten-arrays pass or the dxil-legalize pass could insert GEPs for these kinds of store and load instructions.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs