Article View: comp.arch
Article #610Re: vector length CSR?
From: Anton Ertl
Date: Mon, 09 Nov 2026 06:13
Date: Mon, 09 Nov 2026 06:13
84 lines
5499 bytes
5499 bytes
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> writes: >RISC-V is going against the prevailing fashion on this. Most other CPU >architectures in common use implement loads of SIMD instructions with >fixed vector lengths that are typically quite short: e.g. 4 or 8 >elements. The reason why you need loads of different instructions is >because you want to cover all the possible combinations of operand >types that a programmer might find useful. > >The RISC-V designers quite rightly criticize this combinatorial >explosion of instruction variants as going completely against the >whole idea of a *reduced* instruction set computer (which is what >"RISC" is supposed to stand for). Given that Patterson (who coined the term RISC) never gave a definition of RISC, how can one say that the combinatorial explosion is right or wrong? John Mashey gave criteria for determining the RISC-ness of an intruction set <https://userpages.umbc.edu/~vijay/mashey.on.risc.html>, and I found his arguments convincing (although I do not agree fully with all of his criteria, in particular, not 3a-c, and 5a and consequently 5b). The number of instructions is not one of the criteria he gave. In particular, if we look at AVX and AVX-512 instructions, 1) The gather and scatter instructions are against RISC criteria (Mashey criterion 4b), and on Skylake are slow, and already have resulted in the Downfall vulnerability. 2) The load-and-operate variants of the instructions are against Mashey's criterion 4a, and while other criteria (in particular 3a-3c) are not satisfied by all CPUs that are typically seen as RISC, this criterion has been satisfied by all of them. One can see the bad effects of the load-and-operate variants as well as the bad effects of making the destination operand one of the sources (not a Mashey criterion) in the FMA3 instructions, which come in 132, 213, and 231 variants depending on which source operand should be overwritten and which should be in memory. 3) AVX and AVX-512 are part of AMD64, so naturally they do not satisfy criteria 3a and 3b. If you leave away the gather-and-scatter instructions, and the load-and-operate variants, and encode the rest to fit in 32 bits (and leave room for the integer instruction set:-), and reduce the offset of load/store instructions to make this possible, AVX-512 still has hundreds, maybe thousands of instructions thanks to the combination of operations, types, lane (element) sizes, operation width, but satisfies Masheys criteria. The RISC-V designers may want to add the number of instructions as another criterion, but I think they would be wrong. The advantages of the RISC principles do not hinge on the number of instructions. If they want to encode some of the "combinatorial explosion" stuff in registers that are implicitly used by the SIMD instructions, that's actually against the trend in at least some of the RISCs, in particular MIPS (with hi and lo as the exception that proves the rule) and Alpha, and RISC-V without the vector stuff, to avoid implicit (and thus single-instance) registers; this rule has shown its value in particular when OoO was introduced (no need to rename the condition codes). One might have several registers containing the type and widths, and refer to them in the instruction, and this would reduce the problems of this approach a little. But a problem remains: Implementors want to know the registers that the instruction operates on in the renamer, and the type that they work on when entering the schedulers (not every microarchitecture has just one scheduler that covers everything), so these informations need to be provided at the front end, and instructions that change these registers need to be executed at the front end, subverting OoO implementations. There is a reason why we have encoded the instruction type and width into scalar instructions, and this reason does not go away when it comes to vector instructions. And just because this good practice inreases the instruction count, does not make it a bad practice, even if the result is a combinatorial explosion. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID:
<2026Nov9.071302@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Re: vector length CSR? Date: Mon, 09 Nov 2026 06:13:02 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 84 Message-ID: <2026Nov9.071302@mips.complang.tuwien.ac.at> References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> Injection-Date: Mon, 09 Nov 2026 07:41:04 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1105166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Dlz1Ie5jIhEyspPRTxx8w"; posting-host="da5eb14802d67bfb789bef8ff75feec4" Cancel-Lock: sha1:wI1jPLJQ9r9OZkw5uUvLcS4j3Ow= sha256:nA2LqNIL6TZrXevdvAHjcpoLiYYiWkjFmOh/sa+nXK8= sha1:Lf9AryE42kOFFxLdR8CHmkloEVg= sha256:f8/9G8oQsZWY1vdudXbRjBZP2j/IO9H4zBoB5tsn2rY= X-newsreader: xrn 10.11