Skip to content

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

@FMarno

Description

@FMarno

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions