Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

64-bit-computing-for-mobile

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

64-bit Computing

for Mobile
By David Whaley

October, 2018 White Paper

1
Introduction
This paper is intended for the Android application developer or technical decision maker
who wishes to learn about why the Arm 64-bit instruction set architecture (AArch64) is
an important mobile device building-block for the future. Additional information about
the advantages, benefits, and considerations for 64-bit Android application development
as well as guidance about where to find additional information is also provided.

In simple terms, “64-bit” generally refers to a device’s CPU. A 64-bit CPU is designed to
handle operations with integer numbers up to 64 bits in length. It will effectively process
larger chunks of data than a 32-bit device. A “64-bit” computer architecture also refers
to the processor’s register width which it uses for addressing and storing data. A 64-bit
address register can access enormous amounts of data, storing up to 264 unique memory
addresses while a 32-bit register can access up to 232 data addresses. In real numbers,
this works out to about 18 Exabytes (18 billion GB) for 64-bit versus 4GB for 32-bit.
A 64-bit processor can also operate more efficiently on larger data types from more
memory addresses than a 32-bit CPU. There are several factors that ultimately affect
how much performance uplift you might observe, but, in general, a 64-bit processor is
faster, spends less time fetching and loading data, and will be more responsive with
well-written software.

Why Arm 64-bit?


64-bit CPU architectures present several advantages in modern computing.
Arm’s “Armv8-A” architecture announced in 2011, supports larger address registers
allowing the processor to address more than 4GB of RAM. This allows a 64-bit CPU to
process a larger set of data stored in memory than a 32-bit processor, while also being
typically faster. Additional advantages include the ability to more efficiently manage
larger data structures, large arrays, and greater areas of memory.

Arm has continued to refine, innovate, and optimize both 64 and 32-bit architectures with
its cores and designs targeted at mobile computing. These are commonly referred to as
AArch64 and AArch32. There are limitations to the 32-bit architecture that could hamper
future innovation.

2
With the Android kernel ported to 64-bit, the reminder of the OS core libraries, modules,
and applications can run in either 32 or 64-bit. The Armv8 architecture is fully compatible
with the Arm 32-bit architecture, but new workloads such as artificial intelligence (AI),
machine learning (ML), 3D gaming, and even 4K displays are taxing the limits of the 32-bit
ISA (Instruction Set Architecture) and require more compute capabilities.

AArch32 implementations are reaching maturity and have limited opportunities for further
optimization. The 32-bit power-efficient capabilities and performance that we have all
enjoyed within our mobile devices over the past decade are becoming increasingly difficult
to improve. The optimizations that Arm can find and implement are yielding smaller
incremental improvements. The newer 64-bit ISA has the potential for greater performance
and efficiency gains given the same amount of engineering effort.

A 64-bit architecture allows for continuous and future innovation for power-efficient
mobile applications in Arm CPUs. To modernize and align the Android and Google-
driven ecosystems, efforts are currently underway to migrate native Android application
development to be predominately 64-bit capable.

Google’s 2017 Developer Blog Message


An Android Developer Blog post from Dec 19, 2017 announced, “In anticipation of
future Android devices that support 64-bit code only, the Play Console will require that
new apps and app updates with native libraries provide 64-bit versions in addition to their
32-bit versions.”

The Blog further explained the timing of the transition to 64-bit native applications,
“…In anticipation of future Android devices that support 64-bit code only, the Play Console will
require that new apps and app updates with native libraries provide 64-bit versions in addition
to their 32-bit versions. This can be within a single APK or as one of the multiple APKs published.

“We are not removing 32-bit support. Google Play will continue to support 32-bit apps and
devices. Apps that do not include native code are unaffected. This change will come into effect
in August 2019…” The entire Android Developer Blog is a worthwhile read on the topic.

Android Ecosystem Considerations


64-bit capabilities have been available in Android from several years, but Google’s
recommendation to move to 64-bit Android application development has set the
ecosystem into motion. Many cross-platform developers supporting iOS and Android
already have a 64-bit iOS version of their application that “will be easy to migrate when
the time arrives.”

3
For many applications, the creation of the newly required 64-bit libraries will be simple,
as many open-source libraries have been type-safe and tested for these systems for many
years. Most code written using Arm NEON intrinsics will compile for 64-bit without change.
Advances in compiler technology will produce better, more performant code automatically.
If a current Android application is written in entirely in Java, the current Android Runtime
(ART) will support the application without modification. For more details on porting
considerations and porting native Android applications, please see the Arm Community
blog and accompanying documentation here.

Other Ecosystems
Google does not heavily influence the Android app store ecosystem in Asia or currently
offers the Play store in China. As a result, Google’s 64-bit mandate does not necessarily
wield as much influence in those significant markets. Arm has held many meetings and
discussions with various members of the Android ecosystem and believes that most top
app stores and ecosystem influencers will transition their applications to be 64-bit capable.
All indications are that the move to a more modern architecture is a welcome development
for Android.

Technical Rationale and Benefits of 64-bit


64-bit Android systems do require more memory to run than their 32-bit counterparts.
This tends to raise the minimum system memory requirements depending on several
factors including screen size and display pixel density. A 32-bit version of Android can
operate with only 1GB of available RAM, whereas a 64-bit CPU requires a minimum of
approximately 1.8 to 2GB.

