日別アーカイブ: 2013年10月5日

iPhone 5s A7 arm64 専用命令の速度 (2) (ARMv8 AArch64)

ARMv8 の AES 命令を使ってみたので下記 CPU ベンチを更新しました。

CPU ベンチ

以下抜粋

CPU            arch           GHz  time      MB/sec   1GHzあたり
---------------------------------------------------------------
Apple A7 CPU   ARMv8 + AES    1.3  0.13s   837.54MB/s  644.26MB
Apple A7 CPU   ARMv8 (arm64)  1.3  1.04s   104.27MB/s   80.21MB
Apple A7 CPU   ARMv7          1.3  1.16s    93.04MB/s   71.57MB
Cortex-A15     ARMv7          1.7  1.49s    72.61MB/s   42.71MB
A6 swift       ARMv7          1.3  1.87s    57.96MB/s   44.58MB
Krait          ARMv7          1.5  2.28s    47.64MB/s   31.82MB
A5 Cortex-A9   ARMv7          0.8  5.78s    18.76MB/s   23.44MB

Core i7 3930K  x64 + AES-NI   3.2  0.05s  2299.54MB/s  718.61MB
Core i7 3930K  x86 + AES-NI   3.2  0.06s  1682.35MB/s  525.74MB
Core i7 2600S  x64 + AES-NI   2.8  0.05s  2113.03MB/s  754.66MB
Core i7 2600S  x86 + AES-NI   2.8  0.06s  1683.66MB/s  601.31MB
Core i7 620M   x64 + AES-NI   2.7  0.08s  1410.61MB/s  528.32MB
Core i7 620M   x86 + AES-NI   2.7  0.10s  1064.06MB/s  398.53MB
Core i7 3930K  x64            3.2  0.48s   228.05MB/s   71.26MB
Core i7 3930K  x86            3.2  0.50s   216.50MB/s   67.66MB
Core2 duo x64  x64            2.4  0.75s   143.56MB/s   59.81MB
Core2 duo x86  x86            2.4  0.85s   127.99MB/s   53.33MB
Atom N270      x86            1.6  4.21s    25.74MB/s   16.09MB

 ・「MB/sec」が大きいほうが高速
 ・「1GHzあたり」は同一 CPU クロックでの比較

A7 ARMv8 + AES を使うことで、命令未使用時のおよそ 8倍、
ARMv7 (32bit) 時の 9倍高速に実行できています。

ただし AES-NI 共にコンパイラの intrinsic (builtin) を並べてるだけなので、
実際にはもっと最適化できる可能性があります。

Intel の AES-NI は非常にシンプルで、1 round 毎に 1命令、
最終 round のみ別命令が割り当てられていました。

ARMv8 の場合は AddRoundKey, SubBytes, ShiftRows と
MixColumns が分かれています。
並べる命令数は増えますが、この組み合わせで最終 round も表現できるので
専用命令が要りません。
また AES-NI とは xor(eor) の位置がちょうど 1つずれる形になります。

関連エントリ
iPhone 5s A7 CPU の速度比較 arm64 (ARMv8 AArch64)
iPhone 5s A7 CPU の浮動小数点演算速度 (2) (arm64/AArch64/64bit)
Nexus 10 CPU Cortex-A15 の速度
Nexus 10 CPU Cortex-A15 の浮動小数点演算速度
iPad 4/iPad mini A6X/A5 の CPU/GPU 速度
iPhone 5 / A6 の CPU 速度 その 3
benchmark 関連