Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lowering arith::TruncFOp from fp32 to bf16 is harder than it should be. #1111

Open
FMarno opened this issue May 13, 2024 · 0 comments
Open
Labels
accuracy bug Something isn't working codegen: spirv

Comments

@FMarno
Copy link
Contributor

FMarno commented May 13, 2024

arith::TruncFOp is currently lowered to a number of bitwise operations since the llvm-spirv translation of

fptrunc float %21 to bfloat, !dbg !22

is

OpFConvert %half %53

with half defined as

%half = OpTypeFloat 16

This is partially solved with PR #1074, but the Intel SPIR-V intrinsics only supports round-to-nearest-even so there are still some bit operations for truncation with round-to-zero.
One of the big barriers for the SPIR-V Translation Tools (llvm-spirv) is that there isn't even a bf16 type in base SPIR-V, we just have the intel extensions to truncate to a bf16 format but the type is i16.
Currently we don't see patching llvm-spirv as a solution for internal reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accuracy bug Something isn't working codegen: spirv
Projects
None yet
Development

No branches or pull requests

2 participants