DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] `dot2add` constant folding tests producing wrong output for Vulkan target

Open kmpeng opened this issue 1 year ago • 2 comments

https://godbolt.org/z/TjGd63Tf9

These 2 constant folding tests:

// RUN: %dxc -spirv -fspv-target-env=vulkan1.3 -T cs_6_5 -enable-16bit-types %s

RWStructuredBuffer<float> Out : register(u3);

[numthreads(1,1,1)]
void main() {
  Out[14] = dot2add(half2(65504, 1), half2(1, 65504), float(0));
  Out[15] = dot2add(half2(1, -65504), half2(-65504, 1), float(-10000000));
}

produce inf and -inf as outputs, when the expected results are 131008 and -1.0131e+07. The same operations, when performed using buffer values, give the correct outputs.

kmpeng avatar Aug 12 '25 17:08 kmpeng

@kmpeng. For issue that are SPIRV specific, can you add the spirv label? That makes it easier for us to find them. Thanks.

s-perron avatar Aug 21 '25 13:08 s-perron

@s-perron Sorry it doesn't seem like I have permission to add labels in this repo. I'll ask someone to add it next time.

kmpeng avatar Aug 22 '25 21:08 kmpeng