[all-commits] [llvm/llvm-project] 030d07: [AMDGPU] Fix bf16 inv2pi inline constant hadling (...
Stanislav Mekhanoshin via All-commits
all-commits at lists.llvm.org
Mon Feb 19 15:34:21 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 030d07574f0252c21ed28ae258a5af0e577ea37b
https://github.com/llvm/llvm-project/commit/030d07574f0252c21ed28ae258a5af0e577ea37b
Author: Stanislav Mekhanoshin <rampitec at users.noreply.github.com>
Date: 2024-02-19 (Mon, 19 Feb 2024)
Changed paths:
M llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
M llvm/test/MC/AMDGPU/bf16_imm.s
Log Message:
-----------
[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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list