This is an archive of the discontinued LLVM Phabricator instance.

[ARM][BFloat16] Change types of some Arm and AArch64 bf16 intrinsics
ClosedPublic

Authored by miyuki on Aug 18 2020, 9:17 AM.

Details

Summary

This patch adjusts the following ARM/AArch64 LLVM IR intrinsics:

  • neon_bfmmla
  • neon_bfmlalb
  • neon_bfmlalt

so that they take and return bf16 and float types. Previously these
intrinsics used <8 x i8> and <4 x i8> vectors (a rudiment from
implementation lacking bf16 IR type).

The neon_vbfdot[q] intrinsics are adjusted similarly. This change
required some additional selection patterns for vbfdot itself and
also for vector shuffles (in a previous patch) because of SelectionDAG
transformations kicking in and mangling the original code.

This patch makes the generated IR cleaner (less useless bitcasts are
produced), but it does not affect the final assembly.

Diff Detail

Event Timeline

miyuki created this revision.Aug 18 2020, 9:17 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 18 2020, 9:17 AM
miyuki requested review of this revision.Aug 18 2020, 9:17 AM

Do we need to upgrade the old bfmmla to the new signatures?

llvm/test/CodeGen/ARM/arm-bf16-dotprod-intrinsics.ll
176

It seems like it's probably worth keeping this test.

Do we need to upgrade the old bfmmla to the new signatures?

What is the old bfmmla?

miyuki updated this revision to Diff 286761.Aug 20 2020, 3:12 AM

Keep the second vbfmlaltq_laneq_f32 test

miyuki marked an inline comment as done.Aug 20 2020, 3:12 AM

I mean, do we need upgrade code in llvm/lib/IR/AutoUpgrade.cpp for the new intrinsic forms?

miyuki updated this revision to Diff 288068.Aug 26 2020, 12:11 PM
miyuki edited the summary of this revision. (Show Details)
miyuki set the repository for this revision to rG LLVM Github Monorepo.
  1. Also update bfdot
  2. Add auto-upgrade for old intrinsics
dmgreen accepted this revision.Aug 27 2020, 1:20 AM

Thanks. LGTM.

llvm/include/llvm/IR/IntrinsicsAArch64.td
473–478

This can be a AdvSIMD_BF16FML_Intrinsic?

This revision is now accepted and ready to land.Aug 27 2020, 1:20 AM
miyuki added inline comments.Aug 27 2020, 9:09 AM
llvm/include/llvm/IR/IntrinsicsAArch64.td
473–478

I want to make a distinction because FML is "Fused multiply-add" and bfmmla is a matrix multiplication intrinsic (even though its prototype matches AdvSIMD_BF16FML_Intrinsic).

miyuki updated this revision to Diff 288373.Aug 27 2020, 9:50 AM

Small refactoring of bitcode updater tests (use some-name.ll.bc names for bitcode files in order to be able to refer to them as %s.bc from some-name.ll)

This revision was landed with ongoing or failed builds.Aug 27 2020, 10:44 AM
This revision was automatically updated to reflect the committed changes.