9 ms·
ARM vs. RISC-V Vector Extensions
- Scene_Cast2 6y agoI think some of the complaints are about the number of instructions. But when you need to e.g. load a masked set of vectors, it's really nice to have such an instruction handy.
- klelatti 6y agoTLDR Arm SVE is a bit of a pain to hand write assembly for because there is more to look up? Can anyone recommend a good introduction to SVE2?
- brandmeyer 6y agoSVE2 isn't all that different from SVE. The early SVE introductory papers and tutorials are all great information. https://arxiv.org/abs/1803.06185 https://arxiv.org/abs/1803.06185 https://developer.arm.com/architectures/instruction-sets/simd-isas/sve/sve-programmers-guide/introduction-to-sve https://developer.arm.com/architectures/instruction-sets/sim... If the author had spent as much time reading the introductory manuals as he did bitching all over that webpage, he might have made some progress /rant.
- klelatti 6y agoThanks - these look great. Entirely justified rant too!
- CalChris 6y agoI think the RISC-V Vector Extensions are very elegant. However, I'm more interested in what hard core practitioners think and the ones I follow are nonplussed. https://gist.github.com/erincandescent/8a10eeeea1918ee4f9d9982f7618ef68 https://gist.github.com/erincandescent/8a10eeeea1918ee4f9d99... https://twitter.com/geofflangdale/status/1155122593369710592 https://twitter.com/geofflangdale/status/1155122593369710592 I'm reminded of a compliment for Vishy Anand's middlegame technique. He plays very well with the knight pair.
- jpfr 6y agoRISC-V really shines when the op-compression extension and macro-op fusion are taken into account. https://news.ycombinator.com/item?id=25542963 https://news.ycombinator.com/item?id=25542963 Many of the early critiques of RISC-V have not considered that. And many points become entirely moot in light of these techniques.
- brucehoult 6y agoHere’s the opinion of probably THE most important ARM engineer of the 1990s and 2000s, Dave Jaggar who developed the ARM7TDMI, Thumb, Thumb2. https://www.youtube.com/watch?v=_6sh097Dk5k https://www.youtube.com/watch?v=_6sh097Dk5k Check at 51:30 where he says (bringing up the topic of RISC-V himself) “I would Google RISC-V and find out all about it. They’ve done a fine instruction set, a fine job […] it’s the state of the art now for 32-bit general purpose instruction sets. And it’s got the 16-bit compressed stuff. So, yeah, learning about that, you’re learning from the best.”
- brigade 6y agoSVE was designed mindful of how CPUs currently operate, whereas RISC-V vector extensions were designed with fondness for how CPUs operated decades ago. Well that's somewhat of an exaggeration, but XT-910 speculatively executes vector instructions based on a prediction of how vsetvl(i) modifies register configurations in order to achieve good performance, so changing this register configuration causes speculation failures as though it were a mispredicted branch. Which you need to do if you're doing any mixed precision operations, or mixed integer/floating point, and discourages small SIMD functions. Quote from their white paper: "this is not friendly to deeply pipelined processor architecture." Fundamentally, I dislike how completely the meaning of RISC-V vector instructions depends on what instructions were executed an arbitrarily long time beforehand. Also he's really complaining about register indexing in load/stores?
- _chris_ 6y ago> Quote from their white paper: "this is not friendly to deeply pipelined processor architecture." There is zero reason you can't rename the VL register. "Speculating" that it doesn't change is only one design point.
- brigade 6y agoWell... when the operation of register renaming itself depends on the vtype register, that isn't a complete solution.
- SuchAnonMuchWow 6y agoAlso, the RISC-5 vector extension is at the opposite of the philosophy of RISC vs CISC
- brucehoult 6y agoIn what way? - load/store with arithmetic register-to-register only. Check. - single instruction length. Check. - fixed instruction execution time. Check. - large set of registers. Check.
- sanxiyn 6y agoNote that while the article is broadly correct, RISC-V Vector Extension is still in development and the article is based on the old version. SETVL is now three arguments (not two) and renamed to VSETVL, for example.
- _chris_ 6y agoIt looks like RVV will be going up for ratification this summer, so (https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc https://github.com/riscv/riscv-v-spec/blob/master/v-spec.ado...) is pretty close to the final version.
- brucehoult 6y agoTo be more precise, VSETCFG is gone (rolled into VSETVL) and VSETVL's 3rd argument is an integer encoding the VTYPE with four subfields, written in assembly language for VSETVLI as up to four arguments: element width, register length multiplier, tail agnostic flag, mask agnostic flag (trailing subfields can be defaulted).
- jcranmer 6y ago> RISC-V however does not work like this. The RISC-V vector registers are in a separate register file not shared with the scalar floating point registers. Honestly... in hardware, they probably are actually in the same register file. It just now means you have two sets of architectural registers that rename to the same register file. As for the rest of the article, it looks like it mostly boils down to "I'm intimidated by assembly programming" as opposed to any actual critique of the strengths and weaknesses of the vector ISAs. There's superficial complaints about the numbers of instructions, or different ways to write (the same? I only know scalar ARM assembly, not any vector extensions) instructions. On a quick reread, I see a complaint that's entirely due to how ARM represents indexed load operations, which has absolutely nothing to do with the vector ISA whatsoever. If your goal is to understand how hardware SIMD works, you're probably better off sticking to C code with intrinsics, that way you're not distracted by the extra hoops you may have to go through that arise just by translating C into assembly.
- swiley 6y agoUndergrad computer architecture class freaked me out. Assembly doesn't even accurately describe what the machine does.
- _chris_ 6y ago>> The RISC-V vector registers are in a separate register file not shared with the scalar floating point registers. > Honestly... in hardware, they probably are actually in the same register file. It just now means you have two sets of architectural registers that rename to the same register file. You could have a single unified pool of physical registers that can be handed out to any register, but there's only some advantage to do so and a lot of advantages in keeping them separate. Either way, that's a micro-architectural detail that the designers have the freedom to choose (or not choose) to do. From the software's point of view, there's a lot of advantages in keeping different architectural registers separate.
- jcranmer 6y ago> You could have a single unified pool of physical registers that can be handed out to any register, but there's only some advantage to do so and a lot of advantages in keeping them separate. Either way, that's a micro-architectural detail that the designers have the freedom to choose (or not choose) to do. What's the advantage to keeping them separate? If you're implementing vector instructions, then your scalar floating-point units are probably going to be the same as the vector floating-point units, with zero-extension for the unused vector slots. At that point, keeping them separate hardware register slots is detrimental: it's now costing you extra area as well, with concomitant power costs. You also need larger register files to accommodate all of the vector registers and the floating-point registers, when you're only likely to use half of them at any times. If you're pushing the vector units to their throttle, you'll have little scalar code to need all the renaming; if you're pushing the scalar units to their throttle, you'll similarly have little vector code. From a software viewpoint, eh, there's not really any advantage to keeping them separate. You tend to use scalar xor vector floating point code, not both (this isn't true for integer, though), so there's little impact on actual register pressure. More architectural registers means more state to have to spill on context switches.
- Symmetry 6y ago>If you are a hobbyist like me, who just wants to keep up to date with how technology is evolving and what things like vector processing is, then safe yourself a lot of trouble and just read a RISC-V book. Yes, I'd absolutely agree. If you're a professional you'll probably find the hundreds of ARM instructions useful for optimizing your kernels if you're hand-crafting assembly but you'll be pretty far up the learning curve before you get to the crossover point. And not just for hobbyists but also for most academics working on exploring vectorization as well. But if it's me just making use of the effort someone else has put into BLAS for my robot then I'll probably be better off with an SVE processor both from a code optimization scope standpoint and an ease of hardware implementation standpoint.
- brucehoult 6y agoCompared to NEON, SSE, AVX etc, yes. Compared to RVV? I don't think that follows. Also there won't be any generally available (for example in a Raspberry Pi or other SBC) implementations of SVE for probably several years yet, while Allwinner has their D1 chip using RVV [1] already in mass production and I've been running test code on it e.g. http://hoult.org/d1_memcpy.txt http://hoult.org/d1_memcpy.txt http://hoult.org/d1_strcpy.txt http://hoult.org/d1_strcpy.txt Sipeed and Pine64 have announced plans to sell Linux SBCs with this chip for as little as $10 or $12 within the next few months. [1] it's a two year old version 0.7.1 of RVV, not very compatible with the current draft (though that memcpy() works on both), but newer than what is shown in the article.
- Symmetry 6y agoIf we're talking about non-final versions of RVV then I think there likely won't be any optimized versions of matrix libraries coming out for those chips and both RVV and SVE are going to be effectively moot for a few years for people not writing their own assembly. It's nice that you can get a RV board so cheaply as a hobbyist but as someone who uses vector libraries professionally I don't care and don't expect to ever use a chip costing less than $100. Right now getting high end chips in industrial PCs means going with x86. You can get an ARM chip with nice performance in an Apple laptop but that's not a form factor that's useful to me. ARM's own designs are a few years behind Apple but keeping pace so I think that it won't be too many years before I could plausibly be using ARM chips. I don't have any confidence I'll be able to get a RV chip that performs as well as a contemporary Intel or AMD chip in that timeframe.
- kingsuper20 6y agoI hit so many cases in SSE (and others) where I needed 'just one more instruction' and instead had a bit of a mess, my bet is that simple SIMD instruction sets will always grow over time. For fun, maybe they could bolt on a VLIW set (or KLIW, 'Kinda Large') and push some of the ordering work onto the programmer/compiler.
- ChuckMcM 6y agoOne of the more interesting and fun things you can do these days is get a ULX3S[1], use the community RISC-V project to turn it into a fully functional RISC-V system, and then design your own vector instructions to play around with different ways of doing things. All for < $200 US which is always amazing to me. [1] https://www.crowdsupply.com/radiona/ulx3s https://www.crowdsupply.com/radiona/ulx3s (85T version recommended)