Top
Best
New

Posted by dmitrygr 1 day ago

RISC-V: They Should Have Known Better(dmitry.gr)
315 points | 368 commentspage 3
weakhead 4 hours ago|
I'm amused that the story doesn't even mention the 4k pages - way too small for anything but embedded systems today.
deepsun 2 hours ago||
> So what does it even mean to comply with the spec then, if everything is optional?

Similarly, I kept saying it for long that a file/wire format's usefulness is not in what it supports, but in what it forbids. A binary file supports any type of data, but it's not useful.

UncleOxidant 1 day ago||
Is there a RISC-VI in the works where they try to learn from the RISC-V mistakes to make improvements?
dmitrygr 1 day ago|
Given the amount of learning that could have been done before RISC-V and wasn’t, I wouldn’t have such high hopes.
ksec 4 hours ago|||
This and exactly this. If there is anything I learned in the past 15 to 20 years, I doubt it will be any different. The mentality of development is just different.

I want the iteration of the product that is in its 2nd or 3rd official iteration. Where you have a lot of learning done and battle tested. Preferably without the backward compatibility to create something truly beautiful. Would it be perfect? Of course not. But it will be Great.

I so wish ARM had some counter offering. They might as well give away their their low end design for free.

phire 1 day ago|||
Considering just how many of the problems seem to come from RISC-V being a clean-sheet design, I suspect we would be better off not doing another.

What I am interested in is the idea doing an AArch64 style revamp of the ISA, were much of the non-encoding semantic stuff is kept, but the entire instruction encoding (plus all the CSRs, and other things) are reworked to be sane.

You might even do two reworkings in parallel, with one variable-width encoding optimised for microcontrollers, thumb-style; And the other being a fixed-width encoding optimised for wide out-of-order cores.

And at the same time, you make a bunch of extensions mandatory, and unify others into bigger chunks; Code compiled to one of these two encodings would know it had access to a much wider range of instructions.

The idea would be that any C code targeting RISC-V can be compiled to this encoding with close to zero changes, and that mechanical translation of exiting RISC-V binary code should be "possible", as none of the underlying semantics have changed. And the same would help any core wanting to natively support both (or all three) encodings, you would only need a front-end translator.

acutelittlebox 1 day ago||
I feel like that's largely mitigated by profiles. RVA23 is really looking like it'll be the modern base target used for high performance application processors and it makes mandatory pretty much everything you'd want for those use cases, and other comments by people familiar with designing RISC-V CPUs mention that the variable length encoding can be dealt with in a very simple manner that doesn't even add another pipeline stage so it doesn't seem like it's all that big of a deal while also bringing in benefits in code size reduction. Not everyone is adopting it, but several major players have set the stage by mandating it.
phire 5 hours ago||
Well, the revamp I’m suggesting would essentially be implemented as a RISC-V new profile, just with a different instruction encoding.
tonypapousek 1 day ago||
Always good to see stuff from Dmitry; his presentation (Linux/4004) at last year’s Teardown was awesome.
baron3dl 16 hours ago||
This feels like Andy Tennenbaum's LINUX is OBSOLETE post from 30 years ago.
theamk 16 hours ago|
don't see how? the last section is pretty explicit:

> None of this is to say that RISC-V is doomed. As I said, I fully expect it to take over the space currently occupied by [...] Much like the linux kernel -- the price is right.

monocasa 1 day ago||
> The second category for big-compute is actual desktops and SBCs that do interactive computation, browsing, gaming, and other such "desktop work". I do not expect RISC-V to be a serious player at the top of this market. Simply put, the architecture is not designed for it, as pointed out above. Additionally, this market has the margins to afford licensing a much-better-designed aarch64 core from ARM, and gain proper support from a much larger corpus of software. Before you get your megaphone to shout about "openness", please note that the openness of the RISC-V spec is not relevant here at all, because an open spec does not magically materialize a well-designed out-of-order core for you for free. And if someone were to design a good out-of-order core, they would not be giving it away for free. An open spec does not mean every implementation is free.

I basically disagree with this. Not because this isn't the current state of things (it absolutely is), but because we're at a bit of an inflection point where mooore's law has proved itself to be an scurve, and we're very clearly well into the top half of it. From that, gate counts per core will also start to ossify, and that means the longer latency for getting an open core design off the ground initially will also start to make sense.

phire 1 day ago||
I'm not sure the gate count argument works in RISC-V's favour.

While RISC-V is quite optimised for gate count for small cores; In large wide OoO cores the variable length encoding really bulks out the decoders.

You basically have the same requirement as x86, where you have to attempt to decode a 32-bit instruction every 16-bits (because there is no alignment guarantee for 32-bit instructions), and then cancel out the invalid ones. It's not quite a bad as x86, you only need to look at two bits, but it still forms a long dependency chain, and probably requires at least one extra decode stage with complex routing to pick out all the valid instructions.