The last version of Android that supported only 32-bit CPUs was “KitKat” released in 2013.
Since the Lollipop release in 2014, the Android OS has been able to run both 32 and 64-bit
applications, but this may have been holding back Android’s potential. Arm was able to
maintain backward compatibility with 32-bit Armv7-A Android applications, as they remain
fully compatible with the Armv8 architecture 64-bit processors.

There are many reasons for moving to 64-bit for Android devices. Several examples are:

Enhanced security;

Better performance;

More and larger registers;

Greater precision in 64-bit numbers;

A richer instruction set, and

The advantage of new and modern features not available with 32-bit code.

64-bit code will have larger pointers usually resulting in larger application binary files,
but users also get a larger address space that can be accessed in larger blocks with the
ability to quickly load larger files into memory.

4
With optimized code, this should allow processes to occur faster and allow the CPU to
power down, reducing overall power consumption.

64-bit Only Devices


As the Android ecosystem supports greater numbers of 64-bit capable applications and
market forces drive the lower component cost of devices, it is likely that Android will
support classes of 64-bit only devices. In addition to reduced costs for developers, other
benefits of a 64-bit-only device are the reduced complexity and increased attention to
a single architecture for optimization and development. This is likely to yield a stronger,
healthier, and more robust system.

Additionally, there are arguments for a single ISA within an Android Device:

Additional AArch32 support significantly affects micro-architectural complexity.


Further complexity leads to added validation costs for testing for OEM partners.
Armv8.x security features for safe authentication, data protection, exploit mitigation,
and secure content delivery are only available in AArch64.
Greater performance is available for emerging mobile workloads such as mixed reality,
AI/ML, and web applications.
Supporting one runtime requires less testing and maintenance.
AArch64-only CPUs will be more efficient.

Current Android smartphone devices support both 32 and 64-bit applications. This can
allow for backwards compatibility with older Android devices and reaching a potentially
wider audience. However, the costs and disadvantages begin to add up. Just some
examples of features that incur these additional costs include:

Support of multiple ISAs requires pre-decoding in the Instruction Cache.


Increased Flash overhead for Multilib APK builds.
100+MB dual Android Zygote RAM overhead.
Larger security attack surfaces.
Additional validation and cost for OEMs.
Decoding older T32 code multiplies decoder area by two.
Decoding Thumb16 is the critical timing path of an app’s decoding stage.
Aliasing of NEON™ registers in AArch32 requires double tagging for register renaming.
30 percent of the NEON renaming table area – accessed on every cycle on
NEON / FP execution.
30 percent increase of source operand storage and forwarding network in
NEON Issue Queues.
50 percent of the power in forwarding logic and register matching logic of the
NEON Issue Queues – IQs represent a third of the dynamic power of a Core.

5
What is Arm doing?
Arm is working closely with Partners to understand any ecosystem, technical, or commercial
blocking issues inhibiting the migration of Android apps to 64-bit. We are not anticipating
any problems or surprises during this transition. So far, Arm has been receiving positive
feedback from Android app developers, game engine developers, and SiP and OSV
partners. We are continuously monitoring the Android application ecosystem to
measure 64-bit app availability and working to ensure that it trends in the right direction.
Arm has also been working with game engine developers to ensure that they migrate their
engines in plenty of time for the game studios to build, test, and release their Android
games prior to August 2019.

We believe that game engine developers are driving innovation and raising the
performance envelope beneficial to the entire Android ecosystem. Game engine developer
partners currently migrating to 64-bit are observing initial un-optimized performance
benefits of at least 10 percent.

Arm has always focused on building the most performant products in an energy-efficient
package. We are currently focused on more 64-bit optimizations for key libraries, runtimes,
browsers, and engines commonly used within Android. Supporting more 64-bit application
development will provide benefits for the Android ecosystem in the foreseeable future.

What is next for my Android application?


If applications were originally written in Java™, then it should run without any action from
developers. Non-native applications are unaffected by this mandate. If the application uses
native Android libraries, then – depending on how well the native application was originally
written – it may require additional work. Re-compiling applications even for those that are
well-coded may require some re-writing of the code. It is important that game developers
check NOW to avoid bigger problems in the future when the move to 64-bit starts
to accelerate.

Arm believes that it is in the best interests of the Android Ecosystem for native application
development to migrate to 64-bit. We stand ready to provide support and guidance to the
developer community. Arm is committed to the 64-bit architecture, particularly as future
performance enhancements will only be possible only in the 64-bit space. We encourage
developers to get started and investigate whether their applications require any additional
work as part of the 64-bit move.

6
Additional Resources
If developers are looking for more specific information about migrating apps to 64-bit,
Arm recommends visiting some of the following resources.

Armv8-A programming:
Armv8-A Programmer’s Guide
Armv8 Architecture Reference Manual
developer.arm.com

Specific Arm Cortex-A processor guides:


Arm Cortex-A Series Processors

Arm Technology Overview:


Arm Technologies Overview

Suggested Google Android resources:


Android Developer Site
Android Source Code - 64-bit Builds
Android Developer NDK Guides - 64-bit ABIs

For the latest Android information from Google:


Android Developers Blog

Contained within this link are presentations and tutorials from events since the introduction
of AArch64. New and updated materials will be posted as they become available.
Arm architecture tutorials for app developers

You might also like