Live data from Hacker News

Why is Rosetta 2 fast?

dougallj.wordpress.com

151–160 of 367 posts

Re: Why is Rosetta 2 fast?

#151

> Rosetta 2 translates the entire text segment of the binary from x86 to ARM up-front. Do I understand correctly that the Rosetta is basically a transpiler from x86-64 machine code to ARM machine code which is run prior to the binary execution? If so, does it affect the application startup times?

> If so, does it affect the application startup times? It does, but only the very first time you run the application. The result of the transpilation is cached so it doesn't have to be computed again until the app is updated.

Similar to DEC's FX!32 in that regard. FX!32 allowed running x86 Windows NT apps on Alpha Windows NT.

Re: Why is Rosetta 2 fast?

#152
post #148

Earlier quoted context omitted.

I am the creator / main author of Rosetta 2. I don't have a blog or a Twitter (beyond lurking).

Thanks for your amazing work! May I ask – would it be possible to implement support for 32-bit VST and AU plugins? This would be a major bonus, because it could e.g. enable producers like me to open up our music projects from earlier times, and still have the old plugins work.

[deleted]

Re: Why is Rosetta 2 fast?

#153
post #55

Earlier quoted context omitted.

Apple reportedly has already ported many of it's secondary cores to RISC-V Really? In current hardware or is this speculation?

If you've got some management core somewhere in your silicon you can, with RISC-V, give it a MMU but no FPU and save area. You're going to be writing custom embedded code anyways so you get to save silicon by only incorporating the features that you need instead of having to meet the full ARM spec. And you can add your own custom instructions for the job at hand pretty easily. That would all be a terrible idea if you…

Arm64 allows FPU-less designs. There are some around…

Re: Why is Rosetta 2 fast?

#154
post #55

Earlier quoted context omitted.

>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 unrea…

Apple reportedly has already ported many of it's secondary cores to RISC-V Really? In current hardware or is this speculation?

>Many dismiss RISC-V for its lack of software ecosystem as a significant roadblock for datacenter and client adoption, but RISC-V is quickly becoming the standard everywhere that isn’t exposed to the OS. For example, Apple’s A15 has more than a dozen Arm-based CPU cores distributed across the die for various non-user-facing functions. SemiAnalysis can confirm that these cores are actively being converted to RISC-V in future generations of hardware.[0]

So to answer your question, it is not in currently in hardware, but it is more than just speculation.

[0]https://www.semianalysis.com/p/sifive-powers-google-tpu-nasa...

Re: Why is Rosetta 2 fast?

#155
post #89

Rosetta 2 is great, except it apparently can't run statically-linked (non-PIC) binaries. I am unsure why this limitation exists, but it's pretty annoying because Virgil x86-64-binaries cannot run under Rosetta 2, which means I resort to running on the JVM on my M1...

Rosetta can run statically linked binaries, but I don’t think anything supports binaries that aren’t relocatable.

  $ file a.out
  a.out: Mach-O 64-but executable x86_64
  $ tool -L a.out
  a.out:
  $ ./a.out
  Hello, world!

Re: Why is Rosetta 2 fast?

#156
post #89

Rosetta 2 is great, except it apparently can't run statically-linked (non-PIC) binaries. I am unsure why this limitation exists, but it's pretty annoying because Virgil x86-64-binaries cannot run under Rosetta 2, which means I resort to running on the JVM on my M1...

Statically linked binaries are officially unsupported on MacOS in general, so there's no reason to support it on Rosetta either. It's unsupported in MacOS because it assumes binary compatibility on the kernel system call interface, which is not guaranteed.

Rosetta was introduced with the promise that it supports binaries that make raw system calls. (And it does indeed support these by hooking the syscall instruction.)

Re: Why is Rosetta 2 fast?

#157

I am interested in this domain, but lacking knowledge to fully understand the post. Any recommendations on good books/courses/tutorials related to low level programming?

I’d recommend going through a compilers curriculum, then reading up on past binary translation efforts.

Re: Why is Rosetta 2 fast?

#158
post #44

I wonder how much hand-tuning there is in Rosetta 2 for known, critical routines. One of the tricks Transmeta used to get reasonable performance on their very slow Crusoe CPU was to recognize critical Windows functions and replace them with a library of hand-optimized native routines. Of course that's a little different because Rosetta 2 is targeting an architecture that is generally speaking at least as fast as the…

Haven’t spotted any in particular.

Re: Why is Rosetta 2 fast?

#159
post #62

Earlier quoted context omitted.

>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 unrea…

For me, those two points make it clear that it would be possible for Apple to port to RISC-V. But it's still not clear what advantages they would gain from doing so, given that their ARM license appears to let them do whatever they want with CPUs that they design themselves.

The first point precludes Apple's gain from the discussion.

Re: Why is Rosetta 2 fast?

#160

Earlier quoted context omitted.

Thanks for your thoroughly objective insights. I especially appreciate the concrete examples.

Here you go for a concrete example: https://news.ycombinator.com/item?id=33493276

This has nothing to do with Rosetta being incomplete (it has pretty good fidelity).
Post reply on HN