This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add codegen support for bf16 vector
ClosedPublic

Authored by joshua-arch1 on Jul 25 2023, 8:15 PM.

Details

Summary

This patch adds codegen support for vector with bfloat16 type in llvm backend.
With this patch, Zvbfmin/Zvbfwma instructions as well as vle16/vse16 can generated from newly added bf16 IR intrinsics.

Diff Detail

Event Timeline

joshua-arch1 created this revision.Jul 25 2023, 8:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2023, 8:15 PM
joshua-arch1 requested review of this revision.Jul 25 2023, 8:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2023, 8:15 PM
craig.topper added inline comments.Jul 25 2023, 8:23 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
235

Extra .

6907

Do we need to check that Zvfbfwma is enabled?

llvm/test/CodeGen/RISCV/rvv/vfncvtbf16-f-f.ll
25

Use 7 for rounding mode?

llvm/test/CodeGen/RISCV/rvv/vfwmaccbf16.ll
26

use 7 for rounding mode

wangpc added inline comments.Jul 25 2023, 8:49 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
1953–1954

What about moving RISCVInstrInfoZvfbf.td up instead of including it in RISCVInstrInfoV.td?

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
3215

Do we need seperate SchedReadWrite for BF16 instructions?

Use 7 for rounding mode in testcases.

Please upload patches will full context using -U99999

craig.topper added inline comments.Jul 26 2023, 9:32 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
6695

Putting the predicate on the instruction only affects the assembler, but these are pseudos so the assembler doesn't matter. The Predicate needs to be on the pattern.

jrtc27 added inline comments.Jul 26 2023, 9:35 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
6695

They're helpful for documenting what pseudos are available though (and I believe affect the machine verifier?)

Put the predicate both on the pseudo and the pattern.

This revision is now accepted and ready to land.Jul 26 2023, 9:50 PM
This revision was landed with ongoing or failed builds.Jul 27 2023, 7:31 PM
This revision was automatically updated to reflect the committed changes.
joshua-arch1 marked an inline comment as done.