SlideShare a Scribd company logo
Optimizing NDK projects
for multiple CPU architectures


       Alexander Weggerle
       Technical Consultant Engineer
       Intel Software and Services Group
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Introduction

• Performance critical apps are popular
 • Games
 • Real time multimedia
 • Augmented reality

• Users are sensitive
 • Don’t accept lags
 • Fluid animations
 • Minimal load time

                  Optimization is important


                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Compatibility

             “I want my app to run on all architectures”




• You already done for Java & HTML

• NDK based apps usually just needs a recompilation
          APP_ABI := all

                                                            Application.mk




                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Target compiler options

• NDK-build system Android.mk file evaluated for
  each architecture

• Variable TARGET_ARCH_ABI describes actual
  architecture

  TARGET_ARCH_ABI                                ifeq ($(TARGET_ARCH_ABI),x86)
                                                 LOCAL_CFLAGS     := -mtune=atom -mssse3
  x86                                            endif

  armeabi                                        ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
                                                 LOCAL_CFLAGS     := -march=armv7-a
  armeabi-v7a                                    Endif
  mips                                                                                  Android.mk




                       Copyright© 2012, Intel Corporation. All rights reserved.
                 *Other brands and names are the property of their respective owners.
Recommended Compiler options (x86)

• -mtune=atom
 • Out of Order scheduling

• -march=atom
 • movbe instruction
 • Code is only guaranteed to run on Atom.
   – Might not run on emulator or other CPUs

• -ansi-alias / -restrict / -no-prec-div




                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Multiple Code Paths

• Different reasons for multiple code paths
 • Optimizing for multiple architectures
 • Single Instruction Multiple Data (SIMD)
 • Assembly kernels
 • Memory alignment
 • Instruction set support




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Multiple Code Paths
Compiler macros
• Directly inside source code

• No runtime overhead

• Works with all build configurations
         #ifdef __i386__
                  strlcat(buf, "__i386__", sizeof(buf));
         #endif
         #ifdef __arm__
                  strlcat(buf, "__arm__", sizeof(buf));
         #endif
         #ifdef _MIPS_ARCH
                  strlcat(buf, "_MIPS_ARCH", sizeof(buf));
         #endif

                                                                                            source.c




                           Copyright© 2012, Intel Corporation. All rights reserved.
                     *Other brands and names are the property of their respective owners.
Multiple Code Paths
Make system
• Make system will select source file depending on
  architecture

• No runtime overhead

       arch_x86.cpp
       const char *getTarget ();


       arch_arm.cpp                             arch.h                                         cpufeaturestest.cpp
       const char *getTarget ();                const char *getTarget ();                      printf(“%s”, getTarget());

       arch_default.cpp
       const char *getTarget ();




                                         Copyright© 2012, Intel Corporation. All rights reserved.
                                   *Other brands and names are the property of their respective owners.
Multiple Code Paths
Cpufeatures API
• Checks for architecture and
  special CPU features

• Uses compiler macros +
  runtime detection internally
 • Small runtime overhead




                           Copyright© 2012, Intel Corporation. All rights reserved.
                     *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Porting Native (C/C++) Android* Apps to x86

http://software.intel.com/en-us/articles/ndk-android-application-porting-
methodologies/

            Native Apps
• Optimized NDK for Intel Atom based
  devices available on
  http://developer.android.com/sdk/nd
  k/index.html since July’11.
• For most apps, changing the make
  file and a recompile should be
  sufficient to port to Intel Atom
  devices.
• If ARM-specific features are used,
  Intel SSE equivalents should be
  added (build flag)
• Developer recompiles, re-packages
  and publishes.



                                  Copyright© 2012, Intel Corporation. All rights reserved.
                            *Other brands and names are the property of their respective owners.
ARM* NEON to Intel® SSE

• Single Instruction Multiple Data (SIMD)

• Most ARM NEON functions have a 1:1 equivalent in
  Intel® SSE

• Intel provides C++ header file to do the mapping
        // VADD.I8 d0,d0,d0
 int8x8_t    vadd_s8(int8x8_t a, int8x8_t b);
 #ifdef USE_MMX
        #define vadd_s8 _mm_add_pi8   //MMX
 #else
        #define vadd_s8 _mm_add_epi8
 #endif

                                                                                          neonvssse.h


                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Differences between ARM and x86
