Martin Guy <martinwguy@gmail.com> 8 September 2009
Last updated: 7 October 2015
Contents
I've released my work from July 2013:
Update 18 June 2013 wget http://ftp.debian.org/debian/pool/main/g/gmp/libgmp3c2_4.3.2+dfsg-1_armel.deb sudo dpkg -i libgmp3c2_4.3.2+dfsg-1_armel.deb
| Image found on the "Gears of War" site during a web search for "Maverick 9312" |
This follows on from Hasjim Williams' earlier work with gcc-4.1.2 and 4.2.0, a bundle of his more recent ideas and more hacks from me.
If you want to understand the patches themselves, there is an article about the MaverickCrunch FPU and GCC's problems with it on the Debian wiki and I have added commentary at the top of the individual patch files for gcc-4.4.7, for gcc-4.3.6 or for gcc-4.2.4.
Discussion about this (and other issues with these chips) happens on
the linux-cirrus mailing list.
What it does
The 20090908 version
make check-gcc RUNTESTFLAGS="ieee.exp --target_board=unix/-mcpu=ep9312/-mfpu=maverick/-mfloat-abi=softfp/-mieee"
gcc-4.4-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -mieee -o paranoia2 paranoia2.c -lm ./paranoia2
wget http://www.fftw.org/fftw-2.1.5.tar.gz tar xfz fftw-2.1.5.tar.gz cd fftw-2.1.5 # double precision floating point ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make && make -C tests check # single precision floating point make clean ./configure --enable-float CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make && make -C tests check
wget http://www.fftw.org/fftw-3.3.3.tar.gz tar xfz fftw-3.3.3.tar.gz cd fftw-3.3.3 # double precision floating point ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make; cd tests; perl check.pl -a # single precision floating point make clean ./configure --enable-single CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make; cd tests; perl check.pl -a
wget http://liboil.freedesktop.org/download/liboil-0.3.17.tar.gz tar xfz liboil-0.3.17.tar.gz cd liboil-0.3.17 ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make check
wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz tar xfz libsndfile-1.0.25.tar.gz cd libsndfile-1.0.25 ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make check
wget http://www.mega-nerd.com/SRC/libsamplerate-0.1.8.tar.gz tar xfz libsamplerate-0.1.8.tar.gz apt-get install libsndfile-dev libfftw3-dev libasound2-dev ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2" make check
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz tar xfz libvorbis-1.3.3.tar.gz cd libvorbis-1.3.3 # libvorbis supplies -O20 flag ./configure CC=gcc-4.4-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp" make check
wget https://www.openssl.org/source/openssl-1.0.1e.tar.gz tar xfz openssl-1.0.1e.tar.gz ./config vi Makefile :/^CC= gcc/s/$/-4.3-crunch/ :/^CFLAG= /s/$/ -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -mcirrus-di/ :wq make make test
CC=gcc-4.4-crunch CCFLAGS=" ... -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math" MULHACK=-DUSE_FLOAT_MULthen
make time bin/toast < intro.l > /dev/null
dd if=/dev/urandom of=crap bs=1M count=1 time apps/openssl sha -sha512 < crap
The results, on a 200MHz Cirrus Logic EP9307 revision E1 under Debian "armel":
Compiler/options | FFTW mflops | LAME seconds | libgsm(*) seconds | openssl seconds |
---|---|---|---|---|
Soft-float | ||||
gcc-4.3 -O2 -ffast-math (softfloat) | 3.59 | 365 | 23.5 | |
gcc-4.4 -O2 -ffast-math (softfloat) | 0.51u | |||
Hard-float | ||||
gcc-4.2-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -O2 -ffast-math | 6.13 | 138 | 5.72 | |
gcc-4.3-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -O2 -ffast-math -mieee | 3.83 | 276 | - | |
gcc-4.3-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -O2 -ffast-math | 5.94 | 145 | 5.72 | |
gcc-4.4-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -O2 -ffast-math | 7.65 | 141(+) | 6.52(+) | 0.48u |
In other words, using the full Maverick instruction set, LAME is 2.5 times faster than with softfloat, and when just using the -mieee subset, it runs 25% faster or about half the speed of the full set, and gcc-4.2 produces significantly faster code than gcc-4.3 or gcc-4.4 except for FFTW, in which gcc-4.4 excels.
(*) Although crunch libgsm is 4 times faster than softfloat, libgsm also has a
fixed-point encoder, selected with MULHACK='', which is faster still
(the same is true of the speex encoder).
(+) These tests were run on a Sim.One board with a 16-bit RAM data path instead of a 32-bit data path, which slows down all RAM accesses for a net slowdown of about 10%.
Download
There are installable binary tarballs,
Debian packages and patches.
There is also a repository of prebuilt crunch-accelerated Debian packages
for armel's "lenny" and "squeeze" releases. See
martinwguy.net/crunch/debian
Using it
To get MaverickCrunch instructions you always have to use:
gcc-4.3-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfpOther relevant options are:
./configure CC=gcc-4.3-crunch CFLAGS="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -ffast-math -O2"However it's usually less trouble to make a directory of wrapper scripts replacing all of GCC's command names with the crunch version:
mkdir ~/crunch cat > ~/crunch/gcc << EOF #! /bin/sh exec gcc-4.3-crunch -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -fno-signed-zeros "$@" EOF chmod 755 ~/crunch/gcc ln -s gcc ~/crunch/cc ln -s gcc ~/crunch/gcc-4.3 ln -s gcc ~/crunch/arm-linux-gnueabi-gccand fool the build system into using them
PATH=~/crunch:$PATH ./configure PATH=~/crunch:$PATH make PATH=~/crunch:$PATH make installor, to build accelerated Debian packages:
apt-get source foobar sudo apt-get build-dep foobar cd foobar-* PATH=~/crunch:$PATH dpkg-buildpackage -rfakeroot -B cd .. dpkg -i foobar*.deb
Memory: If you have less than 160MB of physical RAM plus 64MB swap, you will need to stop the compilation, compile that one file without optimisation by saying make CFLAGS=-g and then interrupt it and carry on as usual when that one file has been done.
Disk space: The full sources unpack to 500MB (360MB for gcc-4.2) and a further 200MB (140MB for gcc-4.2) are needed to build the C compiler. If you have less space, you can fetch a "gcc-core" source tarball instead, which only contains the C compiler and unpacks to about 200MB, for a total of 400MB when built.
wget ftp://sourceware.org/pub/gcc/releases/gcc-4.4.7/gcc-4.4.7.tar.bz2 tar xjf gcc-4.4.7.tar.bz2 cd gcc-4.4.7 for a in `cat ../gcc-4.4.7-patches/series` do patch -p1 < ../gcc-4.4.7-patches/$a done cd .. mkdir gcc-4.4.7-build cd gcc-4.4.7-build # The same basic configuration as Debian ../gcc-4.4.7/configure \ CONFIG_SHELL=/bin/sh \ --enable-languages=c --prefix=/usr/local \ --enable-shared --with-system-zlib --without-included-gettext \ --enable-threads=posix --enable-nls --program-suffix=-4.4-crunch \ --enable-clocale=gnu --enable-mpfr --disable-libssp \ --disable-sjlj-exceptions --disable-bootstrap \ --with-arch=armv4t armv4tl-crunch-linux-gnueabi make CFLAGS_FOR_TARGET="-mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp" ../s/install ../s/tarball gcc-4.4-crunchThe tarball script dumps a .tar.gz of the essential installed files and another of the source patchset in the ../packages directory.
There is also a test directory here with some program
fragments that I used to probe hardware bug presence and characteristics.
Patches for other packages
These are patches for GCC and work fine for all regular C software that I've tried.
Some other software packages are known to need Crunch tweaks as well:
Martin Guy <martinwguy@gmail.com> | Useful? Donate! |