monocasa 1 day ago|||
You don't really have to have a separate decoder every 16-bits. What you have is a length decoder every 16 bits (so just a single nand gate over the first two bits versus a huge chunk of the prefix/opcode part of the decoder for x86), which then feeds into a set of muxes for the actual decoders. The actual increase in complexity ends up coming from the critical path of the stack up of length selection affecting start addresses (and therefore mux selections) for later instructions in the block, but even that's not nearly as bad as it sounds because you can use the same base trick behind a carry lookahead adder. When I did some experiments a while back, it ended up being less than half a pipeline stage overhead versus fixed width instructions kind of across the board.

So not nothing, but very far from a deal breaker even for wide 8, 10, or even 12 wide cores.

brucehoult 1 day ago|||
> you can use the same base trick behind a carry lookahead adder

YESSSS.

I've been pointing this out for years and years.

By the point that you're looking at the same propagation delay as a common 64 bit adder you're decoding 64 chunks of 16 bits per cycle. That's 128 bytes, or a 32-64 instructions wide decoder.

That is so much wider than anyone is making or contemplating — or that even makes sense given the size of basic blocks — that it's just a non-issue.

imtringued 1 day ago||
And even if you go to those extremes, the biggest nay sayer says the cost of the design flaw will require you to double the number of decoders, which hardly sounds like a big deal to me.
brucehoult 1 day ago||
It's not even double, because half of them are RVC-only decoders.
phire 9 hours ago||
The annoying thing about RVC is that 32-bit instructions can now appear misaligned. I would be far less annoyed about RVC if it didn't break alignment, as you could solve the problem with a bunch of RVC-only decoders at the misaligned offsets.

So you either need (almost) double the number of full decoders, or a length decode and a bunch of shifters to get each decoder the right input bits (which get larger the wider the front end is. The 8th instruction can be at one of 7 possible offsets)

phire 1 day ago||||
Yes... but then you are kind of wasting a pipeline stage on nothing more than length decoding.

I suspect a design with a full decoder every 16-bits might actually win on everything but gate count, mostly because it can deal with variable length instructions and variable number of μops per instruction in the same step. A decoder that doesn't output a μop because it was clobbered by a previous instruction, can be handled the same was as a decoder that didn't output a μop because of μop fusion.

Actually, that approach might actually eliminate the need for the extra pipeline stage (just at the cost of gates).

It's certainly not a deal breaker. But it's a valid criticism of the ISA.

monocasa 1 day ago|||
I said easily less than half a pipeline not a full stage. Everything kind of shifts around a bit because of that, and it ends up being a pretty different design than a fixed width front end because of it (hence qualcomm's objections), but it's not clearly worse.

And for better than aarch64 density, it seems to make a lot of sense.

imtringued 1 day ago|||
Ok, so you doubled the number of decoders, how is that not significantly better than x86?

I'm not even sure you have a point with regards to it being a valid criticism. Doubling the silicon area for instruction decoding probably costs nothing, because if you have a simple decompression stage, the maximum number of decoders is already doubled in the first place, because you're hypothetically encoding twice as many instructions to begin with. If you can double the decoders in the decompression stage, you can probably get rid of a separate decoding stage altogether and thereby reduce the cost to literally nothing.

Look, it might not be obvious but in university I once had to design an ASIP and then do the floor plan with Cadence and the area of the SRAM dwarfed everything to the point where my ASIP was a tiny vertical column in-between two SRAM chips. I personally was shocked by the fact that I struggled to even find my ASIP on the floor plan, because it was maybe ten standard cells wide in-between the SRAM blocks. Like, ridiculously tiny to the point where it is hard for me to even care about the area the ASIP took up.

camel-cdr 1 day ago||||
Nobody in high-performance does fixed-width instructions that allow lineary scaling parallel decoders. Arm basically requires certain instructions to be cracked into multiple uops before rename. That ends up analougus to decoding compressed instructions. RVC increases complexity before decode, how much that impacts things idk.
imtringued 1 day ago|||
I don't believe this will impact performance in practice, because nothing forces CPU vendors to implement fast compressed instructions. If compressed instructions become slower than non compressed instructions as the instruction decoders get wider, compilers will stop emitting them in the future.
inkyoto 1 day ago|||
> […] we're at a bit of an inflection point where mooore's law has proved itself to be an scurve […]

Well. May's law[0], which states that:

  Software efficiency halves every 18 months, compensating Moore's Law.
effectively counterbalances Moore's Law and, with continued technological process improvements and optimisations, the proverbial arm's race is likely to continue for a very, very long time – just a few days I was reading a wonderful article from 1998 on the state-of-the-art DEC Alpha 21264 CPU which mentioned the 21264 and POWER3 as the world's most complex CPU's each boasting 15+ million transistors and also mentioned the equally state-of-the-art 0.18 micron processes. The 3 old year M3 Max design, in comparison, supplies over 90 billion transistors to the mainstream consumer.

Humans are resourceful, after all.

[0] https://en.wikipedia.org/wiki/David_May_(computer_scientist)...

monocasa 1 day ago||
That's sort of orthogonal to what I'm saying.

And the M5 doesn't have 500B transistors. We're well into the beginning of the ossification. Hell, it arguably started ~2006 with the end of dennard scaling leaving us with Tomasulo OoO cores being the design that makes the most sense for application cores, just getting wider over time as we get more gates.

api 20 hours ago||
Eventually CPUs and GPUs converge: huge numbers of CPUs with wide vector units.
dmitrygr 1 day ago||
Whom do you expect to work for free to design you a state-of-the-art core?
monocasa 1 day ago|||
The same kind of people that 'worked for free' to develop Linux.
dismalaf 19 hours ago|||
Most Linux devs have been corporate employees getting paid to develop it for a very long time. It's not the early 90's any more.
monocasa 16 hours ago||
That's why I put 'worked for free' in quotes like that.
api 20 hours ago||||
Linux is decent for its core use cases, but it is far from a solid pro-grade OS in a lot of areas... and in the areas it did get there, it took a long time to get there.
dismalaf 19 hours ago||
> but it is far from a solid pro-grade OS in a lot of areas...

Insane take given all the things that run on Linux...

pocksuppet 10 hours ago||
It's server-grade. Not desktop-grade.
dismalaf 9 hours ago||
Tell that to Valve or the millions who use it as a desktop.

Also, have you used Windows recently?

dmitrygr 1 day ago|||
If those people build cores like linux kernel is built design-wise, i will PAY to watch the spectacle.

You do realize that Linux got basic SMP support 3 years after NT, and it was shaky for a while after? It still does not have reliable sleep-wake. And it only added native async file i/o in 2019, while NT has had it on the same hardware since 1993? So.. i'll expect an in-order core with an IPC south of 0.5 that cannot exit low power sleep 30% of the time in a decade or so.

monocasa 1 day ago||
> You do realize that Linux got basic SMP support 3 years after NT?

Linux started about three years after NT did. And NT could only support 64 processors for a long time when Linux could support thousands.

> It still does not have reliable sleep-wake.

Neither does NT really. Both depend on ACPI for the systems you're talking about, and it's the platform interface that's ultimately fucked.

> And it only added native async file i/o in 2019, while NT has had it on the same hardware since 1993

And has beaten NT on IO throughput for decades, and even now windows ships with a linux kernel integration because running Linux on a hypervisor is far batter for filesystem ops than running those on NT.

And the new async I/O API was so good that NT adopted it wholesale and didn't even bother changing the name. https://learn.microsoft.com/en-us/windows/win32/api/ioringap...

> So.. i'll expect an in-order core with an IPC south of 0.5 that cannot exit low power sleep 30% of the time in a decade or so.

There are already open source OoO RISC-V cores.

But the point originally isn't to be some Linux fan boy (I've written a decent amount of NT kernel code, and have a lot of respect for NT and the things it did right). It's to point out how the upcoming changes inherent to how chips are made and the latencies between gate count targets will better support open collaboration. And once that's supported properly, open source has a tendency to kind of snowball.

dmitrygr 1 day ago||
We shall see :) When my iPhone or laptop is no longer running aarch64, i'll happily admit i had been wrong
brucehoult 1 day ago|||
History is much easier than prediction.

I'm with Jim Keller when he says that in time the fastest CPUs will be RISC-V ones.

api 20 hours ago||
If China leapfrogs EUV, this could happen.
dismalaf 19 hours ago||
What does this have to do with anything? You do know that a bunch of American corporations are shipping RISC-V cores, right? Including Jim Keller's current company, Tenstorrent.
monocasa 1 day ago|||
I mean, Apple is different from pretty much every other manufacturer here. They collborated in the design of aarch64, and a rumored to own a lot of the base IP themselves which they've cross licensed with ARM. It's very close to AMD:Intel::Apple:ARM when it comes to aarch64. That heavily changes the licensing costs. My point isn't that RISC-V is markedly better, but instead that it's equivalent from a perf achievable from in the same nexus of PPA and NRE effort. So there's no reason for Apple to take the pain of a leap with no real gain, but NRE losses.

I would expect to see RISC-V Android phones (probably initially out of China, despite ARM China) within the next few years. They've been busy bees since RVA23 was ratified with a bunch of Chinese companies making changes to optimize AOSP for RVA23. I've also heard on the grapevine that NT already has a RISC-V port internally, but take that with whatever grain of salt you feel like. But Microsoft has already been contributing to the RISC-V specs (they contributed to Ztso for instance).