Alignment
• ARM uses aligned, x86 uses packed memory

  struct TestStruct
                                                                           ARM
  {
     int mVar1;
     long long mVar2;
     int mVar3;
  };
                                                                            x86




• Compiler parameter helps to workaround
  -malign-double




                              Copyright© 2012, Intel Corporation. All rights reserved.
                        *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Market
Fat binary
• Include all binaries into one apk
                                                libs/armeabi
       Source


                 ndk-build                                                         apkbuilder

                                              libs/armeabi-
                                                    v7a                                         …



                                                    libs/x86




• Device removes incompatible libs at installation

                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Market
Multiple APKs
• Support for different …
 • Texture formats
 • Screen sizes and densities
 • Platform versions
 • CPU architectures

• Saves bandwidth and space while installation




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Conclusion & Call to action

• NDK provides plenty of mechanisms to
  differentiate between architectures

• Recompile your NDK based app with
  APP_ABI := all




                      Copyright© 2012, Intel Corporation. All rights reserved.
                *Other brands and names are the property of their respective owners.
21
Legal Disclaimer & Optimization Notice

        INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY
        ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS
        DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR
        IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES
        RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY
        PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

        Software and workloads used in performance tests may have been optimized for performance only on
        Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using
        specific computer systems, components, software, operations and functions. Any change to any of
        those factors may cause the results to vary. You should consult other information and performance
        tests to assist you in fully evaluating your contemplated purchases, including the performance of that
        product when combined with other products.

        Copyright © , Intel Corporation. All rights reserved. Intel, the Intel logo, Xeon, Core, VTune, and Cilk
        are trademarks of Intel Corporation in the U.S. and other countries.


             Optimization Notice
             Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that
             are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and
             other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on
             microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended
             for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for
             Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information
             regarding the specific instruction sets covered by this notice.
                                                                                                          Notice revision #20110804


22                                                                  Intel Confidential
                                                      Copyright© 2012, Intel Corporation. All rights reserved.
09.04.2013                                      *Other brands and names are the property of their respective owners.
Droidcon ndk cpu_architecture_optimization

More Related Content

PDF
ARM and SoC Traning Part I -- Overview
PDF
Porting linux on ARM
PPT
Program development tools
PDF
Intel tools to optimize HPC systems
PDF
Methods and practices to analyze the performance of your application with Int...
PDF
AFDS 2011 Phil Rogers Keynote: “The Programmer’s Guide to the APU Galaxy.”
PDF
Android Optimization: Myth and Reality
PPTX
Using JavaScript to Build HTML5 Tools (Ian Maffett)
ARM and SoC Traning Part I -- Overview
Porting linux on ARM
Program development tools
Intel tools to optimize HPC systems
Methods and practices to analyze the performance of your application with Int...
AFDS 2011 Phil Rogers Keynote: “The Programmer’s Guide to the APU Galaxy.”
Android Optimization: Myth and Reality
Using JavaScript to Build HTML5 Tools (Ian Maffett)

What's hot (20)

PDF
Accelerated Android Development with Linaro
PDF
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
PDF
EclipseCon 2011: Deciphering the CDT debugger alphabet soup
PDF
Droid con 2012 bangalore v2.0
PPT
Arista @ HPC on Wall Street 2012
PPTX
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
PDF
Nvidia Cuda Apps Jun27 11
PDF
Guides To Analyzing WebKit Performance
PDF
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
KEY
Open source hardware and the web
PDF
резников дмитрий
PPTX
HSA Introduction Hot Chips 2013
PPTX
Understanding open max il
PDF
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
PDF
Develop Community-based Android Distribution and Upstreaming Experience
PDF
PPT
OpenMAX Overview
PPTX
Intel_Low Power Intelligent Solutions with Intel Atom Processor
PDF
Intel® Advanced Vector Extensions Support in GNU Compiler Collection
PDF
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Accelerated Android Development with Linaro
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
EclipseCon 2011: Deciphering the CDT debugger alphabet soup
Droid con 2012 bangalore v2.0
Arista @ HPC on Wall Street 2012
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
Nvidia Cuda Apps Jun27 11
Guides To Analyzing WebKit Performance
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
Open source hardware and the web
резников дмитрий
HSA Introduction Hot Chips 2013
Understanding open max il
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Develop Community-based Android Distribution and Upstreaming Experience
OpenMAX Overview
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Intel® Advanced Vector Extensions Support in GNU Compiler Collection
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Ad

