codeplaysoftware / oneapi-construction-kit

Other
55 stars 21 forks source link

[X86] Expose __truncdfhf2. #439

Closed hvdijk closed 2 months ago

hvdijk commented 2 months ago

Overview

[X86] Expose __truncdfhf2.

Reason for change

LLVM uses __truncdfhf2 for conversion from fp64 to fp16, because under the code generation options we use, there is no native instruction to perform this conversion directly, and emulating it by converting from fp64 to fp32 and then from fp32 to fp16 introduces rounding errors. We did not make this function available, resulting in errors when enabling both FP64 and FP16 on x86.

Description of change

This change makes it available.

Anything else we should know?

Although this change makes us pass tests on x86 with FP16 enabled, this change does not yet change its status to supported. In order to support it, we would need a bit more investigation to make sure that __truncdfhf2 is available on all X86 targets we aim to support, or introduce an alternative implementation if not.

Checklist