Wednesday, July 26, 2006

Further dynarec optimisation

I've spent the last couple of evenings working on adding support for additional instructions to the dynamic recompiler. With every instruction I add, the generated code becomes a bit more efficient as I can avoid various bookeeping work (such as flushing all the cached registers out to memory.)

I've added code to handle the following ops:


  • MULT, MULTU (multiply, multiply unsigned)

  • DIV, DIVU (divide, divide unsigned)

  • MFLO, MFHI (move from lo/hi)

  • MTLO, MTHI (move to lo/hi)

  • LB, LBU (load byte, load byte unsigned)

  • LH, LHU (load halfword, load halfword unsigned)



So far I'm seeing around a 5-6% speedup with these changes (on top of the 10-12% speedup I talked about on Sunday). I am generating slightly more code as a result of this work, but given the large savings I made over the weekend this isn't much of an issue.

My next job is to look at optimising the remaining load/store instructions - I just have LWU/SB/SH to do (ignoring the 64 bit instructions for now). Once that's done I'm going to have a look at optimising sequences of load/store operations by caching the base address between uses. I think that should give a significant speed up for memory intensive chunks of code.

-StrmnNrmn

52 comments:

Morgan said...

Great sounds like your starting to get better at coding too, nice 15-18% speed increase so far. Looks like R7 is going to be a promising release! Well it's great that StrmnNrmn is giving us daily updates these past two days but I got more good news, and updated Daedalus Testing Results! Here's the link!

http://rapidshare.de/files/27027325/Captain_Morgan
_s_Daedalus_R6_Rom_Test_Results.zip.html


* Once again link is cut in half so you can see the whole thing, copy and paste BOTH parts to download the UPDATED file *

skater9269 said...

yes i cannot wait for r7 bo yah bow chicka wowow i love you strmnnrmn

Mario Kart God said...

Strmnrmn you are my all time favorite coder! When R7 Comes out, how much percent will the speed jump up?

Mario Kart God said...

Morgan can you tell me your email address so I can email you pictures of Mario Kart getting up to 18.20 fps in games screenshots. And more good in game screenshots.

Morgan said...

I have updated my list once again! Now with paper mario and zelda: OOT! My email is volcomstone463@aol.com, enjoy the latest list! And remember view the files as "thumbnails"! Keep up the great work StrmnNrmn and I hope you got my email and I hope you looking at this!

http://rapidshare.de/files/27035060/Captain_Morgan
_s_Daedalus_R6_Compatability_List.zip.html

* Is my link working can someone else besides me tell me because I haven't seen anyone talk about it yet? *

Mario Kart God said...

I will be emailing you for great screenshots now!

Mario Kart God said...

Check your email morgan, for some amazing screens in Mario Kart!!

Morgan said...

If you don't mind I added the time trial pics you sent to me and added them to the list. They're in a seperate folder in the Mario Kart section. They'll be available to the public in my next release. But I sent you a copy of the updated list so you know what it looks like. Enjoy!

Mario Kart God said...

I have some more to send you. But I found that if you are to put on the expansion pak on in Mario Kart, the game will go smoother and a couple frames faster.

Morgan said...

I just finished adding your other pics to the folder. Looks great and it looks like I'm getting alot done too. Anyway StrmnNrmn hope you got my email and looked at my compatability list to show you how many hours I put into this. (espcially Zelda)

Mario Kart God said...

Morgan you are like the captain helper of StrmnNrmn, and if you need sme other screens I'll help to. What you do is great for StrmnNrmn(and others)!

Mario Kart God said...

StrmnNrmn I was just wondering if you have an estimated date on when you will be releasing R7.

Exophase said...

I have a question: why do you have to flush the register cache for the instructions you have not inlined in recompiled code? I assume that you're just calling generic C functions, in which case you should only need to flush the registers that are in caller save positions. Of course, the better alternative to this is to write your own functions in ASM that are purely callee save, and have them use as few registers as possible (I assume you have some temporaries that aren't available for register caching, it should be good to use those). I also assume that you're flushing registers at the end of every block. With the sheer number of registers that you have to deal with it might be better overall to have static register caching instead of dynamic, possibly based on statistical analysis on a per-block basis. You can probably map as many as 27 registers, perhaps with the highest priority ones going in callee save registers (remember, for C functions that don't work on a large number of variables not all of the calleresave registers will have to be saved, so it's better to put the burden on the called function).

skater9269 said...

strmnnrmn do you have all processes that can be done nativley on the psp done or have you yet to to do that because that should create a speed boost if im correct.

Morgan said...

Thanks guys, I can't really talk right now but I'll be back in a couple hours to tinker with some roms and also talk on here. See you then!

Mario Kart God said...
This comment has been removed by a blog administrator.
Mario Kart God said...

StrmnNrmn do you know when you will be releasing R7(ESTIMATE)?

Morgan said...

Give him time guys just be patient, thank you to the people that congratulated me on my work. Well I have updated my work with another rom and extensive work on two other roms. The latest work I have done is ready for download in my link below! If you would like to help me further the progress of the List then take some shots like I have, and email them to me! Volcomstone463@aol.com is my email. Well I'm going to go get doing some work but I'm here now!

http://rapidshare.de/files/27105514/Captain_Morgan
_s_Daedalus_R6_Compatability_List.zip.html

* Note once again the link is cut in half you must COPY and PASTE BOTH halfs into your web browswer in order to download *

Morgan said...

Hey Disturbed look at my post 2 above yours, download that. You can see me getting past the menu thing in Zelda easy. It tells you how you can too!

Morgan said...

Just to not PSPUpdates has an article about my very Compatability List. Though they are showing an early release I sent them the latest one moments ago. And I'm not talking about the one I posted about 30 min ago! I have updated it again, lol! This will be my last update for a little while, but I now I have a total of 15 N64 games tested and documented. Go check out the latest list!

http://rapidshare.de/files/27129440/Captain_Morgan
_s_Daedalus_R6_Compatability_List.zip.html

* Note once again the link is cut in half you must COPY and PASTE BOTH halfs into your web browswer in order to download *

Mario Kart God said...

Morgan, I will be emailing you some screenshots again of Mario Kart. But this time I got up to 22 fps in game!!!!

Morgan said...

Yeah that sounds great I'll add them, maybe you should look into getting high FPS in the races like in 150cc and such. Or maybe see how FAR you can get. But yeah I'll add them into the next release. The next release should be promising, and did you guys see I'm on PSPupdates! It's kinda cool, back to work!

Mario Kart God said...

Yeah I just got another screenshot in time mode which was 22.95 fps!!!!!!!!!!!!!!!!! And in all the time mode levels I do the average fps is a steady 18 fps!!!!! I'll email you now!

Morgan said...

Okay glad to see your getting faster results.

Mario Kart God said...

OK, now i'll see what I can get in 150cc. Please email me when you release it Morgan. Thanks.

Mario Kart God said...

So how do you like them Morgan? Is that fast or what!!!

Morgan said...

Yeah they're fast and they're in the next release. I'll tell you when I release it. Just try to get far in that 150cc.

Mario Kart God said...

Ok, i'll try.

Mario Kart God said...

Well i have tried to get far in 150cc a little, but in time trial I just got 23.10 fps in game!!!! That'ss HIGH!!!!

Mario Kart God said...

I'll email you the photo right now. Morgan in the release can you please, next time your on pspupdates thank me for the Mario Kart time trial mode pics. I've never had my name on that website. You don't have to do it, but it would be cool.

Morgan said...

Since the Dynrec isn't complete it causes random issues with some games. With the dynarec complete or near completion in R7 alot of those problems should be fixed when R7 arrives. Mario Kart I gave you credit for the shots in the actual files. Pspupdates, I'll be on there soon when I release an update to my even latest one! This next one is a BIG update, I'll post it here when I'm done.