Viewers also liked (7)

PDF
Droidcon 2011: Strategies for Android, Henning Boeger, Capgemini
PDF
Sony working with sony and developing for xperia devices
PDF
Droidcon2013 baa s_kohl_apiomat
PDF
PDF
Droidcon2013 commercialsuccess rannenberg
PDF
Caught between fires html5 mahdi_njim
PDF
20130409 1 developing apps for android with kivy
Droidcon 2011: Strategies for Android, Henning Boeger, Capgemini
Sony working with sony and developing for xperia devices
Droidcon2013 baa s_kohl_apiomat
Droidcon2013 commercialsuccess rannenberg
Caught between fires html5 mahdi_njim
20130409 1 developing apps for android with kivy
Ad

Similar to Droidcon ndk cpu_architecture_optimization (20)

PDF
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
PDF
Introduction ciot workshop premeetup
PDF
Android on IA devices and Intel Tools
PDF
Arm based controller - basic bootcamp
PDF
NFF-GO (YANFF) - Yet Another Network Function Framework
PDF
Open CL For Speedup Workshop
PPTX
dvance computer architecture computer architecture: a quantitative approach c...
PDF
Android NDK and the x86 Platform
PDF
Five cool ways the JVM can run Apache Spark faster
PPTX
Intel® Graphics Performance Analyzers
PPTX
Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...
PPTX
Using LLVM to accelerate processing of data in Apache Arrow
PDF
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
PDF
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
PDF
Android on Intel platforms : current state, near-future, future & developers ...
PPT
E.s unit 6
PDF
Linxu conj2016 96boards
PPTX
The Role of Standards in IoT Security
PDF
ABS 2012 - Android Device Porting Walkthrough
PPTX
Velocity-EHF for Android
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
Introduction ciot workshop premeetup
Android on IA devices and Intel Tools
Arm based controller - basic bootcamp
NFF-GO (YANFF) - Yet Another Network Function Framework
Open CL For Speedup Workshop
dvance computer architecture computer architecture: a quantitative approach c...
Android NDK and the x86 Platform
Five cool ways the JVM can run Apache Spark faster
Intel® Graphics Performance Analyzers
Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...
Using LLVM to accelerate processing of data in Apache Arrow
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Intel® Trace Analyzer e Collector (ITAC) - Intel Software Conference 2013
Android on Intel platforms : current state, near-future, future & developers ...
E.s unit 6
Linxu conj2016 96boards
The Role of Standards in IoT Security
ABS 2012 - Android Device Porting Walkthrough
Velocity-EHF for Android

More from Droidcon Berlin (20)

PDF
Droidcon de 2014 google cast
PDF
Android programming -_pushing_the_limits
PDF
crashing in style
PDF
Raspberry Pi
PDF
Android industrial mobility
PDF
Details matter in ux
PDF
From sensor data_to_android_and_back
PDF
droidparts
PDF
new_age_graphics_android_x86
PDF
5 tips of monetization
PDF
Testing and Building Android
PDF
Matchinguu droidcon presentation
PDF
Cgm life sdk_droidcon_2014_v3
PDF
The artofcalabash peterkrauss
PDF
Raesch, gries droidcon 2014
PDF
Android open gl2_droidcon_2014
PDF
20140508 quantified self droidcon
PDF
Tuning android for low ram devices
PDF
Froyo to kit kat two years developing & maintaining deliradio
PDF
Droidcon2013 security genes_trendmicro
Droidcon de 2014 google cast
Android programming -_pushing_the_limits
crashing in style
Raspberry Pi
Android industrial mobility
Details matter in ux
From sensor data_to_android_and_back
droidparts
new_age_graphics_android_x86
5 tips of monetization
Testing and Building Android
Matchinguu droidcon presentation
Cgm life sdk_droidcon_2014_v3
The artofcalabash peterkrauss
Raesch, gries droidcon 2014
Android open gl2_droidcon_2014
20140508 quantified self droidcon
Tuning android for low ram devices
Froyo to kit kat two years developing & maintaining deliradio
Droidcon2013 security genes_trendmicro

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The AUB Centre for AI in Media Proposal.docx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Droidcon ndk cpu_architecture_optimization

  • 1. Optimizing NDK projects for multiple CPU architectures Alexander Weggerle Technical Consultant Engineer Intel Software and Services Group
  • 2. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 3. Introduction • Performance critical apps are popular • Games • Real time multimedia • Augmented reality • Users are sensitive • Don’t accept lags • Fluid animations • Minimal load time Optimization is important Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 4. Compatibility “I want my app to run on all architectures” • You already done for Java & HTML • NDK based apps usually just needs a recompilation APP_ABI := all Application.mk Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 5. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 6. Target compiler options • NDK-build system Android.mk file evaluated for each architecture • Variable TARGET_ARCH_ABI describes actual architecture TARGET_ARCH_ABI ifeq ($(TARGET_ARCH_ABI),x86) LOCAL_CFLAGS := -mtune=atom -mssse3 x86 endif armeabi ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) LOCAL_CFLAGS := -march=armv7-a armeabi-v7a Endif mips Android.mk Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 7. Recommended Compiler options (x86) • -mtune=atom • Out of Order scheduling • -march=atom • movbe instruction • Code is only guaranteed to run on Atom. – Might not run on emulator or other CPUs • -ansi-alias / -restrict / -no-prec-div Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 8. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 9. Multiple Code Paths • Different reasons for multiple code paths • Optimizing for multiple architectures • Single Instruction Multiple Data (SIMD) • Assembly kernels • Memory alignment • Instruction set support Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 10. Multiple Code Paths Compiler macros • Directly inside source code • No runtime overhead • Works with all build configurations #ifdef __i386__ strlcat(buf, "__i386__", sizeof(buf)); #endif #ifdef __arm__ strlcat(buf, "__arm__", sizeof(buf)); #endif #ifdef _MIPS_ARCH strlcat(buf, "_MIPS_ARCH", sizeof(buf)); #endif source.c Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 11. Multiple Code Paths Make system • Make system will select source file depending on architecture • No runtime overhead arch_x86.cpp const char *getTarget (); arch_arm.cpp arch.h cpufeaturestest.cpp const char *getTarget (); const char *getTarget (); printf(“%s”, getTarget()); arch_default.cpp const char *getTarget (); Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 12. Multiple Code Paths Cpufeatures API • Checks for architecture and special CPU features • Uses compiler macros + runtime detection internally • Small runtime overhead Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 13. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 14. Porting Native (C/C++) Android* Apps to x86 http://software.intel.com/en-us/articles/ndk-android-application-porting- methodologies/ Native Apps • Optimized NDK for Intel Atom based devices available on http://developer.android.com/sdk/nd k/index.html since July’11. • For most apps, changing the make file and a recompile should be sufficient to port to Intel Atom devices. • If ARM-specific features are used, Intel SSE equivalents should be added (build flag) • Developer recompiles, re-packages and publishes. Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 15. ARM* NEON to Intel® SSE • Single Instruction Multiple Data (SIMD) • Most ARM NEON functions have a 1:1 equivalent in Intel® SSE • Intel provides C++ header file to do the mapping // VADD.I8 d0,d0,d0 int8x8_t vadd_s8(int8x8_t a, int8x8_t b); #ifdef USE_MMX #define vadd_s8 _mm_add_pi8 //MMX #else #define vadd_s8 _mm_add_epi8 #endif neonvssse.h Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 16. Differences between ARM and x86 Alignment • ARM uses aligned, x86 uses packed memory struct TestStruct ARM { int mVar1; long long mVar2; int mVar3; }; x86 • Compiler parameter helps to workaround -malign-double Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 17. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 18. Market Fat binary • Include all binaries into one apk libs/armeabi Source ndk-build apkbuilder libs/armeabi- v7a … libs/x86 • Device removes incompatible libs at installation Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 19. Market Multiple APKs • Support for different … • Texture formats • Screen sizes and densities • Platform versions • CPU architectures • Saves bandwidth and space while installation Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 20. Conclusion & Call to action • NDK provides plenty of mechanisms to differentiate between architectures • Recompile your NDK based app with APP_ABI := all Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 21. 21
  • 22. Legal Disclaimer & Optimization Notice INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products. Copyright © , Intel Corporation. All rights reserved. Intel, the Intel logo, Xeon, Core, VTune, and Cilk are trademarks of Intel Corporation in the U.S. and other countries. Optimization Notice Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 22 Intel Confidential Copyright© 2012, Intel Corporation. All rights reserved. 09.04.2013 *Other brands and names are the property of their respective owners.