..:: PCSX2 Forums ::..

Full Version: mVU FAQ sticky
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, Guys.

As most people have probably noticed the latest SVNs are boasting the option to use mVU instead of sVU.

Although it is still very a much a WIP (as is the whole PCSX2 project) I think it would be a good idea to make a FAQ for it and post it as a sticky.

There are two main reasons for it as I see it:

1. A lot of people are asking the same basic questions here and even more so on other forums. And since it is not a hack (which are formally not supported and provided as is) but intended to be an integral part of the PCSX2 emu, understanding it is a good thing.

2. Once you release v.0.9.7 of which mVU will officially be a part of (it's much usable already in it's current form), you will probably need to add this info to the configuration guide anyway.


I appreciate the fact that cottonvibes has his hands full right now, but I do think this FAQ will help reduce unwanted questions/comments on the forum and in the issues section. I do know that some info is already scattered in the forum, but people are lazy and besides having it in one clearly visible place is convenient.

So, what do you say, Team?
not sure if a FAQ is really necessary.
is there really that much questions to be asked about it? Tongue2

anyways, i might as well link this other thread where i talked about it a bit:
http://forums.pcsx2.net/thread-7489.html
Well now I tested new one with some hax and I got 10fps speedup in some games. Good job!
(06-10-2009, 08:19 AM)cottonvibes Wrote: [ -> ]not sure if a FAQ is really necessary.
is there really that much questions to be asked about it? Tongue2

Um, for me PCSX2 is not only a way to play PS2 games at higher res and with the comfort of statesaving anywhere I want, but also much pleasure is derived from the mere fact of tinkering with settings, trying out new versions, finding solutions to bugs etc.
So therefore I would like to undertsand a little more info about mVU besides the fact that it is intended to be a more compatible recompiler.

For example how does mVU differ from sVU (in layman technical terms), what's the idea behind it's speedhacks and what other possible directions for mVU you are considering (like, those 'aha, I think I'm onto something here' ideas that you would like to explore in the future).

If you find some time to write that up I think some people including me would find that an interesting read.

Anyways, I would just like to say thanks to the whole PCSX2 team and note that current progress of the emu is moving at a staggering pace - just to think that in the last 3 months after release of 0.9.6 we already have a pretty solid mVU which raises quality (Okami, I'm talking about you, yes, you!) and a new speedhack aka CycleStealing which speeds up certain games (GOW 1/2 playable at fullspeed) and that's not counting all the minor tweaks and enhancements made on a daily basis. Great work guys!

/dream mode on/Now if only the Tri-Ace games speed issues could be resolved.../dream mode off/
Uh you really can't describe any of that in layman terms since it is all pretty complex coding,especially since this is the VU unit of the ps2. So even if he wrote those down,about 98% of people around here would not understand them
Ooookay... Blink
bositman is right that most people probably won't understand.
in fact, whenever i go into detail about mVU, people usually stop replying lol
(like in this thread http://forums.pcsx2.net/thread-7489-post...l#pid54945)


but i do enjoy the occasional dev-talk, so i'll briefly go over the speedhacks microVU has, and what they do:

1) The Status Flag Speedhack - The PS2's VUs update a bunch of flags every instruction. This is 'costly' to emulate, so the idea is to have optimizations to only 'update' the flags when they will be read by another instruction. This is safe to do 'if' there is no Sticky-flags.
Sticky-Flags accumulate with the results of previous instructions, so if you 'skip' flag updates, then there is a possibility your sticky flags won't be accurate.
There are 2 flag registers that are updated every instruction, the Mac Flag Register, and the Status Flag Register.
The Mac Flag Register has no sticky bits, you can safely optimize out a lot of mac-flag updates.
The Status Flag register has sticky bits, so any attempt to optimize out flag updates is a hack! (well except for one way which i do, but its too complicated to explain).

anyways, Super VU actually optimizes out Status flag updates (does the hack) w/o an option to turn it off.
for microVU, I made it into a speedhack since my focus is on compatibility first, and speed second...


2) The min/max speedhack - The VU processors work very similar to SSE's Denormals Are Zero mode, in that they count denormals as zero.
However, there are some VU opcodes (such as mini and max), that consider denormals in their result.
for example, consider the following:

x = max(0, 0.0000000000000000000000012); // Assume the second number is a denormal (they're just really-small numbers)

now the result SSE with DaZ would give is:
x = 0;

the VUs result would be:
x = 0.0000000000000000000000012;

the reason SSE with DaZ gives '0' as the result, is because it counts any denormal number as '0', so it would be the same as doing:
x = max(0, 0);


anyways, Nneeve wrote some slow-code to emulate the VU's behavior with SSE+DaZ. I optimized it as much as possible (w/o changing the basic algorithm), but its still slow compared to normal SSE min/max instructions.
So basically what the speedhack does is, instead of using the slow-and-accurate code, it uses the fast normal SSE min/max instructions.
this gives a mild speedup (especially for AMD cpus).
(06-10-2009, 06:19 PM)cottonvibes Wrote: [ -> ]this gives a mild speedup (especially for AMD cpus).
I love youBlush
Keep up your great work!
(06-10-2009, 06:19 PM)cottonvibes Wrote: [ -> ]bositman is right that most people probably won't understand.
in fact, whenever i go into detail about mVU, people usually stop replying lol
(like in this thread http://forums.pcsx2.net/thread-7489-post...l#pid54945)
but i do enjoy the occasional dev-talk, so i'll briefly go over the speedhacks microVU has, and what they do:

Hey, thanks for the speedhack explanation, with my smart cap on I kinda got a little insight into those.

And, yeah, keep up the good work!