New optimizations?

Discuss topics related to development here.
Post Reply
User avatar
Snowstorm64
Posts: 303
Joined: Sun Oct 20, 2013 8:22 pm

New optimizations?

Post by Snowstorm64 » Sun Nov 30, 2014 8:31 am

I just stumbled across this page. Do you think it may be useful to speed up CEN64's performance? The page claims that with those new optimizations the code compiled with GCC 5.0 is three times faster than with GCC 4.9. (Although GCC 5.0 will be released only in mid 2015...)
OS: Debian GNU/Linux Jessie (8.0)
CPU: Intel i7 4770K @ 3.5 GHz
Build: AVX (compiled from git)

User avatar
Sintendo
Posts: 25
Joined: Thu Oct 31, 2013 9:11 am

Re: New optimizations?

Post by Sintendo » Sun Nov 30, 2014 2:44 pm

Snowstorm64 wrote:The page claims that with those new optimizations the code compiled with GCC 5.0 is three times faster than with GCC 4.9.
First of all, that's actually not what that page claims, or not exactly at least. The improvements involve automatic vectorization, which is only beneficial for very specific kinds of code; mostly loops in which the same computations are being applied to a large amount of data in a very predictable fashion. Rest assured Intel chose the benchmark example very carefully to show off their results. A lot of code is not like this.

Moreover, it seems some of the improvements only apply when compiling for specific chips. So unless you happen to own one of those chips and use a build of CEN64 compiled especially for it, the improvements will likely be much less significant.

So will CEN64 benefit from this? Unfortunately emulators are generally not very vectorizable. If there's any part of CEN64 that might benefit from this, I'd say it'd be some of the RDP code, but I'll leave it to others who know more about the code to comment on that. On the plus side, this is just one of the additions in GCC 5.0, but don't expect miracles. I can guarantee your framerate won't triple by using a build compiled using GCC 5.0. ;)

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: New optimizations?

Post by MarathonMan » Sun Nov 30, 2014 3:10 pm

A lot of vectorization in the RSP and whatnot is mostly done by hand since old versions of GCC missed a lot of avenues for optimization when given regular, conforming C99 code.

Looking at the release notes for GCC 5.0, it kinds of echos what Sintendo said -- not a lot of improvements in there that would be beneficial for CEN64. Since CEN64 is pretty much C99 with compiler-specific extensions, most of any future benefits will come from optimizations to LTO (applicable to C99) or code generation... neither of which GCC 5.0 seems to improve upon much.

Of most interest to me was __builtin_add_overflow and friends, but even that offers a potential minor performance boost for very specific sections of the emulator.

AIO
Posts: 51
Joined: Wed Nov 05, 2014 4:56 pm

Re: New optimizations?

Post by AIO » Sun Nov 30, 2014 7:20 pm

Sintendo wrote:So will CEN64 benefit from this? Unfortunately emulators are generally not very vectorizable. If there's any part of CEN64 that might benefit from this, I'd say it'd be some of the RDP code, but I'll leave it to others who know more about the code to comment on that. On the plus side, this is just one of the additions in GCC 5.0, but don't expect miracles. I can guarantee your framerate won't triple by using a build compiled using GCC 5.0. ;)
This is spot on. RDP would probably benefit the most from using a better compiler.

For RSP, nothing beats manual code :D .

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests