[PATCH] D85009: [Sema][BFloat] Forbid arithmetic on vectors of bfloat.

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 09:23:31 PDT 2020


simon_tatham added a comment.

In D85009#2187621 <https://reviews.llvm.org/D85009#2187621>, @jfb wrote:

> You mean: only aarch64 backend supports lowering bfloat16 vectors at the moment?

Yes, sorry – I should have said that Arm has the only implementation //in an LLVM target//. I meant the only one "in clang" in the sense of "compiled into the overall clang binary", which was unclear of me.

I agree that from a front end / language specification perspective this is tricky. That's why I mentioned the vector kind. The //scalar// bfloat type may have to have the same source-language semantics across all targets, but when it comes to vectors, each target will define a different set of vector types. The Arm header files will be defining something along the lines of

  typedef __attribute__((neon_vector_type(8))) bfloat16_t bfloat16x8_t;

and the next target that wants to use a vector of bfloat will presumably do something similar with a different `foo_vector_type` attribute (and quite likely a different set of vector lengths too).

Vector architectures are more or less //certain// to vary in the range of operations they permit, so it seems reasonable to me that clang will end up wanting to treat a `neon_vector_type` vector of bfloats differently from whatever other `foo_vector_type` is declared. They'll be different types, and conditioning behavior on which one you've got is essentially a way to make it target-specific.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85009



More information about the cfe-commits mailing list