Commit 030d075
authored
[AMDGPU] Fix bf16 inv2pi inline constant hadling (#82283)
Inline constant 1/(2*pi) has the truncated value 0x3e22. According to
the spec it is not rounded. A bf16 value in a nutshall is a fp32 value
with cleared 16 bites of mantissa. The value 0x3e22 converted to fp32 is
0.158203125 and the next representable value 0x3e23 means 0.1591796875.
The fp32 value of 1/(2*pi) = 0.15915494 cannot be represented in bf16.
Although since bf16 values are essentailly truncated fp32 values we can
use 0.15915494 as an idiomatic representation of 1/(2*pi) inline
constant. This is also consistent with sp3 behaviour. The patch fixes
the problem that value we are printing for inv2pi inline constant is not
parsed as inv2pi by the asm parser and gets rounded.1 parent 13dce35 commit 030d075
File tree
2 files changed
+26
-8
lines changed- llvm
- lib/Target/AMDGPU/AsmParser
- test/MC/AMDGPU
2 files changed
+26
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2230 | 2230 | | |
2231 | 2231 | | |
2232 | 2232 | | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
2233 | 2251 | | |
2234 | 2252 | | |
2235 | 2253 | | |
| |||
2238 | 2256 | | |
2239 | 2257 | | |
2240 | 2258 | | |
2241 | | - | |
2242 | 2259 | | |
2243 | | - | |
2244 | 2260 | | |
2245 | 2261 | | |
2246 | | - | |
2247 | 2262 | | |
2248 | 2263 | | |
2249 | | - | |
2250 | 2264 | | |
2251 | 2265 | | |
2252 | | - | |
2253 | 2266 | | |
2254 | 2267 | | |
2255 | | - | |
2256 | 2268 | | |
2257 | 2269 | | |
2258 | | - | |
2259 | 2270 | | |
2260 | 2271 | | |
2261 | 2272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments