Julia set demo

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Julia set demo

Post by ralferoo »

Well, I never figured out how to get DMA working with libspe2 (see my other post), but the first day's hacking has been quite productive.

I've written an hand-optimised assembler Julia set demo, and it gets some quite impressive results. On a demo designed to avoid much black, I get the following results:

Code: Select all

stats-1080i.txt:Average framecount over 1700 frames: 90.9 FPS
stats-1080p.txt:Average framecount over 1700 frames: 90.8 FPS
stats-480i.txt:Average framecount over 1700 frames: 469.3 FPS
stats-480p.txt:Average framecount over 1700 frames: 469.3 FPS
stats-576i.txt:Average framecount over 1700 frames: 393.9 FPS
stats-720p.txt:Average framecount over 1700 frames: 199.3 FPS
and the results from a demo over areas with lots of black bits is pretty good too!

For those that are interested, the inner loop uses SIMD vectors and actually calculates 16 pixels at once. I've also unrolled the inner loop three times for good measure!

I've created a page at http://ranulf.net/ps3/ for the demo sourcecode and will keep it up-to-date with any other demos I write in the future.

The best demo to run is

Code: Select all

make test
although

Code: Select all

make time
shows performance at near optimal places and

Code: Select all

make stats.txt
determines speed at various resolutions. Please make sure your monitor is off at this point if it can't handle all resolutions (note that I also test against PAL 576i as that's what I'm developing with!)

Apologies that the webpage looks pretty ugly - my webserver crashed a couple of weeks ago and I haven't bothered to restore all the old site... :(
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Re: Julia set demo

Post by ralferoo »

ralferoo wrote:Well, I never figured out how to get DMA working with libspe2 (see my other post), but the first day's hacking has been quite productive.
I should probably explain that that comment means that I'm using libspe rather than doing this without DMA... Just in case... :)
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

Could you post a screenshot for those not yet in possession of a PS3?
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

Arwin wrote:Could you post a screenshot for those not yet in possession of a PS3?
As I've not written anything to save the screen from the PS3 yet, the best I can offer is a low-res camera shot of the program running on an old PAL TV. Doesn't do it any justice, but if you really want it... http://www.ranulf.net/ps3/pictures.php
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

So, I was reading article 4 in the IBM series on SPE programming and I realised that my attempt at unrolling was almost futile as I'd unrolled to avoid branching rather than taking into account the processor pipeline.

So, I reordered the instructions in the main loop and got over 1.5x speed improvement.

The new results are:

Code: Select all

stats-1080i.txt:Average framecount over 1700 frames: 155.0 FPS
stats-1080p.txt:Average framecount over 1700 frames: 154.9 FPS
stats-480i.txt:Average framecount over 1700 frames: 791.5 FPS
stats-480p.txt:Average framecount over 1700 frames: 793.1 FPS
stats-576i.txt:Average framecount over 1700 frames: 664.0 FPS
stats-720p.txt:Average framecount over 1700 frames: 341.0 FPS
Not bad, especially as I know there are other areas that can be easily improved - e.g. the SPU always initiates DMA then waits for it to complete before continuing rather than having DMA running in the background.

I've uploaded the new version to my site http://www.ranulf.net/ps3 and this new code includes some experimentation with controller - the right stick pans around the image, the left stick changes the julia constant and right triggers zoom in and out and circle quits.

It's obvious that IEEE floats aren't good enough once the user is in control of the zooming; I'll be looking at rewriting using fixed precision or IEEE doubles.
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

ralferoo wrote:
Arwin wrote:Could you post a screenshot for those not yet in possession of a PS3?
... the best I can offer is a low-res camera shot of the program running on an old PAL TV. http://www.ranulf.net/ps3/pictures.php
I've added a photo of a 720p projector image to the bottom of that page. It's a bit better but still not brilliant!
Post Reply