393 points · by soulbadguy · 3y ago · 212 comments
Current state of Android RISC-V support 2 years after those ignored contribution is literally "we have a working libc", which isn't great. My understanding of Google's presentation is that Android 14 (Q3 2023) will have interpreter-only jvm support for RISC-V, no JIT/AOT. (I'm surprised there is no pure C interpreter that would work anywhere, but well). So decent RISC-V support in Android may happen for Android 15, so Q3 2024.
Will there be weird ABI/ISA issues that will need few versions to iron out? Hard to say, armv5 didn't go smoothly, nor armv7 (hi neon-less nvidia), and risc-v's modularity might prove to be challenging on that regard.
Overall, even though Google/Android doesn't seem as pushy on risc-v as they pretend to be, I'd say Google/Android will indeed be ready when the risc-v industry is ready for prime time.
(It still is a mess, to be honest...)
But the change from ignoring risc-v contributions to saying it's important probably did come from a significant SoC manufacturer pushing for it, yeah.
The downside is that developers won't be able to test their stuff on the dev boards that are already available, which may harm the ecosystem on launch.
"As one might expect, the Arm64 architecture uses 64-bit pointers to address memory. There is no need (yet!) for an address space that large, though, so normally only 48 of those bits are actually used by the hardware."
...
"MTE allows the storage of a four-bit "key" in bits 59-56 of a virtual address — the lower "nibble" of the top byte. It is also possible to associate a specific key value with one or more 16-byte ranges of memory. When a pointer is dereferenced, the key stored in the pointer itself is compared to that associated with the memory the pointer references; if the two do not match, a trap may be raised."
From this article at the ever-wonderful lwn.net: https://lwn.net/Articles/834289/
Note that J is not a ratified extension, or even close to being so. It has been moving slowly for years (been a low priority), and now it is finally getting some attention, as higher priority items (such as H, B, V and Zc) are either done or final stages.
1. ARM is a RISC architecture, but it is proprietary/licensed, subject to export law, etc.
2. ARM is having a heyday, powering just about every mobile device, plus Apple's recent M1/M2 chips, and is also becoming more common on supercomputers and on servers
3. RISC-V is also a RISC, as the name implies, but is owned by a non-profit and intends to be open and easy to license
So next I would ask, do recent developments that make ARM so promising also make RISC-V promising? Do the decades of work that it took to make ARM the rising star also apply to RISC-V? How far away is RISC-V from being competitive with ARM at a technical level? Or is it already there?
Bonus question... given that both ARM and RISC-V have similar goals, how feasible is an abstract layer on top of them? Meaning, five years from now, how possible is it that I have a RISC-V phone that can run ARM binaries, and and ARM phone that could run RISC-V binaries?
RISC-V caught up, key functionality wise, with the set of extensions ratified in December 2021.
There's key advantages to RISC-V, licensing aside. It leverages industry experience and avoids many pitfalls thanks to not dragging any baggage.
Field experts such as Jim Keller sing praises about it.
RISC-V is designed with great care taken to weight all decisions as not to hamper any scope of implementation, from the lowest power microcontrollers to the fastest supercomputers, and everything in between.
This is unlike e.g. ARMv8/aarch64, which imposes too much complexity (>700 instructions) to small implementations, and hampers all implementations due to low code density.
In small implementations where performance isn't paramount but 64bit is required (for e.g. addressing, as is the case in many specialized tiny cores embedded in larger SoCs), bad code density increases ROM and/or RAM requirements as code takes more space, thus area and power. If 64bit is not needed, aarch32 can be used, which has much higher density, yet as of recent B and Zc extensions, RISC-V is better still, and can be tailored to the requirements, down to as simple as ~42 instructions and 16 registers (rv32e).
In large implementations, such as Apple's M1/M2, aarch64's awful code density imposes a large L1$ code cache in order to keep the pipelines fed. Large L1$ are very costly, as latency, area and power go up quickly with cache size, and maximum clock drops as size increases. Keep in mind that, in current fab nodes, SRAM is far more costly than logic
In contrast, RISC-V offers industry-leading code density through a form of variable instruction size that takes great care to not complicate decoder parallelism. There are already multiple large scale RISC-V cores announced with 8-wide decode (like Apple M1/M2).
As an example Apple designed their processors from scratch, they do not use any core designs provided by the ARM holdings corporation. Yet they still have to pay ARM a lot of money because they use their instruction set.
The instruction set is a very sticky thing. All the software gets written for a particular instruction set, and people like to keep using previously written software. Thus, software stickiness causes CPU ISA stickiness which gives companies that control that particular ISA a lot of power. And they of course monetize that power by charging extra for their CPUs.
With an open ISA, anybody can make processors that use the same instructions, which means that your software should work on any CPU designed for that particular ISA. Thus, all the talented hardware designers in the entire world can work to make RISC-V processors without asking for permission. They are free to charge for their designs or make them open. And if you write RISC-V code, it can execute on any of those processors or any future ones anyone decides to develop. (There is a bit of complication here in that the RISC-V ISA includes several different combinations for instructions for different use cases, but they are all open).
Having an ISA with functionality parity is the table stakes. But having designs actually capable of outperforming the current generation of ARM cores will be a real challenge.
Can SoC vendors design their next generation with RISC-V application cores? Sure, but no one will want it if it's slower or results in lower battery life. So far they've mostly only dipped their toes in the water with RISC-V microcontrollers. Google's explicit desire for a tier-1 RISC-V Android probably will help break a stalemate and get SoC vendors to ship something. It will very likely not debut as a flagship. But releasing a RISC-V phone that performs "adequately" would be an accomplishment that will flush out a lot of issues.
The actual instruction sets are not compatible: they both have different instructions, different ways of encoding instructions and so on.
It's a bit like an AK-74 and an AR-15. Both are classified as assault rifles based on some defining properties, but they're designed and built completely different, so you can't take say a full magazine from an AK-74 and make it work in an AR-15.
So no, you won't be able to take your ARM binary and run it unaltered on a RISC-V core.
Is the single remaining major runtime that's still not ported to RISC-V.
Therefore, the answer is: Not yet.
Risc-V is no more compatible with ARM than ARM is with Intel.
ARM vs. RISC-V is irrelevant
The only thing that really ever matters is the quality of any given specific CPU implementation, which has almost nothing to do with CISC vs. RISC or the ISA[1]. x86 has been dominate for so incredibly long because Intel just consistently made the best processors around, and #2 in the space was also usually AMD. This is why Apple switched to Intel in the first place, after all. Don't forget that Apple switched off of RISC to CISC and got huge increases in performance & efficiency as a result.
Apple's M1/M2 are good because they invested an absolute shit-ton of money building up a seriously good in-house CPU team over the past 10 years, not because it uses ARM's ISA. In fact, M1/M2 support x86's memory model - it's a key reason that Rosetta 2 runs so fast.
So for a RISC-V phone to show up in let's say the mid-range or higher market and be competitive would take someone actually building a good RISC-V CPU implementation. Which maybe sifive will pull off - their new performance lineup looks decent enough on paper anyway. But that's also compared to the 2-year old Cortex A78 which is itself quite a ways behind Apple's M2 / Bionic A14. So that's what you really need to find for a RISC-V phone/laptop/whatever to be interesting - someone who can, ideally consistently, deliver a CPU core design that's competitive with {Apple, ARM, Intel, AMD}. And that list only even barely includes ARM - their CPU cores are by far the weakest of that set. Which is itself a significant asterisk on the whole "ARM servers!" thing.
1: the small but significant asterisk on that is it's plausible, if not likely, that Apple was able to build an 8-wide CPU frontend as a direct result of armv8 not being a VLA ISA whereas x86_64 is. However that's also arguably more a function of the ISA's encoding than the ISA or CISC vs. RISC debate. In theory you could have an x86_64 instruction set that's not VLA, just like ARM used to have thumb/thumb2 and non-thumb modes back in the day.
Power matters a lot and 5% isn't almost nothing. And that's an estimate from an x86 vendor.
Agreed that it's almost certainly third though behind process and design. Intel's CPU leadership for a long time of course is not unconnected with its process leadership.
[1] https://www.nextplatform.com/2022/10/03/the-steady-hand-guid...
You could also save way more than 5% power by just optimizing user space a tiny amount
For others, like Qualcomm, Samsung, or Amazon, they are licensing the ARM-designed CPU cores not designing their own in-house. So they wouldn't be able to switch those to RISC-V, it's not their IP.
That’s called Java and Android already has it
Because vendors won't have to release device kernels any more, and will be able to use arbitrary ISA extensions they're under no impulse to distribute, the industry will achieve the ultimate nirvana last enjoyed by AT&T before the breakup -- this hardware is not yours, we will not be releasing technical information about it, and God help you if we catch you opening it up!
It's been a long road but I really think we'll see the return of the "no user serviceable parts inside" sticker, only for phone software this time around.
Also this should push anyone over the edge about using copyleft licenses, if you are complaining about unusable android without google services now, having no Roms all together is even worse.
It was definitely more power hungry than comparable competitors and not noticeably faster.
RISC-V is "permissionless". Grab a core from github, grab the freely available specs, and start working. No up front agreement, no fees down the road. For Arm you have to enter a legal agreement before you can start, and then negotiate licensing for your product.
Also Arm have been acting aggressively recently which doesn't make other customers feel happy: https://www.theregister.com/2022/11/01/qualcomm_arm_cpu/
2021 royalty revenues were up 20% to a record $1.54Bn, helped by continuing strong growth of 5G smartphones, more ADAS and IVI chips going into cars, and price increases in 32-bit microcontrollers."
Source: https://www.arm.com/company/news/2022/05/arm-delivers-record...
The royalties are higher on the newer more complex designs, so the 29.2 billion chips number can't really be used to derive a proper price per chip.
Don't even get people started on the perpetual and architectural licensing too.
What's the rough size of the end markets for the devices the chips are in? Like hundreds of billions of dollars of revenue?
RISC-V is the future, and Google itself already has some public RISC-V designs.
The expectation is that some Pixel in not so distant future will debut with a highly competitive RISC-V SoC.
https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0...
Is this going to primarily be the newest chipset for cheap Kindles?
RISC-V is not quite Pi 4 level on the fastest SBC you can buy today, the VisionFive 2, where some kickstarter backers have already received their boards. It's around 80% as fast as Pi 4.
Sipeed have announced their LM4A with TH1520 SoC will be on sale late Q1. They've published benchmarks running at 1.85 GHz showing it is faster than Pi 4 at that speed, but it is supposed to run at 2.5 GHz with a heatsink.
SiFive have announced that their HiFive Pro board will be shipping in the summer, using Intel's "Horse Creek" SoC (which in turn uses SiFive P550 cores). The SoC was demonstrated running by Intel back in September. SiFive says the board will run at 2.2 GHz. It's should be similar performance as an RK3588 at similar clock speed i.e. quite a lot faster than a Pi 4.
Multiple other companies are working on RISC-V SoCs with performance in Apple M1 class, which is much faster than anything ARM themselves has. They're further away -- 2024 or 2025 -- but there is basically no doubt that they will come.
Android software probably isn't going to be ready for prime time until 2024 or 2025 anyway.
Which companies?
And there was a floodgate opened for high perf core announcements at the recent RISC-V summit. https://www.semianalysis.com/p/ventana-risc-v-cpus-beating-n... Most of those are probably bullshiting some major aspect of their cores' perf but there's designs like from from Jim Keller's Tenstorrent too. Jim Keller is sort of known for not bullshitting.
I think there's a lot of potential here and probably a bit less over-promising than you'd get from companies without such experienced design talent.
Specifically, I know two ways:
0. VisionFive 2's SoC has drastically faster GPU and overall better peripherals
1. Raspberry Pi 4 will overheat and heavily throttle at the slightest hint of load. With this in mind, VisionFive 2's CPU will in most situations be faster, by virtue of not throttling.
*. Most heatsinks only mitigate this situation partially. You'd need either active cooling, or to get a 400 instead, which whole keyboards very effectively acts as heatsink.
The ecosystem could slowly grow through hobbyists, niche devices, special-purpose compute appliances, blah blah… or some entity with unlimited money could just do the short-term irrational thing and jumpstart one side of the equation.
This is about Android, which is very different from your average Linux system.
Current chips in cheap SBCs are already equal or above Raspberry Pi 4 level[0]. Particularly so when most Raspberry Pi 4 do not have a sufficient cooling solution and will be quickly throttled under load.
The fastest announced chips are competitive with the top x86-64 chips[1].
0. https://nitter.net/pic/orig/enc/bWVkaWEvRmozSEZOR1VvQUE4WWlP...
1. https://www.hpcwire.com/2022/12/13/ventana-plans-to-bring-ri...
I'm gonna need to see benchmarks before I believe that.
This defines the interface between hardware and software. If software and hardware both follow the specification, then the software will run on the hardware, and the hardware will run the software.
Both the hardware and the software could be entirely proprietary and extremely locked up, while compliant, as that'd fall well outside the ISA's scope.
The broadcom SOC closed source, and it doesn't have public documentation. Also it has a videocore core running a proprietary RTOS called microsoft ThreadX that does bootstrapping and some low level hardware stuff.
Never knew that Microsoft developed and owned ThreadX:
It's like ARM before v7 or v8, only dumber, because at least ARM back then had an excuse for why they were fracturing it all so badly.
Also, of course, ARM has lots of other IP you need to build a full-blown smartphone SoC; think GPU, display processors and pipelines, video accelerators, ... - to make a RISC-V smartphone you will have to buy all of those in because there is no "RISC-V ecosystem" replacement (and it's rather unlikely there ever will be) and at that point... what's the point anymore?
I think Fuchsia's main aim is to provide Google more control on the Android stack. "We will be able to do things more securely than Linux" reads like "We'll be able to close down devices even more while giving you a sense of openness" to me.
So, Google might be using RISC-V as another way to distance the platform from contemporary hardware/software ecosystem and make it practically harder to tinker/root/exploit beyond their (financial) comfort zone.
AIUI Fuchsia got stable driver APIs/ABIs, so the Linux rules do not apply.
A stable API/ABI cannot stop a determined company from deprecating your hardware.
There's a chance, but unless you checked for support in advance, a "good chance" seems like a bit of a stretch. Unless you mean unofficial builds, which are either too much work for most users, or not especially trustworthy.
On the other hand, an iPhone is usable for 9-10 years with updates and EOL support. You'll change your battery once in mid-life if you look after your device well.
That’s really the motivation here. I guess google is trying to stay ahead of being replaced in China?
To me, as a westerner, I‘d rather see ARM succeed than RISC-V. Despite ironically being designed in the west, rallying the world around an open instruction set I believe will primarily benefit China, who wants to lead in semiconductors. It gives them the ability to become big players without having to push a new ISA on the world, and if it becomes dominant on mobile, they could see themselves replacing Qualcomm, Intel etc. It is a zero sum game all around.
An ISA won't let China become a leader in semiconductor unless they implement it better than both western implementations of RISC-V and than ARM/Intel, the only thing it does is give an incentive to not rest on our laurels
I am also fundamentally uneasy about fundamental technologies being based on just a handful of companies, whether they are western or not, I know it happens but the less it happens the better imo
It is not. We consumers benefit from competition, and loose from higher prices and poorer products produced by monopolies.
Look where the "competition" of the last 30 years brought the Western world: domestic electronics production is all but dead outside of military and R&D depending on quick turnaround because it got moved off to China, Taiwan, Vietnam, Japan and South Korea, domestic pharmaceutics and chemical production is all but dead because India and China are absurdly cheaper, domestic steel production has taken serious hits for the same reason, animal welfare in farming is all but gone with farmers preventively feeding antibiotics to avoid immediate population collapse because the large meatpackers and chain stores act absolutely ruthlessly to make more profit, wages have gone down across the board when compared with inflation and large parts of our societies have no emergency funds...
> and loose from higher prices and poorer products produced by monopolies.
Competition itself is not bad, it keeps societies from stagnation - but too much and the side effects are now worse than the starting point. The Western world after decades of "competition" now depends on genocidal dictatorships (China), ordinary dictatorships (oil sheiks) and declining democracies (India) for its basic survival, and inside of our economies we got monopolies and oligopolies at a scale that was unbelievable even in the 90s.
I don't think this is something we want.
Lots of companies are throwing their hat in trying to design a riscv core.
You can do a riscv startup, its much harder to do an arm startup and near impossible to do an x86 one
This is China we're talking about here, they aren't rallying behind RISC-V because they like it. It's because they can't develop anything better than RISC-V, can't license x86 or ARM (which clearly are better than RISC-V) for obvious reasons, and so they're stuck with what they can get their grubby hands on.
If the west widely supports and adopts RISC-V in a way that doesn't exclude China, we are quite literally just playing into Chinese hands like the west has done time and time again.
Nurturing RISC-V in itself is a noble endeavour, but we must do so in a manner that doesn't hoist our own god damn petards.
Linux? What are you, a Chicom? Did you know they literally use that in North Korea?[0]
Industry wants RISC-V too.
The main difference to consumers is that less apps will be available since they haven't been ported to RISC-V
So if you spend a few $100M to a few $billion making a hot new risc-v core you are likely to add a few instructions for your intended use case/customer. The result will be significant fragmentation (which is already happening) which will make a mess of any OS and compiler support.
Think about it this way - what benefits would you get if each house had a different standard of electricity delivery? Let's say you have DC 300V, your neighbor AC 220V 50hz... meanwhile the building across the street was all three phase AC 150V 100hz. You wouldn't be able to buy a random TV and be sure that it works.
In the end either ARM or RISC-V will displace Intel x86. And you'll have much more progress, just like the progress in ARM space was much more rapid than x86 space.
The same asked of ARM, just look at the Surface critique.
And Android runs a VM, last time I checked..
But a significant fraction of apps still includes native libraries, too.
Only in China. And only at the bottom.
The ARM "premium" is a rounding error in anything that isn't a straight race to the garbage dump.
RISC-V, however, is a highly welcome development in all the <10 cent microcontrollers which have no standards, no tooling, no ISA, etc.
Also, watch for Si implanted back doors. Guaranteed to happen...
One big impediment to RISC-V now is GPU, but that is also coming on fast: https://www.allaboutcircuits.com/news/risc-v-universe-grows-...