Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Add draft Zvfh and Zvfhmin specs #780

Merged
merged 1 commit into from
Oct 4, 2022
Merged

Add draft Zvfh and Zvfhmin specs #780

merged 1 commit into from
Oct 4, 2022

Conversation

aswaterman
Copy link
Member

Vector instructions that process IEEE 754 binary16 numbers were included in draft versions of the vector extension, but they were separated from the V extension prior to ratification. This PR adds them back.

The Zvfh extension adds IEEE 754 binary16 support to all FP instructions.

The Zvfhmin extension adds only the conversions to and from binary32.

Vector instructions that process IEEE 754 binary16 numbers were included
in draft versions of the vector extension, but they were separated from
the V extension prior to ratification.  This PR adds them back.

The Zvfh extension adds IEEE 754 binary16 support to all FP instructions.

The Zvfhmin extension adds only the conversions to and from binary32.
Comment on lines +5167 to +5178
When the Zvfh extension is implemented, all instructions in Sections
<<sec-vector-float>>, <<sec-vector-float-reduce>>,
<<sec-vector-float-reduce-widen>>, <<sec-vector-float-move>>,
<<sec-vfslide1up>>, and <<sec-vfslide1down>>
become defined when SEW=16.
The EEW=16 floating-point operands of these instructions use the binary16
format.

Additionally, conversions between 8-bit integers and binary16 values are
provided. The floating-point-to-integer narrowing conversions
(`vfncvt[.rtz].x[u].f.w`) and integer-to-floating-point
widening conversions (`vfwcvt.f.x[u].v`) become defined when SEW=8.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be expressed more succinctly by saying something like

Suggested change
When the Zvfh extension is implemented, all instructions in Sections
<<sec-vector-float>>, <<sec-vector-float-reduce>>,
<<sec-vector-float-reduce-widen>>, <<sec-vector-float-move>>,
<<sec-vfslide1up>>, and <<sec-vfslide1down>>
become defined when SEW=16.
The EEW=16 floating-point operands of these instructions use the binary16
format.
Additionally, conversions between 8-bit integers and binary16 values are
provided. The floating-point-to-integer narrowing conversions
(`vfncvt[.rtz].x[u].f.w`) and integer-to-floating-point
widening conversions (`vfwcvt.f.x[u].v`) become defined when SEW=8.
When the Zvfh extension is implemented,
for each instruction with an EEW=32 floating-point operand,
a new version is added supporting half the SEW.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I favor the more explicit version, but we'll see what others say.

topperc added a commit to llvm/llvm-project that referenced this pull request Mar 17, 2022
Currently we allow half types in vectors if the scalar Zfh extension
is enabled. This behavior is not inline with the vector spec. For f32
and f64 types, the Zve32f, Zve64f, Zve64d, and V explicitly control
the availablity of floating point types in vectors.

In order to make our compiler compliant, we either need to remove all support
for half in vectors or we need an extension to control it.

Draft spec here riscv/riscv-v-spec#780

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D121345
@zhongjuzhe
Copy link

Hi, would you mind updating the status about ratification of "zvfhmin".
Recently, I am pushing RVV support to GCC upstream.
It seems that I can't support FP16 vector which needs "zvfh" in GCC upstream
because GCC doesn't allow unratified extension (unlike LLVM which has the experimental compile branch).

I hope I can enable FP16 vector in GCC upstream. Would you mind telling me when will you ratify "zvfh" extension ?
Thanks.

@aswaterman aswaterman merged commit 1424bc4 into master Oct 4, 2022
@sequencer
Copy link
Contributor

Is there any plan to have bf16 or even minifloat for standard RVV?

@aswaterman
Copy link
Member Author

aswaterman commented Oct 4, 2022

Other FP formats will be supported with other extensions. BF16 is in progress.

mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Currently we allow half types in vectors if the scalar Zfh extension
is enabled. This behavior is not inline with the vector spec. For f32
and f64 types, the Zve32f, Zve64f, Zve64d, and V explicitly control
the availablity of floating point types in vectors.

In order to make our compiler compliant, we either need to remove all support
for half in vectors or we need an extension to control it.

Draft spec here riscv/riscv-v-spec#780

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D121345
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants