[PATCH] D85009: [Sema][BFloat] Forbid arithmetic on vectors of bfloat.
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 31 09:25:48 PDT 2020
jfb added a comment.
In D85009#2187631 <https://reviews.llvm.org/D85009#2187631>, @LukeGeeson wrote:
> In D85009#2187621 <https://reviews.llvm.org/D85009#2187621>, @jfb wrote:
>
>> In D85009#2187603 <https://reviews.llvm.org/D85009#2187603>, @simon_tatham wrote:
>>
>>> In D85009#2187549 <https://reviews.llvm.org/D85009#2187549>, @jfb wrote:
>>>
>>>> Is that true of all vector bfloat implementations? It seems like arithmetic on these types is something implementations would likely support.
>>>
>>> As I understand it, Arm currently has the only implementation in clang so far. But if other targets disagree, we can make this conditional on `getVectorKind()`, so that `VectorType::NeonVector` gets this restriction and other vector types get whatever they need.
>>
>> You mean: only aarch64 backend supports lowering bfloat16 vectors at the moment? Because the clang support isn't "ARM bfloat", it's just bfloat. The tests are ARM bfloat and I think that's fine (i.e. Sema should be able to check ISA-specific problems), but in general this property your checking for seems like a target property.
>>
>> If I write C or C++ code using bfloat, I'd like to know what that type actually means and what I can do with it. As a developer, it'll be super frustrating once other targets support bfloat... should those target have their own bfloat (because it won't be compatible with ARM's), or should bfloat work differently on different targets?
>>
>> I actually don't know what the intended approach is here, which is why I'm asking :)
>
> Yes there is an Intel bfloat type too, however we are the only target for the bfloat c/ir type so far. The jury is also out as far as the standards are concerned too, the best we can do now is prevent behavior we know is not compatible, and like Simon says, add some predication later
Language-wise I think https://wg21.link/p1467 is where C++ is going, and C is taking a similar approach.
I'd like to make sure this is well thought out. Not just "the ISA does this, let's do the same". We know other ISAs act differently, and I'm not clear on what the intended behavior will be for people writing C and C++ code.
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