Issue |
148063
|
Summary |
[DirectX] `inout` on arrays of vectors is not correctly handled
|
Labels |
new issue
|
Assignees |
|
Reporter |
Icohedron
|
After fixing #147114 there are now 14 DML shaders failing to pass validation due to error `Instructions should not read uninitialized value`.
While this validation error was encountered and fixed before (#139011), this appears to another unique case.
Reproduction: https://godbolt.org/z/vd1jWr79P
The following shader defines and uses a function `FillZero` with an inout parameter to fill an array of vectors with zeros.
Calling `FillZero` with `foo` does not correctly set `foo` to zeros.
```hlsl
// compile args: -T cs_6_7 -E CSMain
void FillZero(inout uint32_t2 v[2]) {
v = { uint32_t2(0, 0), uint32_t2(0, 0) };
}
RWStructuredBuffer<uint32_t> output;
cbuffer Constants { uint32_t2 bar[2]; }
[numthreads(1, 1, 1)] void CSMain() {
uint32_t2 foo[2];
FillZero(foo);
output[0] = dot(foo[0], bar[0]);
}
```
The resulting IR contains a `mul` instruction with one operand being `undef`, which is not valid and causes a validation error
```llvm
Function: CSMain: error: Instructions should not read uninitialized value.
note: at '%2 = mul i32 undef, %.extract' in block 'entry' of function 'CSMain'.
Validation failed.
```
One DML shader with this issue is `Cast_float16_native_accum32_uint8_packed32_256_Strided8D.dat`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs