Live data from Hacker News

The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

twitter.com

21–30 of 30 posts

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#21
post #20
post #18

Earlier quoted context omitted.

Congrats! What was the main technical challenge of this project and what was the solution?

The first commit in what would eventually become Tango was all the way back in 2014, so this project has been in development for a long time. As such there have been many technical challenges. One challenge that particularly comes to mind was dealing with anti-emulating/anti-debugging code in various Android applications. These apps would do all sorts of crazy things like attaching to themselves with ptrace, installi…

Sounds similar to the effort that went into supporting legacy DOS and Win3.1 applications on NT, back in the day.

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#22
post #20
post #18

Earlier quoted context omitted.

Congrats! What was the main technical challenge of this project and what was the solution?

The first commit in what would eventually become Tango was all the way back in 2014, so this project has been in development for a long time. As such there have been many technical challenges. One challenge that particularly comes to mind was dealing with anti-emulating/anti-debugging code in various Android applications. These apps would do all sorts of crazy things like attaching to themselves with ptrace, installi…

> One challenge that particularly comes to mind was dealing with anti-emulating/anti-debugging code in various Android applications

While I don't care or want to digress into the ethics of this suggestion, if you had the expertise, wouldn't it be significantly more valuable to author automation APIs for TikTok, Snap, Instagram, Messenger etc.?

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#23
One thing I'm curious about translators like these: are they smart enough to convert software polyfill functions to hardware instructions? For example, armv7a doesn't have a divide instruction, so a software polyfill function is used (like __aeabi_idiv). Do translators recognize these common software functions and translate them to native instructions (i.e. sdiv in this example)?

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#25
post #14

Hello HN! I'm the main developer behind the Tango binary translator. I'm happy to answer any questions you may have about the technology.

Hi! I'm interested in what has to happen for a (presumably) pretty small company to supply such an integral piece. It seems to me like everyone from Qualcomm over Android to manufacturers would want this. Why did you have to build it instead of them? And is Xiaomi the entity licensing it from you? Does this mean that there will likely be implementations of the Snapdragon 8 Gen 3 that don't support 32 bit apps? Is thi…

When ARM released AArch64, it was a completely new instruction set rather than an extension of the existing 32-bit ISA (like x86-64). AArch64 is a much better designed ISA than AArch32 and supporting both in hardware effectively doubles the complexity of the instruction decoder, so it was clear that eventually there would be AArch64-only CPUs (as there are today).

The technology behind Tango started as a research project while I was doing my PhD. After finishing my dissertation in 2016, I looked into opportunities to commercialize it by contacting every company that was building or planning to build an AArch64-only CPU. There are sufficiently few that it is easily doable even for a small company.

Building a production-ready binary translator is technically challenging and requires a lot of work. The difficult parts are achieving high performance (Tango scores within 10% of native 32-bit execution on benchmarks), low latency (using AOT translation to accelerate startup times) and compatibility (Tango was tested against the top 1000 Android apps and works with all of them).

Already by 2017, Tango was capable of translating AArch32 Android applications. At that point it makes more sense for companies to license our technology rather than developing their own implementation from scratch.

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#26
post #20

Earlier quoted context omitted.

The first commit in what would eventually become Tango was all the way back in 2014, so this project has been in development for a long time. As such there have been many technical challenges. One challenge that particularly comes to mind was dealing with anti-emulating/anti-debugging code in various Android applications. These apps would do all sorts of crazy things like attaching to themselves with ptrace, installi…

> One challenge that particularly comes to mind was dealing with anti-emulating/anti-debugging code in various Android applications While I don't care or want to digress into the ethics of this suggestion, if you had the expertise, wouldn't it be significantly more valuable to author automation APIs for TikTok, Snap, Instagram, Messenger etc.?

The "proper" solution would be for apps to support 64-bit, at which point they can just run natively on the device. The whole reason Tango is required is that there is still a large number of apps that use 32-bit native libraries. This is particularly true in markets such as China which don't use the Google Play Store.

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#28

Wrong title! It has a 64- to 32-bit translator! Not the other way around!

No, the title is right

I think a better name would of been

AArch32 to AArch64 translator, because it may imply that the apps are suddenly running as 64bit applications

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#29
post #10

TBH, it has always been surprising to me that this wasn't a default feature in Android. It couldn't be that difficult to add. Then again, they want to support small storage sizes, so maybe discouraging the OS from growing too much with redundant 32 and 64 bit versions of base libraries is the real reason?

I don't think Android has a big priority on storage size, every APK bundles all of its dependencies (except for ART), so if multiple apps use the same exact library and version, that library's code will not be shared among them

Re: The Xiaomi 14 with the new Snapdragon 8 Gen 3 has a 32 to 64-bit translator

#30

One thing I'm curious about translators like these: are they smart enough to convert software polyfill functions to hardware instructions? For example, armv7a doesn't have a divide instruction, so a software polyfill function is used (like __aeabi_idiv). Do translators recognize these common software functions and translate them to native instructions (i.e. sdiv in this example)?

That's a good question, I don't know.

I suspect the specific case of sdiv may be practically handled already for post-div Armv7a and ARMv8a AARCH32 on dynamically loaded operating systems, either by the dynamic loader or the compiler support library choosing to swap in a different implementation of __aeabi_idiv according to the available capabilities.

Post reply on HN