Friday, January 14, 2011

Back to Basics - SIMD Part I - IPhone



To start off the Coder Chameleon blog I'd like to spend some time investigating the world of SIMD architectures on the most prevalent hardware architectures and to determine their commonalities and differences. We'll start with the IPhone and survey the major hardware platforms then maybe develop a simple math library utilizing SIMD on each platform.




SIMD on the IPhone

The wikipedia page on IPhone details the evolving hardware architecture of the platform (http://en.wikipedia.org/wiki/IPhone). The original IPhone and IPhone 3G were based on the ARM11 instruction set which had SIMD instructions but it was not until the IPhone 3GS that support for ARM's NEON general purpose SIMD engine was made available.

The IPhone 3GS uses the S5PC100 chip based on the ARM Cortex A8 architecture:




And an excellent presentation on SIMD on IPhone:
Cranking Floating Point Performance to 11 by Noel Llopis
http://www.slideshare.net/llopis/cranking-floating-point-performance-to-11-on-the-iphone-2111775

The presentation above references the vfp math library (by Wolfgang Engel) http://code.google.com/p/vfpmathlibrary.


NEON

Here is an excellent introduction to NEON on the IPhone:
http://wanderingcoder.net/2010/06/02/intro-neon/

  • 16 x 128 bit registers named q0 to q15 (q for quadword).
  • These registers can also be referenced as 32 x 64 bit double word registers named d0 to d31.

NEON instructions use a Hungarian notation. Each NEON instructions begins with 'v' and can have one or more of the following after the 'v' which act as a modifier:
  • 'q' means the instruction saturates
  • 'r' means the instruction rounds
  • 'h' means it halves
Practically all instructions need a suffix to describe the size and type of the elements being operated upon from .u8 (unsigned byte) to .f32 (single-precision floating point). For example, vqadd.s16. If the element size changes as part of the operation the prefix indicates the size of the narrowest input.



APPENDIX I - NEON and VFP References

ARM Info Center: NEON and VFP Programming

http://blogs.arm.com/software-enablement/161-coding-for-neon-part-1-load-and-stores/

http://www.delmarnorth.com/microwave/requirements/TestCodeTutorial_neon-test_draft2.pdf


APPENDIX II - General IPhone Hardware Reference

Wandering Coder - A Few Things IOS Developers Should Know About ARM Architecture

No comments:

Post a Comment