clangir icon indicating copy to clipboard operation
clangir copied to clipboard

[CIR] Add support for float16 and bfloat

Open Lancern opened this issue 10 months ago • 2 comments

This PR adds two new CIR floating-point types, namely !cir.f16 and !cir.bf16, to represent the float16 format and bfloat format, respectively. CIRGen, LLVMIR lowering, and MLIR lowering for the two new types are also included in this PR.

This PR converts the clang extension type _Float16 to !cir.f16, and converts the clang extension type __bf16 type to !cir.bf16. The type conversion for clang extension type __fp16 is not included in this PR since it requires additional work during CIRGen.

Lancern avatar Apr 28 '24 09:04 Lancern

Nathan just did a rebase, can you please update? Sorry for the churn

bcardosolopes avatar Apr 29 '24 21:04 bcardosolopes

Rebased onto the latest main.

Lancern avatar May 02 '24 15:05 Lancern

Rebased onto the latest main and updated this PR according to the latest reviews:

  • This PR now only deals with the CIRGen of the two new floating point types as this is already complex enough to be stuffed into a single PR.
  • CIRGenExprScalar is updated according to the original clang CodeGen. Specifically, scalar promotion of the new half-precision types is added to the CIRGen.

Lancern avatar May 12 '24 11:05 Lancern