3 ms·
> Hang on. Limiting the Icache to only 32bit aligned access actually simplifies it. Even x86 only reads 16 or 32 byte aligned fields out of the I$, then shifts
by monocasa 3y ago
> Hang on. Limiting the Icache to only 32bit aligned access actually simplifies it.
Even x86 only reads 16 or 32 byte aligned fields out of the I$, then shifts them. There's not extra I$ complexity. You still have to do that shift at some point, in case you don't jump 32 byte aligned address. You also ideally don't want to only hit peak decode bandwidth starting on aligned 32 byte program counters, so that whole shift register thing is pretty much a requirement. And that's where most of the propagation delays are.
> RISC-V code is only about 6-14% denser than Aarch64 [1], I'm really not sure the extra complexity is worth it. Especially since Aarch64 still ends up with a lower instruction count, so it will be faster whenever you are decode limited instead of icache limited.
There's heavy use of fusion, and fwiw, the M1 also heavily fuses into micro ops too (and I'm sure the AArch64 morph of NUVIA's cores do too).
- Symmetry 3y agoUnder a classic RISC architectures you can't jump to non-aligned addresses. That lets you specify jumps that are 4 times longer for the same number of bits in your jump instruction. Here's MIPS as an example: https://en.wikibooks.org/wiki/MIPS_Assembly/Instruction_Formats#J_Instructions https://en.wikibooks.org/wiki/MIPS_Assembly/Instruction_Form...
- monocasa 3y agoClassic RISC was targeting about 20k gates and isn't really applicable here.
- Symmetry 3y agoAArch64 does the same thing. https://valsamaras.medium.com/arm-64-assembly-series-branch-9ce820987fc6 https://valsamaras.medium.com/arm-64-assembly-series-branch-... And it's not only a way of decreasing code size. It help with security too. If you can have an innocuous looking bit of binary starting at address X that turns into a piece of malware if you dump to instruction X+1 that's a serious problem. https://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-linux-systems-with.html https://mainisusuallyafunction.blogspot.com/2012/11/attackin... RISC-V, I'm pretty sure, enforces 16 bit alignment and is self synchronizing so it doesn't suffer from this despite being variable length. But if it allowed the PC to be pointed at an instruction with a 1 byte offset then it might be. As far as I'm aware every RISC ISA that's had any commercial succss does this. HP RISC, SPARC, POWER, MIPS, Arm, RISC-V, etc.
- monocasa 3y ago> And it's not only a way of decreasing code size. And RISC-V has better code density than AArch64. > It help with security too. If you can have an innocuous looking bit of binary starting at address X that turns into a piece of malware if you dump to instruction X+1 that's a serious problem. JIT spraying attacks work just fine on aligned architectures too, hence why Linux hardened the AArch64 BPF JIT as well: https://linux-kernel.vger.kernel.narkive.com/M0Qk08uz/patch-arm64-next-v2-net-bpf-arm64-address-randomize-and-write-protect-jit-code https://linux-kernel.vger.kernel.narkive.com/M0Qk08uz/patch-... Additionally, MIPS these days has a compressed extension to their ISA too, heavily inspired by RV-C. https://mips.com/products/architectures/nanomips/ https://mips.com/products/architectures/nanomips/
- Symmetry 3y agoNot all JIT spraying relies on byte offsets to get past JIT filters, the attack I gave is just an example. And NanoMips requires instructions to be word aligned just like everybody else, it's just that it requires 16 bit alignment rather than 32. Attempting to access an odd PC address will result in an access error according to this: https://s3-eu-west-1.amazonaws.com/downloads-mips/I7200/I7200+product+launch/MIPS_nanoMIPS32_MT_TRM_01_17_MD01255.pdf https://s3-eu-west-1.amazonaws.com/downloads-mips/I7200/I720...
- monocasa 3y ago> And NanoMips requires instructions to be word aligned just like everybody else, it's just that it requires 16 bit alignment rather than 32. Attempting to access an odd PC address will result in an access error according to this: That's the same as RV-C.
- Symmetry 3y agoRight, and I mentioned RISC-V as yet another sane RISC architecture that requires word alignment in instruction access. But the fact that it requires alignment means that the word size has implications for the instruction cache design and the complexity of the piping there. I don't have a strong opinion on whether the C extension is a net good or bad for high performance designs, but I do strongly believe that it comes with costs as well as benefits.