[PATCH] D120395: [X86] Prohibit arithmetic operations on type `__bfloat16`

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 3 00:44:35 PST 2022


pengfei added a comment.

Thanks @andrew.w.kaylor ! You are totally correct about the intention and current implementations.

> Concretely, what are the semantics that we want for the BF16 types and intrinsics? Unlike the other floating-point types, there's no standard to guide this, so it's even more important to clearly specify how these types are to be used, instead of having an ad-hoc semantics of whatever someone happens to implement.

Good question! This is actually the scope of ABI. Unfortunately, we don't have the BF16 ABI at the present. We can't assume what are the physical registers the arguments been passed and returned before we have such a hardware. For example, ARM has soft FP ABI that supports FP arithmetic operations and passes and returns arguments by integer registers. When we enabling some ISA set whose type doesn't have ABI representation, e.g., F16C, we borrowed such conception. And as a trade off, we used integer rather than introducing a new IR type, since we don't need to support the arithmetic operations.
This patch as well as D120411 <https://reviews.llvm.org/D120411> are trying to follow what we are doing on F16C. The difference is we are supporting scalar type too. That's why I put them into two patches.
Back to the question:

1. There's no BF16 type and its semantics before ABI ready on X86.
2. All intrinsics take BF16 as integer type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120395/new/

https://reviews.llvm.org/D120395



More information about the cfe-commits mailing list