-
Notifications
You must be signed in to change notification settings - Fork 271
Clarify the relationship between extensions. #723
Comments
Few more thing want to clarify:
|
Does V extension passed to -march should imply at least Zvl128b? (The V vector extension requires that VLEN ≥ 128.) |
In other words, the question is "Does Zvl*b passed to -march should imply the V extension?" |
Yes, I think V should imply Zvl128b. |
Changes:
|
My understanding is the same, especially agree with that we only need to take the information from the biggest/largest zve/zvl extensions. |
Oh forgot to mention that - the linker should have the same reduced architecture string for zve and zvl. For example, there are two objects, one has zve64x, and another has zve32x. If we link the two objects, then the output architecture string should only have zve64x, since zve32x is covered by it. |
If the canonical form of Zfoo32b + Zfoo64b is Zfoo64b only then things don't work, because then you risk a kernel or run-time linker seeing it has Zfoo64b and not thinking that satisfies a Zfoo32b binary because it doesn't also see Zfoo32b, and you'd need to bake in extra logic to teach it about all those special cases. The canonical (exploded) form for Zfoo32b + Zfoo64b should be Zfoo32b_Zfoo64b. Just as the canonical (exploded) form for F+D is FD. This is longer but things "just work"; having implicit extensions in the machine-processed arch strings just causes headaches. That's for the human-facing strings only. |
Updated:
|
Also add one more item to toolchain implementation note:
|
According to the previous implementation and comments, The zvamo and zvlsseg can be used without v, so I think v shouldn't be required to be specified for them. |
The question here is does zvamo require v, or does it imply v. I think it is simpler if it requires v. Likewise with zvlsseg. |
I don't agree with it. Extension should be able to be specified stand alone. For example, users could specify rv64id without f. Why are we not able to specify v only? That means the only way to specify v is fdv.
|
But for the case of vector operation, it's not obviously relationship between vector and floating point like single precision and double precision. That behavior will result My intention to prevent require those non-trivial and not obvious knowledge for toolchain user, just like we are trying to release the canonical order hell for the -march option. |
My intention was want to reduce the size of Tag_RISCV_arch, but after I write down a arch string with all ratified ext. with crypto, vector and bitmanip, it seems reduce size seems not so useful - it's still long but introduce too many rule need to handle, so I think let keep full expanded version to keep the rule simple. Full expanded version: Reduced version: |
I don't see Zvamo mentioned anywhere in the v1.0-rc1 spec. I don't think we need to support it. I don't know what to say about "standalone Zvlsseg". I can't imagine that is an intended design point. On a related note, I think the spec should just drop the Zvlsseg ISA string: I see no need to standardize a name for this subset. It certainly made sense when it was optional, but nowadays it is included in all the standard extensions. However, I've suggested this multiple times to the task group and it's never been changed, so I suppose its persistence is intentional. |
Oh, thanks for point out that, that actually give me wrong impression is: Zvlsseg is a standalone Read the spec again, zve* and v both has this sentence, so yes, that should be gone on the toolchain side since all extension are support...
|
The worry is based on the assumption that v implies f and d. What if v does not imply f and d in the tool implementation? Users will specify what users want explicitly and there is no confusion. So, If users only use integer vector operations, they could specify rv64iv without error messages. To enforce users to specify fdv for vector extension, it causes confusion from users' perspective, especially when users only use integer vector operations and see the error messages for rv64iv. I think arch string is already complex. We have no need to add additional rules on it.
|
In 1.0, I think users should use |
There is already considerable momentum in this regard. Table 27.1 in Vol. 1 defines an "implies" relation on various extensions, for example, Q => D => F => Zicsr. In this case we might add V => D. I note that toolchains implement a superset of this relation. For example, Clang/LLVM happily assembles this:
with EDIT: the toolchain folks have informed us below that this behavior is due to a backwards-incompatible change between i2p0 and i2p1 which is still being addressed. |
@nick-knight the fact is LLVM still implement i ext 2.0, which base extension still include |
For GNU toolchain, @Nelson1225 and me has implement that on upstream for a while, which included in GCC 11, but that not available on https://godbolt.org/ :( |
Yeah, but I am prefer to make sure this write down to the |
A question about the rule. Why not emit an error message for the case. You do not know what the users want if they specify both zve* extensions in the arch string. I think the situation is similar to
|
Removed Zvlsseg extension name as segment load/stores are required in all standard vector extensions. Affects #723.
General rule is that extension names imply the things they require, and we take union of all implied features. This simplifies model when string is built up in pieces in different places, with multiple repeated additions of same extension. After vector spec isout, plan to revisit the naming chapter to clear this up. |
RISC-V specs use the verb "depend" to describe the relationship between e.g. D and F. The Naming chapter makes it clear that dependence relationships can be used to shorten ISA strings: https://github.com/riscv/riscv-isa-manual/blob/399c9a759eb4540a65c60e2cc236164821ff2346/src/naming.tex#L46 This thread demonstrates that using the alternate verb "require" is causing confusion, so I've fixed the spec to use the standard verb. e8594a7 and 6fedb86 |
* Recognized zve* and zvl* extensions. - zve*: zve64d, zve64f, zve64x, zve32f and zve32x. - zvl*: zvl32b, zvl64b, zvl128b, zvl256b, zvl512b, zvl1024b, zvl2048b, zvl4096b, zvl8192b, zvl16384b, zvl32768b and zvl65536b. * Spec said that v requires f and d, zve64d requires d, zve64f and zve32f require f. However, according to the issue 723, [riscvarchive/riscv-v-spec#723] The general rule is that extension names imply the things they require. Therefore, the current imply rules should be as follows, - v imply f and d. - zve64d imply d. - zve64f and zve32f imply f. - zvamo imply a. Besides, consider the implicit zve and zvl extensions, - v imply zve64d and zvl128b. - zve64* imply the corresponding zve32*. For example, zve64f imply zve32f, and zve64x imply zve32x. - zve*d imply zve*f and zve*x. For example, zve64d imply zve64f and zve64x. - zve*f imply zve*x. For example, zve64f imply zve64x. - zve64* imply zvl64b, and zve32* imply zvl32b. - The larger zvl* imply all smaller zvl*. For example, zvl128b imply zvl64b, and zvl32b. Therefore, "-march=rv64iv -misa-spec=20191213" will be "rv64i2p0_f2p0_d2p0_v1p0_zicsr2p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0". Note: zicsr is the imply extension of f. * For zve32x, the (segmant) load/store instructions are illegal when EEW is 64. Besides, vsew cannot be set to 64 by vsetvli when zve32* is enabled. * For zvl*b extensions, we also need to enable either v or zve* extensions. Otherwise we should issue errors. bfd/ * elfxx-riscv.c (riscv_implicit_subsets): Added imply rules for v, zve* and zvl*b extensions. (riscv_supported_std_z_ext): Added zve* and zvl*b extensions. (riscv_parse_check_conflicts): The zvl*b extensions cannot be set without v and zve* extensions. gas/ * config/tc-riscv.c (riscv_extended_subset_supports): Handle zve*. (my_getVsetvliExpression): vsew cannot be set to 64 by vsetvli when zve32* is enabled. (riscv_ip): The (segmant) loads and stores with EEW 64 cannot be used when zve32x is enabled. * testsuite/gas/riscv/extended/march-imply-v.d: New testcase. * testsuite/gas/riscv/extended/march-imply-zve*.d: Likewise. * testsuite/gas/riscv/extended/march-imply-zvl*b.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.l: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.s: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvl.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvl.l: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvamo.d: Removed a-ext from -march since it will be added as implicit ext for zvamo. * testsuite/gas/riscv/extended/vector-insns.d: Likewise. include/ * opcode/riscv.h: Defined INSN_V_EEW64. opcodes/ * riscv-opc.c (riscv_draft_opcodes): Added INSN_V_EEW64 for vector loads and stores when the eew encodings are 64.
* Recognized zve* and zvl* extensions. - zve*: zve64d, zve64f, zve64x, zve32f and zve32x. - zvl*: zvl32b, zvl64b, zvl128b, zvl256b, zvl512b, zvl1024b, zvl2048b, zvl4096b, zvl8192b, zvl16384b, zvl32768b and zvl65536b. * Spec said that v requires f and d, zve64d requires d, zve64f and zve32f require f. However, according to the issue 723, [riscvarchive/riscv-v-spec#723] The general rule is that extension names imply the things they require. Therefore, the current imply rules should be as follows, - v imply f and d. - zve64d imply d. - zve64f and zve32f imply f. - zvamo imply a. Besides, consider the implicit zve and zvl extensions, - v imply zve64d and zvl128b. - zve64* imply the corresponding zve32*. For example, zve64f imply zve32f, and zve64x imply zve32x. - zve*d imply zve*f and zve*x. For example, zve64d imply zve64f and zve64x. - zve*f imply zve*x. For example, zve64f imply zve64x. - zve64* imply zvl64b, and zve32* imply zvl32b. - The larger zvl* imply all smaller zvl*. For example, zvl128b imply zvl64b, and zvl32b. Therefore, "-march=rv64iv -misa-spec=20191213" will be "rv64i2p0_f2p0_d2p0_v1p0_zicsr2p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0". Note: zicsr is the imply extension of f. * For zve32x, the (segmant) load/store instructions are illegal when EEW is 64. Besides, vsew cannot be set to 64 by vsetvli when zve32* is enabled. * For zvl*b extensions, we also need to enable either v or zve* extensions. Otherwise we should issue errors. bfd/ * elfxx-riscv.c (riscv_implicit_subsets): Added imply rules for v, zve* and zvl*b extensions. (riscv_supported_std_z_ext): Added zve* and zvl*b extensions. (riscv_parse_check_conflicts): The zvl*b extensions cannot be set without v and zve* extensions. gas/ * config/tc-riscv.c (riscv_extended_subset_supports): Handle zve*. (my_getVsetvliExpression): vsew cannot be set to 64 by vsetvli when zve32* is enabled. (riscv_ip): The (segmant) loads and stores with EEW 64 cannot be used when zve32x is enabled. * testsuite/gas/riscv/extended/march-imply-v.d: New testcase. * testsuite/gas/riscv/extended/march-imply-zve*.d: Likewise. * testsuite/gas/riscv/extended/march-imply-zvl*b.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.l: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zve32x.s: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvl.d: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvl.l: Likewise. * testsuite/gas/riscv/extended/vector-insns-fail-zvamo.d: Removed a-ext from -march since it will be added as implicit ext for zvamo. * testsuite/gas/riscv/extended/vector-insns.d: Likewise. include/ * opcode/riscv.h: Defined INSN_V_EEW64. opcodes/ * riscv-opc.c (riscv_draft_opcodes): Added INSN_V_EEW64 for vector loads and stores when the eew encodings are 64.
Did anyone try to estimate the number of different combinations that require separate libraries in the embedded toolchain? In the latest release, the xPack GNU RISC-V Embedded GCC supports roughly 100 libraries and the compressed archive has more than 500 MB. |
Update:
2021/9/6: Add zvamo and zvlsseg.
V extension
require
F and D, does it meansimplies
? current ISA spec[1] only useimplies
and didn't appear anyrequire
, so I would like having more explicitly clarification for that word.Can
Zvl*b
use withoutV
,zve32*
orzve64*
?Are these valid combinations? or it's valid but just meaningless, because it won't effect the minimal VLEN?
V
withzvl32b
,zvl64b
Zve64
withzvl32b
Are these valid combinations?
Can
zvamo
andzvlsseg
use withoutV
,zve32*
orzve64*
?[1] https://github.com/riscv/riscv-isa-manual/blob/draft-20210825-d068b76/src/naming.tex#L148
The text was updated successfully, but these errors were encountered: