Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it posible to compile PCSX2 in 64-bit?
I am wondering, what benefits would it make if PCSX2 would be compiled in 64-bit? Can this be done?
Few programs (unfortunatly) that are natively in x64 do offer significant improvement in performance over their x86 variants. Since emulation is very demanding, the users with Vista and XP64 could benefit from this.

Sponsored links

There's no real improvement between x64 and x32.
| i7 860 2.8@4ghz | Scythe Mugen 2 Rev.B | Asus Maximus Formula III | G.Skill Ripjaws 4 Gigabyte | 570 GTX AMP! | Enermax 720w PSU | X-Fi Titan | OCZ Vertex 120 GB |
I'm no developer and have never read the code, but I'm assuming the performance-critical parts of PCSX2 are written in inline assembly. Converting to 64-bit means all the ASM code has to be rewritten to take advantage of the new registers (I'm assuming that's what potentially will give a speed increase). Not just a simple recompile. Of course, x86-64 can run 32-bit code, too. That's why it works, but gives you no improvement.
Well, the only "native" 64-bit software that i have are 3dsmax 2009 (both 32 and 64) and progDVB. They ARE faster. 3dsMAX has improvement (on my PC, i don't know for the others) of around 10% in rendering. ProgDVB in x86 need to hold 6-8 sec to open a chanel. In x64, it is instantaneously (i am not exaggerating, try it for yourself).
Problem is that most of the present software is x64 compatibile, or some kind of hybrid (mix of 64 and 32 bit code). Software companies are more concearn in compatibility (so they can sell it to maximum number of people). I don't know that any comercial game is 100% compiled in x64 (appart from some demos).
I remember few years ago, on Anandtech, testing Athlon 64 with newly XP64. It had beta version of DivX 64-bit and it was faster by 60% than 32-bit. I don't know if there is some official version of that codec, so that is a subject of suspicion.
Quote:3dsMAX has improvement (on my PC, i don't know for the others) of around 10% in rendering.
That sounds about right (from more registers).

Quote:It had beta version of DivX 64-bit and it was faster by 60% than 32-bit.
That does sound suspicious...
Unless DivX does a lot of operations on 64-bit integers. I doubt it.
I may be wrong (I often am Tongue2 ), but I'm sure I read somewhere that one of the main problems the recompilers for PCSX2 face (EE, VU0, VU1) is register allocation, so off the top of my head, I'd have thought the extra (and larger) registers available using x64 mode would be particularly beneficial to them. You get eight extra general purpose registers, and also eight extra SSE registers to play with when in x64 mode.

Now whether having all those extra registers at the recompilers disposal helps much is beyond my knowledge, but I would have thought they could reduce the need to temporarily write stuff to system memory (in practice probably just the L1 cache) allowing a lot more work to be recompiled to be done entirely on the CPU's registers instead, eliminating both the extra instructions created to write stuff out to memory and later read it back, as well as the overheads of performing those reads and writes. But as I've never written a recompiler, I'm talking about things I have very limited understanding of.
CPU: Athlon 64 X2 4400+ (2.2GHz @ solid 2.53GHz)
GPU: nVidia GeForce 8800GTS 640MB (not currently O/C)
Memory: 2GB DDR400 (2x 1GB @ DDR422 2.5-3-2)
So, if i am correct, theoreticaly, the major boost in performance could be in extra registeres of x64, and it could be more beneficial than SSE instructions (which is not great). If this is true, maybe developers should be focus their efforts in this direction. Anyway, all our CPU-s are x64, and why not use it to the full potential.
Please, can some developer give some comment on this?
It has been discussed before. The extra registers would provide some advantage,but on the other hand you would have to rewrite almost the whole codebase to take advantage of the x64 features. Meaning they would have to rewrite almost the whole emulator for a small speed boost which is not really acceptable
[Image: newsig.jpg]
Gundark: using x64 mode would yield roughly double the number (and double the size) of general-purpose registers, but would also increase the number of SSE registers from 8 to 16. It's a win win situation regardless of how heavily the recompilers use and produce SSE instructions or standard x64 instructions. I've just recently had a look at some old PCSX2 dev blogs and the extra registers available in x64 mode were expected to hold great potential for improvements. I'm not sure what has changed since then.

Bositman: yes, I can see what you're getting at about lots of work rewriting it to take advantage of x64 extras. Certainly all the crucial hand-optimised assembly subsections would need redoing before they'd even run in 64-bit mode, but the compiler used by the developers should take care of most of the rest that is written in something like C, even if the resultant code doesn't take advantage of those extra registers without being worked on.

The two things that occur to me are
a) almost every CPU able to run PCSX2 at anything approaching satisfactory speeds is 64-bit capable already
b) the only reason for sticking with a 32-bit codebase as the main development is for users running normal 32-bit XP (XP x64 is a funny beast used by few people), or 32-bit Vista (who could almost all upgrade to 64-bit Vista, if they pay Microsoft extra for what their computer should have had on it originally)
Maintaing a 32-bit codebase seems a strange move when there is already SSSE3 and SSE4.1 optimised code floating around in certain bits of it. Surely all those extra registers would be of more benefit than extra SSE instructions, which are still limited to eight SSE registers because it is running in 32-bit mode (there's another eight SSE registers in all those CPUs doing nothing).

Has any benchmarking been done on perhaps an experimental rewrite and recompile of small bits of PCSX2 to look into potential performance gains of a native 64-bit version? All those extra registers sitting there make me question whether it would only be a small improvement. As I said before I'm far from an expert in this, but I did dabble with a compiler for the Z80 CPU and I knew having more than the three main 16-bit BC,DE,HL (and even the exchange-registers of them), plus IX and IY (and undocumented halves of IX and IY) to play with would have meant a lot less use of the stack or otherwise running out of registers and needing to temporarily write stuff to some area of memory set aside for the purpose. I'm just not convinced that all those extra and now 64-bit registers available for standard general-purpose code, and also double the number of SSE registers would only yield a small improvement. x64 is like register heaven compared with x86.

If a developer can come on here and say with authority that it has been looked at and the performance gain isn't worth it, I'll believe it, but at the moement, the more I think about it, the more it seems like maintaining legacy support could be holding back what will inevitably need to be done eventually. CPUs are getting wider but not much faster. I know quad-core support will be horrendous, needing to synchronise all the threads, but going from 32-bit to 64-bit is at least in theory just tweaking existing code to make use of more registers (in a very over-simplified way of something I know would need a lot of work).

Anyway I'm sorry for coming back on this, and I'll shut up on this now if you ask me to. I'm new here and shouldn't be questioning those who know a lot more about PCSX2 development.
CPU: Athlon 64 X2 4400+ (2.2GHz @ solid 2.53GHz)
GPU: nVidia GeForce 8800GTS 640MB (not currently O/C)
Memory: 2GB DDR400 (2x 1GB @ DDR422 2.5-3-2)
You are wrong about Win-Win. For the most cases it would be lose-lose scnario: the only changes of pointer size from 32 to 64 bits made a whole of emulator unstable AND L1 cache would be used x2 less efficiently. Yes, the number of registers are double, but inline assemble for x64 target in Visual Studio Express Studio as I know is forbidden. So overal there would not be a lot of improvement, maybe even degrade.

So until pcsx2 are still incomplete, it's really not clever to made x64 target.

Users browsing this thread: 1 Guest(s)