Commit 283365c
authored
[SPIR-V] Fix precision for
Fixes microsoft#7695
(part of [offload test
suite](https://github.com/llvm/offload-test-suite/blob/2e266dae318b2ce38bfd0633bf52fe33ca127bd2/test/Feature/HLSLLib/dot2add.test#L96))
[HLSL
spec](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/hlsl-shader-model-6-4-features-for-direct3d-12#single-precision-floating-point-2-element-dot-product-and-accumulate)
indicates that the elements are mutilplied with `half-precision` but the
summation results in a `float`.
[OpDot](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpDot)
requires the `ResultType` to be the same as the vector's
`ComponentType`, so this opcode cannot be used.
The fix is to untangle `OpDot` -- multiply `half2` vectors and convert
them to `float` before summing the elements.dot2add (microsoft#7861)1 parent 784a62e commit 283365c
File tree
2 files changed
+35
-18
lines changed- tools/clang
- lib/SPIRV
- test/CodeGenSPIRV
2 files changed
+35
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13165 | 13165 | | |
13166 | 13166 | | |
13167 | 13167 | | |
13168 | | - | |
13169 | | - | |
13170 | | - | |
| 13168 | + | |
| 13169 | + | |
| 13170 | + | |
| 13171 | + | |
| 13172 | + | |
| 13173 | + | |
| 13174 | + | |
13171 | 13175 | | |
13172 | | - | |
13173 | | - | |
13174 | | - | |
13175 | | - | |
| 13176 | + | |
| 13177 | + | |
| 13178 | + | |
| 13179 | + | |
| 13180 | + | |
| 13181 | + | |
| 13182 | + | |
| 13183 | + | |
13176 | 13184 | | |
13177 | 13185 | | |
13178 | | - | |
13179 | | - | |
| 13186 | + | |
| 13187 | + | |
13180 | 13188 | | |
13181 | 13189 | | |
13182 | 13190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
0 commit comments