Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Update RVV v1.0 (until the vlmul change) based on the binutils-2.35 #224

Merged
merged 11 commits into from
Aug 3, 2020

Conversation

Nelson1225
Copy link
Collaborator

@Nelson1225 Nelson1225 commented Jul 29, 2020

There are nine commits here,

  1. RISC-V: Support RVV according to vector spec v1.0-draft-20200516.
    This commit is ported from rvv-0.9.x branch. Basically, this is the v0.9 implementation.

  2. Extend the VLR and VSR instruction, when is 2, 4, 8.

  3. Remove Vector indexed instruction when EEW >= 128.
    riscvarchive/riscv-v-spec@0fec0e2#diff-4fa320b4e415eee7270590bb06607389R1923

  4. Add assembly pseudo instructions vncvt.x.x.v.
    riscvarchive/riscv-v-spec@2ab0b81

  5. Added reciprocal and reciprocal square-root estimate instruction.
    riscvarchive/riscv-v-spec@d35b23f

  6. Added element width hint to whole register loads/stores.
    riscvarchive/riscv-v-spec@20f673c

  7. Added vrgatherei16 instruction.
    riscvarchive/riscv-v-spec@a679250

  8. Make vlmul bits contiguous in vtype.
    riscvarchive/riscv-v-spec@b8cd98b

  9. RISC-V: Clarify the supported versions for the unratified extensions.
    Based on the recent changes in the binutils-2.35 (-misa-spec option), we probably need to set the draft versions for those UN-ratified extensions. This commit will set the current v1.0 to the V and it's sub extensions correctly by default. Note that only one default draft version can be accepted for an extension, since there is no ISA spec define them. If the next draft is released, then we must remember to update the draft version in the riscv_ext_version_table.

Nelson Chu added 11 commits July 29, 2020 09:12
	2020-05-16  Jim Wilson  <jimw@sifive.com>
		    Kito Cheng  <kito.cheng@sifive.com>
		    Nelson Chu  <nelson.chu@sifive.com>
These instruction are added back in the risc-v vector spec,

commit 0fec0e257cca5e389a0e1774e7d5aaac729b4ad2,
Added clarifications on loads/stores.

Note that the base V extension only enable the single register load/store
variant with <nf> is 0.  It is clear to me that how to enable other register
load/store is <nf> is 2, 4, 8, so I will add the limitation when it is
clarified.
These instruction are removed in the risc-v vector spec,

commit 0fec0e257cca5e389a0e1774e7d5aaac729b4ad2,
Added clarifications on loads/stores.
An integer value can be halved in width using the narrowing integer
shift instructions with a scalar operand of x0. Can define assembly
pseudo instruction "vncvt.x.x.v vd,vs,vm" to "vnsrl.wx vd,vs,x0,vm".
Add new instruction vfrsqrte7.v and vfrece7.v.  The former set VFUNARY1 (vs1)
to 00100, and the later set VFUNARY1 to 00101.
Add load instructions which have an EEW encoded in the `mew` and `width`.
Remove the V-ext v0.7 in the riscv_ext_version_table, and regard V-ext
as a non-ISA spec extension temporarily.  Since we only support the v1.0
for now, and not yet upstreamed.  Also, we define other unratified
extensions to the non-ISA spec extension, too.
@jim-wilson
Copy link
Collaborator

This looks OK to me.

I think we missed a problem with dest/mask register overlaps when the mask length changed to 1 bit per element. The v0.8 spec says "The destination vector register group for a masked vector instruction can only overlap the source mask register (v0) when LMUL=1. Otherwise, an illegal instruction exception is raised." Since we can't know LMUL we don't check this in the assembler. However, in v1.0 is says "NOTE: Some masked instructions that target v0 which were legal in v0.8 are illegal with the new MLEN=1 mask layout for v1.0. For example, vadd.vv v0, v1, v2, v0.m is now always illegal; previously, it was legal for LMUL=1." Since it is always illegal now, the assembler can generate an error. It isn't clear to me why this is illegal though. The text says mask reg has EEW of 1, and overlap with dest is OK if it is the highest reg of the set, for LMUL=1 v0 would be the highest reg of the set. Maybe this rule only applies if dest LMUL is greater than 1? In that case v0 can never be the highest reg of the group so this would always be illegal.

There seems to be a problem with how zvamo and zvlsseg are handled. The current text says "This instruction subset is given the ISA string Zvamo. NOTE: This set of instructions is included in the base "V" extension used for the Unix profile." Note the reference to the unix profile. This suggests that when the target is --linux-gnu then 'v' should include zvamo, but when the target is --elf it should not. It isn't clear if this is what the V spec authors intended. The zvlsseg language is the same. Currently we make v imply zvamo unconditionally, and don't for zvlsseg.

I think these issues can be fixed with follow on patches, if necessary.

@kito-cheng
Copy link
Collaborator

kito-cheng commented Jul 30, 2020

@aswaterman do you mind disambiguate for this?

NOTE: This set of instructions is included in the base "V" extension used for the Unix profile
This suggests that when the target is --linux-gnu then 'v' should include zvamo, but when the target is --elf it should not.

@aswaterman Does it what you mean? my understanding is V = zvbase + zvamo + zvlsseg no matter the target triple.

@aswaterman
Copy link
Contributor

@kito-cheng that's my understanding, too. The problem is that no one ever formally defined the name Zvbase, so there's no way to refer to that piece; you should raise that issue on the vector spec.

@Nelson1225
Copy link
Collaborator Author

I think we missed a problem with dest/mask register overlaps when the mask length changed to 1 bit per element. The v0.8 spec says "The destination vector register group for a masked vector instruction can only overlap the source mask register (v0) when LMUL=1. Otherwise, an illegal instruction exception is raised." Since we can't know LMUL we don't check this in the assembler. However, in v1.0 is says "NOTE: Some masked instructions that target v0 which were legal in v0.8 are illegal with the new MLEN=1 mask layout for v1.0. For example, vadd.vv v0, v1, v2, v0.m is now always illegal; previously, it was legal for LMUL=1." Since it is always illegal now, the assembler can generate an error. It isn't clear to me why this is illegal though. The text says mask reg has EEW of 1, and overlap with dest is OK if it is the highest reg of the set, for LMUL=1 v0 would be the highest reg of the set. Maybe this rule only applies if dest LMUL is greater than 1? In that case v0 can never be the highest reg of the group so this would always be illegal.

Thanks for the reminder, I will start to handle this next week.

@Nelson1225 Nelson1225 merged commit 3d7a9af into riscvarchive:rvv-1.0.x Aug 3, 2020
@Nelson1225 Nelson1225 deleted the rvv-1.0.x-until-vlmul branch August 3, 2020 03:40
@Nelson1225
Copy link
Collaborator Author

I will start to update the mask overlap issue this week. As for the Zvbase, we will create an issue on the vector spec to discuss it. Thanks for all @jim-wilson @aswaterman @kito-cheng

@kito-cheng
Copy link
Collaborator

Need sub-extension for baseline vector ISA: riscvarchive/riscv-v-spec#546
Clarify note for Zvamo and Zvlsseg: riscvarchive/riscv-v-spec#547

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