logoalt Hacker News

newpavlovyesterday at 9:22 PM6 repliesview on HN

In some cases RISC-V ISA spec is definitely the one to blame:

1) https://github.com/llvm/llvm-project/issues/150263

2) https://github.com/llvm/llvm-project/issues/141488

Another example is hard-coded 4 KiB page size which effectively kneecaps ISA when compared against ARM.


Replies

weebullyesterday at 10:50 PM

All of those things are solved with modern extensions. It's like comparing pre-MMX x86 code with modern x86. Misaligned loads and stores are Zicclsm, bit manipulation is Zb[abcs], atomic memory operations are made mandatory in Ziccamoa.

All of these extensions are mandatory in the RVA22 and RVA23 profiles and so will be implemented on any up to date RISC-V core. It's definitely worth setting your compiler target appropriately before making comparisons.

show 6 replies
tostitoday at 4:59 AM

Regarding misaligned reads, IIRC only x86 hides non-aligned memory access. It's still slower than aligned reads. Other processors just fault, so it would make sense to do the same on riscv.

The problem is decades of software being written on a chip that from the outside appears not to care.

show 3 replies
adastra22yesterday at 9:27 PM

Also the bit manipulation extension wasn't part of the core. So things like bit rotation is slow for no good reason, if you want portable code. Why? Who knows.

show 3 replies
GoblinSlayertoday at 7:11 PM

> 1) https://github.com/llvm/llvm-project/issues/150263

Huh? They have no idea what they are doing. If data is unaligned, the solution is memcpy, not compiler optimizations, also their hack of 17 loads is buffer overflow. Also not ISA spec problem.

torginustoday at 9:31 AM

Unaligned load/store is a horrible feature to implement.

Page size can be easily extended down the line without breaking changes.

direwolf20today at 4:11 AM

The first one is common across many architectures, including ARM, and the second is just LLVM developers not understanding how cmpxchg works