brucehoult 1 day ago||
There is zero chance that Apple doesn't have MacOS and iOS running on RISC-V in the lab.

They did that with x86 and Arm half a decade before any announcement about a switch, not to mention a number of other ISAs that didn't make it to shipping (e.g. M88k) and probably ones that word has never leaked about. IA64, anyone?

They're too large and rich and risk-averse to *not* do it.

dmitrygr 16 hours ago||
I do wonder, which of the two of us actually worked for years in Apple’s kernel team? :)
brucehoult 6 hours ago||
Not me for sure. I have no idea about you. Of household name companies I've only worked at Mozilla and Samsung R&D. And SiFive if you count people in threads such as this.

I could of course be wrong but I think the publicly known history sets the pattern pretty reliably for the speculation.

rablackburn 1 day ago|||
The future set of people who once would have "work(ed) for free to design you a state-of-the-art kernel"? If the tail is long enough passionate hobbyists will do it because they love it...eventually.
80x86 1 day ago||
100% agree with dmitrygr.

I was excited when I heard about the project just after it started. However, past experiences taught me to wait before getting excited about the new 'shiny thing'. I did it differently with RISCV. I waited. I am glad I did. It took a long time for actual silicon to appear. Also, the silicon today has all the facepalming special cases mentioned in the article. Its almost like those old soviet era cpus that had the list of bad instructions handwritten on the package.

Overall, RISCV was a minor spin on MIPS, but without really learning from other processors.

So why is everyone still pushing for it? It has the words 'open' on it. People pattern match on that marketing.

As part of that marketing, they also pushed this attitude from the project... 'RISC won'. I think Chester Lam said it best when he wrote his essay stating that RISC didn't win... OoO archs won. I couldn't articulate that nearly as well as he did. If you haven't read it, I recommend it.

So, yeah, here we are. Many people will follow the bandwagon, but they will find that RISCV will not make a significant difference.

I am glad we still have Arm (in all its many forms), x86, and others. (btw, despite my username, I don't think x86 is the best either :-)

Also, if you aren't trying to ship a product, you can experiment with ISAs on an fpga. Yes, fpgas are a lot slower, but they are also a lot more fun. Especially with the great work done to create open source toolchains. Heck, if you are really serious (slighly crazy), you can build your own chip. For the foreseeable future ASIC shuttles are available at prices under $10k. (again, you have to be a little crazy)

p_l 1 day ago||
I'd say RISC won, when you consider how "RISCy" x86 is[1] compared to the ur-CISCs (68k, VAX) that RISC projects were in opposition to.

[1] Not because of often-called "risc like" microcode engine, but because the most complex addressing mode on x86 usually decodes two microinstructions, and decodes in single cycle. In comparison VAX needed separate pipeline for instruction decoding.

rnvannatta 15 hours ago||
The two winning instruction sets are the RISCiest CISC, x86, and the CISCiest RISC, arm.
random__duck 1 day ago||
> slighly crazy

What a lovely euphemism.

Signed: someone slightly crazy.

mappu 1 day ago||
RVA23 hardware is available (e.g. SpacemiT K3)
Joel_Mckay 1 day ago|
Some are already on RVA23.1 even before the standard made it to more than 4 manufacturers product lines.

The meme joke about standards is sadly relevant for riscv. =3

https://xkcd.com/927/

d-us-vb 1 day ago|||
As I’ve come to understand it, standards simplify intensionally, not extensionally. For those who select a part that is compliant with a standard, more standards to choose from is better because engineers are able to make better tradeoffs; they’re not forced to select a part that does way more than the application needs thus making the product more expensive if there are lots of “competing” standards: some do less some do more.

For RV, a litany of standardized modules creates a system where each capability that the module provides will have a standard interface. No manufacturer is forced to invent extensions bespoke to their implementation, but they’re not forced to support everything the most powerful models do either.

Just my two cents.

ngl999 1 day ago||
That is given, vendors actually _know_ what exact practical applications they are building for.
Joel_Mckay 1 day ago||
Sure, the constellation of features is no longer a general purpose computer in the retail context, but rather an ASIC appliance the ends up incompatible/useless rather quickly.

Maybe Gentoo could tame that level of chaos... or people just buy ARM64 again knowing the software ecosystem already works. =3

camel-cdr 1 day ago|||
The RVA point releases don't add new mandatory features, so every RVA23 complient board is also RVA23.1 complient. They only add new optional extensions.
Joel_Mckay 23 hours ago||
Until people admit they made the same mistake as ARM6 fragmenting the architecture focus, its adoption will probably continue to stall under each firms hubris. =3

https://en.wikipedia.org/wiki/Second-system_effect

unfocso 14 hours ago|
Refreshing style of writing. I know nothing about ISAs, but the rant was so fun
More comments...