| View previous topic :: View next topic |
| Author |
Message |
evilo

Joined: 22 Apr 2004 Posts: 230
|
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Wed Jun 20, 2007 10:22 am Post subject: |
|
|
Its a lot easier to set up a PSP for development, and its new and shiny so more people are interested in it.
You can use vu0 in macro mode and get similar results. Take a look at the math3d code in ps2sdk for an example. |
|
| Back to top |
|
 |
evilo

Joined: 22 Apr 2004 Posts: 230
|
Posted: Wed Jun 20, 2007 4:57 pm Post subject: |
|
|
the toolchain script is almost the same, and apart the fact that you need a way to run unsigned code on the PS2, it's not difficult!
anyway, as soon as I will get my PS2 back (that is still travelling across europe), I'll have a closer look at it, I have a few things that would benefits of such optimizations.
evilo. _________________ http://psxdev.info/evilo/ |
|
| Back to top |
|
 |
Lukasz

Joined: 19 Jan 2004 Posts: 248 Location: Denmark
|
|
| Back to top |
|
 |
emoon

Joined: 18 Jan 2004 Posts: 91 Location: Stockholm, Sweden
|
Posted: Fri Jun 22, 2007 5:40 am Post subject: |
|
|
If you really want to do math calculation in an efficient manner on the PS2 you need to use vu0 micromode.
What that means is that you do something like this (a basic mul example)
| Code: |
Vu0 code (or something like this)
mul vf01, vf02, vf03 nop
nop[e] nop
|
And then the ee code:
| Code: |
..upload MyMathFunction to Vu0 goes here..
Then:
// set some input registers
__asm__ volatile ("lqc2 vf02,0x00(%0)\n" : : "r" (&myValue1) : "memory");
__asm__ volatile ("lqc2 vf03,0x00(%0)\n" : : "r" (&myValue2) : "memory");
// calls the vu0 program (start from address 0 in vu0)
__asm__ volatile ("vcallms 0\n");
// do something on the ee while vu0 is calculating...
// ...
// Get the result from vu0 (3 vnops to make sure the calulation has finished if it takes 4 cycles)
__asm__ volatile ("vnop\n");
__asm__ volatile ("vnop\n");
__asm__ volatile ("vnop\n");
__asm__ volatile ("sqc2 vf01,0x00(%0)\n" : : "r" (&myResult) : "memory");
|
Sure to use vu0 in macromode (similar to vfpu on psp) you get better performance than not using vu0 at all.
But infact its even faster to use vu0 micromode even if you block on it directly afterwards because you dont need to fetch any extra instructions to the I-cache and vu0 just runs more efficient in micromode. |
|
| Back to top |
|
 |
|