xlcの実力

lameをppuだけで実行した結果がいまいち遅いのでコンパイルオプションを変えて実行してみました。またIBMのxlcも試してみました。

で、その結果ですが、

CC=ppu-gcc ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:42/    0:42|    0:42/    0:42|   3.1474x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

前の結果とほぼ同じです。
-O3オプションにしてみます。

CC=ppu-gcc CFLAGS=-O3 ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:44/    0:44|    0:44/    0:44|   3.0038x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

ちょっと遅くなった気が…
32ビットビルドにすると

CC=ppu-gcc CFLAGS="-m32 -O3" ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:42/    0:42|    0:42/    0:42|   3.1269x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

32ビットビルドの方が少し速そう。
ppuにはaltivecがあるので、これを使ってみます。

CC=ppu-gcc CFLAGS="-maltivec -m32" ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    2:19/    2:19|    2:23/    2:23|   0.9649x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

激おそ!
-O3も付けてみる。

CC=ppu-gcc CFLAGS="-O3 -maltivec -m32" ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:43/    0:43|    0:43/    0:44|   3.0817x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

ましになった。
ループアンロールにしてみる。

CC=ppu-gcc CFLAGS="-O3 funroll-loops -m32" ./configure
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:40/    0:40|    0:40/    0:40|   3.2901x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

今のところ最高。
そこでxlcも試してみます。shared libraryのビルドでエラーになるので--disable-sharedにする。

CC=ppuxlc CFLAGS="-q32 -O3" ./configure --host=ppc-pc-linux-gnu --disable-shared
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:28/    0:28|    0:28/    0:28|   4.7295x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

おー、速い。さすがIBM
-O4オプションだとなぜかビルドが通らないので-O3で-qhot(自動SIMD化になるはず)にする。

CC=ppuxlc CFLAGS="-q32 -O3 -qhot" ./configure --host=ppc-pc-linux-gnu --disable-shared
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:27/    0:27|    0:28/    0:28|   4.8229x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

思った程向上しない。

いろいろ試した限りxlcは素晴らしいということか。gccがんばって。gccなら-O3 -funroll-loops -m32がリーズナブルかな。
YDLがxlcでビルドしているという話なら面白いと思うんやけどなー。

Athlonでは?

ちなみにAthlon 3800(2.5GHzにクロックアップ中)だと、こんな感じ。

LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE, SSE2
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding starwars.wav to starwars.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  5140/5143  (100%)|    0:09/    0:09|    0:09/    0:09|   14.531x|    0:00
average: 128.0 kbps   LR: 2305 (44.82%)   MS: 2838 (55.18%)

Writing LAME Tag...done
ReplayGain: -7.6dB

やっぱり速いねー。