Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stabilizing f16

Metadata
Point of contactFolkert de Vries
StatusAccepted
Tracking issuerust-lang/rust-project-goals#655
Other tracking issueshttps://github.com/rust-lang/rust/issues/116909
Zulip channelN/A
Funding point of contactTrifecta Tech Foundation
Teamscompiler, lang, libs-api
Task ownersbjorn3, Folkert de Vries, Trevor Gross

Summary

In recent years we’ve seen increasing hardware support for the f16 float type. Support was originally motivated by machine learning/AI, but f16 has since also found applications in other domains like graphics and physics simulations.

With LLVM 22, the remaining blockers in the backends have been cleared for f16, and therefore stabilizing this type in 2026 is realistic.

Motivation

The status quo

The f16 is unstable. The implementation in the compiler is mostly complete, with some missing const support. For f16 LLVM 22 has the support we need.

What we propose to do about it

We will stabilize f16. There is not much to design at this point.

When rustc drops support for LLVM 21 (summer 2026) we can clean up the implementation significantly.

The LLVM backend provides implementations for some f16 functions (type conversions, arithmetic, etc.) that are not available when using the cranelift backend. We propose to add implementations to rust-lang/compiler-builtins as needed to get the cranelift backend on-par with the LLVM backend.

Work items over the next year

TaskOwner(s)Notes
complete support in const-eval/miriFolkert de Vries
improve support in rustc_codegen_craneliftFolkert de Vries, bjorn3, Trevor Gross
remove cfg(target_has_reliable_f16)Folkert de Vries, Trevor Gross
write the stabilization reportFolkert de Vries, Trevor Gross

Team asks

With Trevor Gross as the dedicated reviewer, the asks of the teams are limited.

TeamSupport levelNotes
compilersmall
libs-apismall
langsmalloccasionally being fast-tracked would be nice

Funding

PurposeCostFundedSponsor(s)
Contributor$25,000No

Notes

An earlier version of this project goal also mentioned f128. We decided to split this out because it is much further away from stabilization, and is related to interop as well (via C long double on some targets).

Frequently asked questions

What do I do with this space?