Morgan said...

Here you go the latest build! Includes 20 rom tests with "missing_mux" for all roms (except Mario 64, won't really benefit StrmnNrmn I'm sure he has one for Mario 64). Enjoy, and I sent this version to PSPUpdates so be on the look out for it, and please JUMP IT UP!

http://rapidshare.de/files/27151426/Captain_Morgan
_s_Daedalus_R6_Compatability_List.zip.html


* Once again link is cut in half so you can see the whole thing, copy and paste BOTH parts to download the UPDATED file *

Mario Kart God said...

I'm playing 50cc and got to round three so far!!! I'll give you screens when I'm done!

Morgan said...

Really that's great, what cup are you in?

Mario Kart God said...

The first one. But I quit on the 3rd level(BEACH LEVEL). I have good screens to give you though!

Mario Kart God said...

The first one. But I quit on the 3rd level(BEACH LEVEL). I have good screens to give you though!

Morgan said...

Like you actually ran the emulator with one run and got to the 3rd race? You completed 9 laps? If you did I'm pretty sure you are a Mario Kart God. Because most can't get even a lap in before it freezes.

Mario Kart God said...

Hey Morgan your latest releast is awesome! The missing_mux will probably be a big help to strmnNrmn! GOOD JOB!!!

Mario Kart God said...

Yes that is right I completed 8 laps actually, but still. I'll send you pics now. I'll try to beat the whole thing tonight!

Morgan said...

Thanks it was ALOT of work, I'm tired I'm going to go eat and then maybe hit the sack.

Morgan said...

Keep it up man because I'm sure that's as far as anyone's EVER gotten. Like me witht the StarFox 64 Mission 1 play. Good night!

Mario Kart God said...

I am the one who got 23.10 fps. I am helping out Morgan, but I got the super fast fps screens in Mario Kart.

Morgan said...

Mine is at pspupdates.qj.net I'm Captain Morgan! Lol, I had to do it I'm sorry. But yeah good night and I'll cya tomorrow. Any emails for now on send them to Captain_Morgan_Daedalus@yahoo.com well if you want your email read send them there! Thanks and cya tomorrow!

Mario Kart God said...

StrmnNrmn got any updates?

Urkel said...

A statement for Morgan

I dont want to prove you wrong or anything, but I can get mario party running in party mode, and it doesnt crash at all, I can actually play mini games at a solid 3-4 fps!!!

Mario Kart God said...

I finally beat the 1st cup(4 levels) in Mario Kart!!!! Will be giving Morgan pics tommorow.

Morgan said...

Thanks guys, yeah Mario Party crashs for me there so nothing I can do. Like my list isn't a like definate "you can't get past here" some roms go further on different psp's it's luck. That's great that you got that far. Anyway I'm getting back to work it's a new day so!

Mario Kart God said...

Yo, StrmnNrmn any updates, please.

Morgan said...

Well my newest build will be here shortly, StrmnNrmn will talk to us when he can I can assure you guys that. I have work in like 2 hours so this build will be my last for today.

Morgan said...

Here you go what you've been waiting for my latest build! It covers 25 titles and full "missing_mux". StrmnNrmn I hope to hear from you soon, maybe get your opinion on what you want to do/what you think of my project here. Anyway enjoy guys and I'll be on later like in 7 hours when I get off work! Captain_Morgan_Daedalus@yahoo.com is my email for any requests/questions! And Mario Kart God look at pspupdates for a special thanks when the new article is up!

http://rapidshare.de/files/27244220/Captain_Morgan
_s_Daedalus_R6_Compatability_List.zip.html


* Once again link is cut in half so you can see the whole thing, copy and paste BOTH parts to download the UPDATED file *

Morgan said...

1. It's summer there is no school
2. I'm 17 I have a job
3. I'm leaving for it now cya


Hopefully StrmnNrmn will have an update for us when I get off work. See you in 5-6 hours!

Morgan said...

My list and Wally's list are totally different, what's going on lol?