This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] Add support for experimental Zfbfmin extension
ClosedPublic

Authored by asb on Apr 5 2023, 5:57 AM.

Details

Summary

As documented, this extension includes FLH, FSH, FMV.H.X, and FMH.X.H as defined in Zfh/Zfhmin, but doesn't require either extension.

No Zfbfinxmin has been defined (though you would expect one in the future, for symmetry with Zfhinxmin). See issue https://github.com/riscv/riscv-bfloat16/issues/27.

Diff Detail

Unit TestsFailed

Event Timeline

asb created this revision.Apr 5 2023, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 5:57 AM
asb requested review of this revision.Apr 5 2023, 5:57 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 5 2023, 5:57 AM
asb updated this revision to Diff 512743.Apr 12 2023, 3:21 AM
asb edited the summary of this revision. (Show Details)

Rebase and use the new encoding suggested in https://github.com/riscv/riscv-bfloat16/issues/33 - hoping for the commits that alter the encoding to be pushed to the spec repo and a new PDF (with new version) to be generated ahead of landing this.

This comment was removed by joshua-arch1.

I'm wondering whether it is appropriate to just use FPR16 for the destination of fcvt.bf16.s? The destination is in BF16 format instead of simple FP16. Your implemention looks like just replacing fcvt.h.s with fcvt.bf16.s. Do we need to define a new register class?

I'm wondering whether it is appropriate to just use FPR16 for the destination of fcvt.bf16.s? The destination is in BF16 format instead of simple FP16. Your implemention looks like just replacing fcvt.h.s with fcvt.bf16.s. Do we need to define a new register class?

Registers classes only distinguished by the registers in them and what their alignment and spill size are. It doesn't define anything about the format of the register. A BF16 specific register class would be identical in those properties to the FPR16 register class.

joshua-arch1 added a comment.EditedApr 24 2023, 8:30 PM

I'm wondering whether it is appropriate to just use FPR16 for the destination of fcvt.bf16.s? The destination is in BF16 format instead of simple FP16. Your implemention looks like just replacing fcvt.h.s with fcvt.bf16.s. Do we need to define a new register class?

Registers classes only distinguished by the registers in them and what their alignment and spill size are. It doesn't define anything about the format of the register. A BF16 specific register class would be identical in those properties to the FPR16 register class.

Do you have any plan for code generation of vector instructions with corresponding intrinsics?

I'm wondering whether it is appropriate to just use FPR16 for the destination of fcvt.bf16.s? The destination is in BF16 format instead of simple FP16. Your implemention looks like just replacing fcvt.h.s with fcvt.bf16.s. Do we need to define a new register class?

Registers classes only distinguished by the registers in them and what their alignment and spill size are. It doesn't define anything about the format of the register. A BF16 specific register class would be identical in those properties to the FPR16 register class.

Do you have any plan for code generation of these instructions with corresponding intrinsics?

The RVI toolchain SIG is supposed to be setting up a task group to define intrinsics for all extensions.

The RVI toolchain SIG is supposed to be setting up a task group to define intrinsics for all extensions.

Where should I discuss this intrinsic issue right now?

The RVI toolchain SIG is supposed to be setting up a task group to define intrinsics for all extensions.

Where should I discuss this intrinsic issue right now?

I guess https://github.com/riscv-non-isa/riscv-c-api-doc

asb updated this revision to Diff 523016.EditedMay 17 2023, 5:49 AM
asb edited the summary of this revision. (Show Details)

Now updated to reflect v0.6 of the spec (was previously blocked on a tagged PDF being uploaded) and should be ready for final review and merge https://github.com/riscv/riscv-bfloat16/releases/tag/main

reames accepted this revision.May 17 2023, 7:54 AM

LGTM

This revision is now accepted and ready to land.May 17 2023, 7:54 AM
evandro removed a subscriber: evandro.May 17 2023, 3:50 PM
joshua-arch1 added a comment.EditedMay 19 2023, 2:39 AM

Hi, I'm adding support for __bf16 in clang, which will rely on FeatureStdExtZfbfmin. Can you merge this patch?

This revision was automatically updated to reflect the committed changes.