Evolution of Renderscript Performance

※AndroidDeveloperBlogの訳です。
http://android-developers.blogspot.jp/2013/01/evolution-of-renderscript-performance.html

Evolution of Renderscript Performance
Posted by R. Jason Sams, Android Renderscript Tech Lead

It’s been a year since the last blog post on Renderscript, and with the release of Android 4.2, it’s a good time to talk about the performance work that we’ve done since then. One of the major goals of this past year was to improve the performance of common image-processing operations with Renderscript.

When you set out to improve performance, the first task is to measure it. To do this, we built a image-processing benchmark suite. The tests measure how long it takes to apply a given image processing operation to a roughly 1.7 million pixel bitmap. We then ran the benchmark using the same APK on the Galaxy Nexus and normalized the results from Ice Cream Sandwich to 1.0.

We made a few major improvements between ICS and Jelly Bean, which significantly reduced the overhead of short scripts as well as the cost of getting elements out of allocations. Going from Android 4.1 to Android 4.2, we added a number of performance improvements to the math library. Our hardware partners also made major contributions; ARM in particular provided numerous compiler improvements which greatly improved our ability to generate vector code.

Android 4.2 introduced another much more important change: For the first time on any mobile platform. we can use the GPU as a compute device. When run on a device that supports GPU compute, that same benchmark APK will run on the GPU. The chart in Figure 2 is normalized to the same basis as Figure 1.

The Cortex A15 in Nexus 10 is a very good CPU. However, that doesn’t mean we should leave resources idle. The Mali T604 is a very flexible and capable compute device capable of executing a large subset of RenderScript functionality. The green bar in Figure 2 shows what we can do when the Mali is enabled for RS compute. No effort is required on an app developer's part to enable this acceleration; the device will inspect each script and decide which processor to run things automatically. It’s important to note that some scripts can’t be run on the GPU, and such scripts will automatically run on the CPU.

The best part is it doesn’t end here. Performance work is an ongoing effort. RenderScript performance in applications will continue to improve over time as we continue to improve the platform.

To learn more about using Renderscript, see the Renderscript Computation developer's guide.


Figure 1. Renderscript image-processing benchmarks run on different Android platform versions (Android 4.0, 4.1, and 4.2) in CPU only on a Galaxy Nexus device.


Figure 2. Renderscript image-processing benchmarks comparing operations run with GPU + CPU to those run in CPU only on the same Nexus 10 device.

http://android-developers.blogspot.jp/2013/01/evolution-of-renderscript-performance.html

                                                                                • -

「Renderscriptのパフォーマンスの進化」

去年のRenderscriptに関する最新の投稿から一年経ち、そしてAndroid4.2がリリースされ、
私たちがあれから行って来たパフォーマンスに関する仕事について話すには、いい機会になっている。
ここ1年の主な目標はRenderscriptに関する共通の画像処理作業のパフォーマンスの向上だ。

あなたがパフォーマンスの向上をしようとするとき、最初にするタスクは計測だ。
私たちは画像処理用のベンチマークソフトを作った。そのテストは
大体170万ピクセルのbitmapへ、与えられた画像処理作業を適用するのに
どのぐらいの時間がかかるか計測するものだ。
私たちはGalaxyNexus上で同じAPKを使ってベンチマークソフトを走らせ、
ICSから1.0までの結果を正規化した。

私たちはICSからJBの間でいくつかの主要なアップデートをした。それは、
短いスクリプトのオーバーヘッドもメモリの確保にかかるコストも著しく減らした。
4.1から4.2への移行の中で、私たちはmathライブラリに多くの性能改善を施した。
私たちのハードウェアパートナーもまた、大きな貢献をした。
特にARMは、ベクターコードを生成するための能力を向上させる、
非常に多くのコンパイラの改善を提供した。

Android4.2は他にも多くの重要な変更が紹介された。
それは、いくつかのモバイルプラットフォームに関して初めて行われた。
私たちはGPUを演算デバイスとして使う事ができる。
GPU演算をサポートしているデバイス上でその機能を実行するとき、
同じベンチマークAPKはGPU上で実行されるだろう。
図2のチャートは図1のように同じ基準で正規化されている。

Nexsu10に搭載されているCortexA15は良いCPUだ。
しかし、それはリソースの無駄を見過ごすべきだという事を意味しない。
Mali T604は柔軟で、Renderscript機能の大きな集合を実行するのに
有用な演算デバイスに有用だ。図2の緑のバーは、MaliがRS演算を
有効にすることで可能になることを表している。
このアクセラレーションを有効するのにアプリ開発者の作業として要求される努力は何もない。
デバイスは、スクリプトとそれを実行するためのプロセッサーを自動で調査するだろう。
いくつかのスクリプトGPU上で実行できない点について言及する事は重要だ。
そしてそのようなスクリプトは自動的にCPUで実行されるだろう。

一番重要な事は、これで終わりではないという事だ。
パフォーマンスに関する作業について努力し続けている。アプリケーションの
Renderscriptのパフォーマンスは、私たちがプラットフォームの向上を続けるように
長い時間をかけて改善され続けるだろう。

さらにRenderscriptの使用について学びたい場合は、RenderscriptComputationデベロッパーズガイドを見ること。

図1
Renderscriptの画像処理ベンチマークソフトを、
GalaxyNexusのCPUだけで、異なるAndroidプラットフォームバージョンで実行させた結果。

図2
Renderscriptの画像処理ベンチマークソフトを、
Nexus10上でCPUだけで実行した場合と、CPUと一緒にGPUも使用して実行した場合の比較。