Live data from Hacker News

Why is Rosetta 2 fast?

dougallj.wordpress.com

31–40 of 367 posts

Re: Why is Rosetta 2 fast?

#31

I hope Rosetta is here to stay and continues developement. And I hope what is learned from it can be used to make a RISC-V version of it. translating native ARM to RISC-V should be much easier than x86 to ARM as I understand it, so one could conceivably do x86 -> ARM -> RISC-V.

More likely to be useful RISC-V to Arm then Apple can support running virtual machines for another architecture on its machines.

Re: Why is Rosetta 2 fast?

#32
post #17

It is quite astonishing how seamless Apple has managed to make the Intel to ARM transition, there are some seriously smart minds behind Rosetta. I honestly don't think I had a single software issue during the transition!

It isn't their first rodeo: 68k->PPC->x86_64->ARM.

Re: Why is Rosetta 2 fast?

#33
post #9

Not having any particular domain experience here, I've idly wondered whether or not there's any role for neural net models in translating code for other architectures. We have giant corpuses of source code, compiled x86_64 binaries, and compiled arm64 binaries. I assume the compiled binaries represent approximately our best compiler technology. It seems predicting an arm binary from an x86_64 binary would not be insa…

I'm a ML dilletante and hope someone more knowledgeable chimes in, but one thing to consider is the statistics of how many instructions you're translating and the accuracy rate. Binary execution is very unforgiving to minor mistakes in translation. If 0.001% of instructions are translated incorrectly, that program just isn't going to work.

Re: Why is Rosetta 2 fast?

#34

This is a great writeup. What a clever design! I remember Apple had a totally different but equally clever solution back in the days of the 68K-to-PowerPC migration. The 68K had 16-bit instruction words, usually with some 16-bit arguments. The emulator’s core loop would read the next instruction and branch directly into a big block of 64K x 8 bytes of PPC code. So each 68K instruction got 2 dedicated PPC instructions…

That’s really interesting. You might enjoy reading about the VM embedded into the Busicom calculator that used the Intel 4004 [1]

They squeezed a virtual machine with 88 instructions into less than 1k of memory!

[1] https://thechipletter.substack.com/p/bytecode-and-the-busico...

Re: Why is Rosetta 2 fast?

#35
post #17

It is quite astonishing how seamless Apple has managed to make the Intel to ARM transition, there are some seriously smart minds behind Rosetta. I honestly don't think I had a single software issue during the transition!

having total control on the hardware and the software didn't hurt for sure

Qualcomm (and Broadcomm) has total control on the hardware and software side of a lot of stuff and their stuff is shit.

It's not about control, it's about good engineering.

Re: Why is Rosetta 2 fast?

#36
post #17

It is quite astonishing how seamless Apple has managed to make the Intel to ARM transition, there are some seriously smart minds behind Rosetta. I honestly don't think I had a single software issue during the transition!

If that blows your mind, you should see how Microsoft did the emulation of the PowerPC based Xeon chip to X86 so you can play Xbox 360 games on Xbox One. There's an old pdf from Microsoft researchers with the details but I can't seem to find it right now.

Any good videos on that?

Re: Why is Rosetta 2 fast?

#38
post #6

I hope Rosetta is here to stay and continues developement. And I hope what is learned from it can be used to make a RISC-V version of it. translating native ARM to RISC-V should be much easier than x86 to ARM as I understand it, so one could conceivably do x86 -> ARM -> RISC-V.

> I hope Rosetta is here to stay and continues developement. It almost certainly is not. Odds are Apple will eventually remove Rosetta II, as they did Rosetta back in the days, once they consider the need for that bridge to be over (Rosetta was added in 2006 in 10.4, and removed in 2011 from 10.7). > And I hope what is learned from it can be used to make a RISC-V version of it. translating native ARM to RISC-V should…

>That's not going to happen unless Apple decides to switch from ARM to RISC-V, and... why would they? They've got 15 years experience and essentially full control on ARM.

Two points here.

• First off, Apple developers are not binded to Apple. The knkwledge gained can be used elsewhere. See Rivos and Nuvia for example.

• Second, Apple reportedly has already ported many of it's secondary cores to RISC-V. It's not unreasonable that they will switch in 10 years or so.

Re: Why is Rosetta 2 fast?

#39
post #35

Earlier quoted context omitted.

having total control on the hardware and the software didn't hurt for sure

Qualcomm (and Broadcomm) has total control on the hardware and software side of a lot of stuff and their stuff is shit. It's not about control, it's about good engineering.

So many parts across the stack need to work well for this to go well. Early support for popular software is a good example. This goes from partnerships all the way down to hardware designers.

I'd argue it's not about engineering more than it is about good organizational structure.

Re: Why is Rosetta 2 fast?

#40
post #25
post #15

I remember years ago when Java adjacent research was all the rage, HP had a problem that was “Rosetta lite” if you will. They had a need to run old binaries on new hardware that wasn’t exactly backward compatible. They made a transpiler that worked on binaries. It might have even been a JIT but that part of the memory is fuzzy. What made it interesting here was that as a sanity check they made an A->A mode where they…

https://www.hpl.hp.com/techreports/1999/HPL-1999-78.html

It was particularly poignant at the time because JITed languages were looked down on by the “static compilation makes us faster” crowd. So it was a sort of “wait a minute Watson!” moment in that particular tech debate.

No one cares as much now days, we’ve moved our overrated opinion battlegrounds to other portions of what we do.

Post reply on HN