5 ms·
Instruction fusion is a perfectly cromulent approach. These days RISC-V extensions are even written with instruction fusion in mind, such as the recently prop
by zozbot234 3y ago
Instruction fusion is a perfectly cromulent approach. These days RISC-V extensions are even written with instruction fusion in mind, such as the recently proposed Zicond - which just adds a couple "conditionally move value or zero" three-register insns. It turns out that this is enough to support lots of "conditional insn" patterns that other ISA's have to encode explicitly.
- saagarjha 3y agoLook I didn't want to name names but if you willingly volunteer to serve as an example of what I was talking about I am more than happy to let you do that.
- Joker_vD 3y ago...RISC-V spec literally says things like "we define the canonical sequence to be MULH/MUL, in this order. Microarchitectures can then fuse these into a single multiply operation instead of performing two separate multiplies".
- brucehoult 3y agoNot even necessarily fuse in that case, just cache the operands and result in internal registers and don't run the multiply again if the operands are the same. Same for DIV/REM.
- mbitsnbites 3y agoIn that case you don't need a canonical order. The instructions do not even have to be next to each other.
- saagarjha 3y agoI'm not going to respond to your specific claim directly, because I just said I wouldn't do that above. If you really want to hear my opinions bring this up in some other thread, or just wait for someone else to make the argument ;) But I would like to ask you if what you're saying is validated by actual silicon, and if so, under which constraints. Does "microarchitectures can then fuse these" actually pan out? Do the (size, mainly?) savings actually help in the contexts it is claimed it targets (embedded?). How do other contexts (server, desktop) feel about this? Is it useful for them? Perhaps it is actively harmful for what they want to do?
- o11c 3y agoDesigning for fusion is valid, but RISC-V has a lot of cases that boil down to "use a 12-byte fused instruction where other architectures do it in 4 bytes". L1i matters, people!
- _chris_ 3y ago> L1i matters, people! RISC-V consistently wins on L1i footprint. The complaining is about number of dynamic instructions ("path length"), which can hit you if you don't fuse. Of course, path length might not actually be the bottleneck to raw performance, but it's an easy metric to argue, so a lot of people latch on to it.
- brucehoult 3y agoAlso the difference in number of instructions on real programs is in the 10% range, which could well be compensated by other factors. For example, keeping to simpler instructions might well result in a 10% higher clock speed and lower silicon area too, equalising matters if not gaining an advantage.
- snvzz 3y ago>The complaining is about number of dynamic instructions ("path length"), which can hit you if you don't fuse. Ironically, RISC-V does great there[0]. Note this is despite these researchers did not even consider fusion. 0. https://dl.acm.org/doi/pdf/10.1145/3624062.3624233 https://dl.acm.org/doi/pdf/10.1145/3624062.3624233
- dzaima 3y agoDunno about "great" - "For 6 out of 10 mini-app+compiler pairs, Arm has a shorter path length, with the overall average difference when weighting each benchmark equally being 2.3% longer for RISC-V."
- snvzz 3y agoWhile applying the worst possible reading to RISC-V, and despite not considering fusion, it is not worse than ARM. That's awesome.