PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

64-bit MIPS optimization (L@@K, Dan!)

Who ever said that 64-bit optimizations for Casios were not possible or practical?!

http://forums.projectmayo.com/viewtopic.php?topic=3845&forum;=23

Maybe with 64-bit optimized code, we could get a 25+% increase or so in PQ MIPS performance? Someone should try it out!

Does anyone know MIPS asm?

C'mon, fellow MIPS users! "Dan, Dan, he's our man! If he can't do it, no one can!" Or maybe they can?
I might decide to keep my E-125 a bit longer... that is, if someone uses this knowledge for the good of all mankind... or just fellow MIPper's good, that's plenty good enough.
Oh man, this new version of PocketDIVX kicks ass on my overclocked E-125. I barely dropped any frames in the Episode II trailer, and in Spiderman I saw scenes that the thing previously skipped right through! I'm just sitting here checking out every video clip I have on my PocketPC.

Dan you need to look into this. The source to PocketDivX is available, you might even be able to directly impliment their caching and display MIPS ASM routines into your current projects!

Robotbeat, next time your at PocketDivX's forums please suggest a "Start in Dir" setting for the open dialog box. I hate having to explore to \Storage Card\My Documents\Video everytime I want to open something.
It wouldn't be too bad if the playlist editor could save to the root directory. Even more than that, the playlist editor should be integrated. Also, a "back" button needs to be implemented and stuff. Anyways, maybe I should finally replace the cracked screen on my e115 (I have a replacement screen and I have done it before on another Casio, but I just haven't gotten around to it). I'll overclock it in the process. Finally, good video playback without dust and with 16-bit high-end-laptop-quality lcd on a device with 3 year old hardware (an entire lifetime in handheld computing years). This is what I wanted on my e105 so long ago!
My parents still use their 133MHz Gateway, it's about 7 years old now I think. I tried to give them my old 500MHz Pentium3 machine but they complained that it was slower than the gateway.
Back on topic...

Dan?
I ahve this cousin named Daniel. We call him Danny.
While this information is potentially very useful, i'm not sure how many developers would take advantage of exploiting it. Dan may be able to squeeze more performance of out PQ for Mips, but it would still involve considerable work. Also, ideally he would require a Mips device for testing & debugging. Also, IMHO Mips asm is bleedin irritating although inline asm can be used. Mips devices generally account for around 10% of users (and shrinking) and i doubt that Dan has time to implement such changes, especially for such a small proportion of users of a GPL'd app. I may be wrong, though.

Anyway, there's nothing to stop any other Mips user/fan implementing such changes. The source is freely available, after all.
I didn't rule out that last possibility! I am asking for people who know about MIPS asm to come forward.

This would be pretty cool if it became playable on MIPS. I am sure that some MIPS user will come forward and try to implement this.

Apparently, the people at ProjectMayo think it's important enough to spend plenty of time implementing it. And they have around 5 platforms (Windows, Mac, Linux, Amiga, Pocket Divx (BE-300, PPC 2K(2), e10x). Come on. As an opensource project, I think that PocketQuake should have more work done for it.

I have a question for Dan:
Are all the optimizations that you've done implemented in the current release of PocketQuake? If not, you should submit your current source so that work is not done twice.
T1 pretty much summed up my stance on the MIPS optimization. I don't have access to MIPS hardware, plus anything I do at this stage would be global to all devices (fixed point conversions), or benefit the many (ie StrongARM - you know, the whole "the needs of the many outweigh the needs of the few" thing).

The source you see online is basically what I have here at this point.

Dan East
Thanks, Dan!

I'll learn C++, now. I have waited long enough.
Dans stance is 100% justified. Not only is he very busy anyway, but it just doesn't make sense to do changes that won't affect all the builds globally.
I always stand behind Dan. I am not trying to demand that he give his time to do this or that, only that if he is going to spend his time, he might as well consider this. But now that I know that he won't do many device-specific things, I don't think that it was necessary to point this out to him. However, anyone willing to do a MIPS enhancement might look to doing this.
Blade · 29 Mar 2002, 11:33 UTC — -
What about the guy who did the mips optim. for Pocket Divx ?

Somebody already asked HIM if he wants to take a look at PQ ?

Blade
The ASM MIPS caching and display routines might just copy straight to PQ. Well of couse not "straight," but I think they could be converted easily enough and implemented in PQ.
Well, there are a few places where 64-bit integers are needed in PocketQuake for fixed-point math to avoid overflow/underflow. Those areas, if they are used a lot by PQ in the engine, could be optimized with 64-bit MIPS asm.
I don't think 64 bit ANYTHING is NEEDED in PocketQuake.
But if you find a place where they would be more efficient then optimize for MIPS. Double the data bandwidth would help, depending on how many places it could be optimized for.
There are some spots where when you need to do fixed-point math, you will get an overflow. For instance, try multiplying 0xFFFFFFFF by 0xFFFFFFFF. You know what I mean? So Dan used 64-bit integers for that, but I don't think that it is actually implemented.
well then hop to it, bub!
I was able to squeak by with 32 bits for the current optimizations. I had to tune the precision exactly, and in some cases didn't have an extra bit to spare. Efficient 64 bit integer math would make a global, generic floating point replacement a more realistic possibility.

Dan East
When you say efficient, do you mean like native cpu support, like MIPS? Or do you mean like just doing 64-bit integer math efficiently on a 32-bit platform (i.e. every other newer processor out there, excluding like UltraSparc, Itanium, and AMD's Hammer)? You probably mean both, but I do not know exactly what kind of performance penalty would occur if you are doing 64-bit stuff on a 32-bit system. If I do any optimizations at all anytime soon, I think I'll stick to 32-bit.

BTW, my square-root algorithm works fine with 64-bit, as well! hehe... what would actually need to find square-roots a lot? Maybe 3d transformation or something like that... Hey, maybe my algorithm can be used for something! Well, I looked at GBA dev sites that have all this info on fixed-point stuff and stuff like that, and, well, there are about 10 other examples of doing what I did with my algorithm...

:cry: now I don't feel so "special" anymore! :cry: :wink:
Ya, but you still did it all on your own!
Well, I guess I mean both. :)

There aren't many sqrt operations.

I did a benchmark between float operations and their 64 bit integer counterparts. The 64 bit operators were a little faster than floating point on ARM, but not by much. 64 bit math is many times slower than native 32 bit integer math.

Dan East
thats why you mix them up, do 64bit ops, and 32bit math!
Dan:

I'm presuming the 64 bit operations you used were in C/C++? The StrongARM's 64 bit multiply instruction is only slightly slower than the 32bit one (one issue cycle more). Which compiler did you use?

what would actually need to find square-roots a lot?


In graphics, lighting... but any code that does a lot of square roots is going to be slooow.

Cheers,

Refractor