AltiVec Kernel Enhancements from MOT

Dorothy over the RGB yellowdog-general@lists.terrasoftsolutions.com
Sun Jun 8 03:01:01 2003


Hi,

> So, when I cat /proc/cpuinfo and it says "altivec supported" followning 
> the cpu type, that doesn't mean that the AltiVec enabled modules are 
> being used?

I don't know at what point /proc/cpuinfo should be trusted when applied to our 
strange machines. I'm installed YDL 3.0 on an "exotic" Old World 
configuration

- Power Computing Power Tower Pro 225
- Sonnet G4 400Mhz upgrade
- Some old SCSI drives for MacOS 9.1
- 2 IDE drives via a Sonnet Tempo ATA 100 for YDL

Using the original PPC640e 200 Mhz with L2 cache, cat /proc/cpuinfo returns:

cpu		: 604e
clock		: 200MHz
revision	: 2.2 (pvr 0009 0202)
bogomips	: 399.76
machine		: Power Macintosh
motherboard	: AAPL,9500 MacRISC
detected as	: 16 (PowerMac 9500/9600)
pmac flags	: 00000000
memory		: 512MB
pmac-generation	: OldWorld

With 1 MB of L2 cache it returns:

cpu		: 604e
clock		: 195MHz
revision	: 2.2 (pvr 0009 0202)
bogomips	: 399.76
machine		: Power Macintosh
motherboard	: AAPL,9500 MacRISC
detected as	: 16 (PowerMac 9500/9600)
pmac flags	: 00000000
L2 cache	: 1024K unified
memory		: 512MB
pmac-generation	: OldWorld

So, the system does recognize the processor and the L2 cache when there is 
one.

Using the Sonnet G4 400Mhz upgrade (original L2 removed in both case, the G4 
card comes with its own), I'm getting the same bogus values with or without 
the Sonnet system extension running before launching BootX.

Without the Sonnet Extension:

cpu		: 7400, altivec supported
temperature 	: 47-49 C (uncalibrated)
clock		: 195MHz
revision	: 2.9 (pvr 000c 0209)
bogomips	: 809.36
machine		: Power Macintosh
motherboard	: AAPL,9500 MacRISC
detected as	: 16 (PowerMac 9500/9600)
pmac flags	: 00000000
memory		: 512MB
pmac-generation	: OldWorld

With the Sonner Extension:

cpu		: 7400, altivec supported
temperature 	: 47-49 C (uncalibrated)
clock		: 195MHz
revision	: 2.9 (pvr 000c 0209)
bogomips	: 809.36
machine		: Power Macintosh
motherboard	: AAPL,9500 MacRISC
detected as	: 16 (PowerMac 9500/9600)
pmac flags	: 00000000
memory		: 512MB
pmac-generation	: OldWorld

The Sonnet Desk Accessory (under MacOS) says that the CPU is 405Mhz... AND 
with 1MB of L2 cache when the Sonnet system extension executed at boot.

On the MacOS side (just to get some indication of what I should expect), I
used a venerable MacBench 5.0 (cpu and fpu tests only) to compare. A G3/300
being base at 1000), I got the following results:

                                 CPU   FPU

PPC640e (no L2 cache)........    220   595
PPC604e (1MB L2 cache).......    456   713
G4 (No Sonnet Extension).....    292  1011
G4 (With Sonnet Extension)...   1281  1506

On the Linux side, I just measured the time it took to configure and compile
an Apache 1.3.x source:

                                 1st Time     2nd Time
PPC640e (no L2 cache)........    3mn 26s      3mn 12s
PPC604e (1MB L2 cache).......    2mn 28s      2mn 27s
G4 (No Sonnet Extension).....    2mn 26s      2mn 28s
G4 (With Sonnet Extension)...    1mn 12s      1mn 8s

So my current guess is that the L2 cache is activated. 

I did some testing with MySQL.

The default installed MySQL is a MySQL 3.23.54. It performs the sql-bench 
series as follows:

Operation             seconds     usr     sys     cpu   tests
.../... I spare you the details
TOTALS               13372.00 1693.54  207.73 1901.27 2667247

I compiled a MySQL 3.23.56 source tree, as follows:

CHOST="powerpc-unknown-linux-gnu" CC=gcc CFLAGS="-mcpu=7400 -O2 -pipe 
-fsigned-char -maltivec -mabi=altivec -mpowerpc-gfxopt" CXX=gcc 
CXXFLAGS="-mcpu=7400 -O2 -pipe -fsigned-char -maltivec -mabi=altivec 
-mpowerpc-gfxopt -fomit-frame-pointer -felide-constructors -fno-exceptions 
-fno-rtti" ./configure --prefix=/usr/local/mysql-g4 
--enable-thread-safe-client --enable-assembler --enable-local-infile 
--with-extra-charsets=none --with-mysqld-ldflags=-all-static

Note: I'm not an expert, so I'm sure some of the options have no effect with a 
PowerPC (for instance I'm doubtful that --enable-assembler as MySQL option 
really has an effect with a PowerPC). Anyway...

That compilation performed as follows (using the same my.cnf):

Operation             seconds     usr     sys     cpu   tests
.../...
TOTALS               13189.00 1733.60  195.64 1929.24 2667247 

So, it's 1.37% faster. Is is significant enough? Maybe a job ran in the middle 
of the night during the first test? Or maybe it's just because I compiled 
mysqld static.

Then I stripped the mysqld object file and used the (my-medium.cnf file). It 
performed as follow:

Operation             seconds     usr     sys     cpu   tests
.../...
TOTALS               13152.00 1705.33  213.76 1919.09 2667247 

So, it's 1.64% faster. Again is it yada yada yada?

By the way, a PPC640e with 512K of L2 cache, 256 MB of memory (Power Mac 
8500/200) performs as follows:

Operation             seconds     usr     sys     cpu   tests
.../...
TOTALS               23843.00 4612.05  682.39 5294.45 2667247 ++++++++++

The + signs mean that some test were "estimated", I've not checked the 
sql-bench doc to see what that really means...

The MySQL doc gives some information about optimizing the daemon via compiler 
options, but mostly for Intel and says anyway that you should expect 
something between 1 to 4%. In regard to MySQL, more significant optimization 
comes from the tuning of the buffers, using sockets instead of TCP/IP (when 
local) and so on.

My current guess is that the default installed kernel includes Altivec 
support, hence an executable compiled with Altivec will use it. It's JUST a 
guess... I need some more reading...

Any guru reading this willing to show the path of wisdom and enlightment?