-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable screen clearing on loadstate, and use Link Time Optimization #176
base: master
Are you sure you want to change the base?
Conversation
Fix GCC compiler warning in port.h (NOMINMAX now defined as 1) Re-added sanity check to prevent an infinite loop if you run without loading a file first
…32__ in all MSVC targets
I think the sanity check is indicating a deeper problem, maybe in retroarch even. Cores shouldn't need to check if there is content loaded, I believe that is a frontend feature. Also Edit: Also do we really want to force LTO? Lastly, the upstream snes9x repo supports libretro so you know. |
In my testing, I got around a 5% performance boost from LTO. If it's not appropriate to use on non-windows platforms, I can change the makeflie back. |
It was an open question, I'm not what the potential issues could be honestly. |
The idea is that we merge it first here, then send a PR to upstream. |
I'm still a little unsure about the |
I can try out Xbox and Xbox 360 at least. There were previously issues with it building on MSVC2005 anyway, and original Xbox will require MSVC 2003, so there is still work left to be done anyway. |
The infinite loop is a regression in RetroArch, in RetroArch-1.7.3 it crashes entirely in RetroArch instead. I'll bisect this and get a backtrace later. I suggest fixing this in RetroArch instead of snes9x though. Edit: I mean sometime tonight or tomorrow morning when my cpu is not busy building libreoffice... |
Should I resubmit the pull request and include only the screen buffer clear change? |
we;re trying to remake upstream friendly here... |
Can’t we just reuse the fastsavestates flag to not clear the screen? Otherwise looks fine. LTO should work. In my experience, clang/llvm does a slightly better job optimizing, too—about a 3% advantage. |
I think it's better to separate them, since in the libretro version, you pretty much never want to clear the screen after a loadstate. |
@bearoso Can you push these changes upstream? I would then just be able to do a git pull instead to pull in these changes. |
The crash without content is a regression between RetroArch Edit: Yes, it happens with older snes9x cores too as well as bsnes-mercury where this was originally fixed for. |
First bad commit for the crash.
@Tatsuya79 Can you take a look at this? |
And a backtrace using
|
@Dwedit The infinite loops started in one of your commits.
|
I'm going to link this here too since it has a lot of backstory on these issues. |
I looked at libretro/RetroArch@ad0a36b but I can't see anything special. It adds a menu option that maybe triggered some problem? |
I don't see the problem either, but as the parent commit doesn't have the issue it has to be related somehow... |
Maybe this helps, asan with
|
I made most of the changes. We're just going to skip blacking the screen universally, since I don't think it'll affect anything except loading a state while paused (in which case is it really better to have a black screen than an old screen?). It's the port's memory, so it should be the port's decision on what to do with it. I left out the rom_loaded check since you guys are still discussing it. |
This PR appears to make the core extremely slow. With fastforward on, and both RA+core under ASAN+debug, I only get 75fps. Without the patch I get ~500fps even with ASAN+debug on. Runahead was off in both cases. |
Which platform and compiler is LTO failing horribly on? |
Older GCC used to require the optimization flags be on the link stage for LTO, perhaps that's the problem. |
Me? I'm on gcc 8.2.0 on archlinux |
|
I meant it needed -O3 et al on the link stage. gcc 8.2 it shouldn't matter, though. |
It's using -O2 right now, is -O3 any better? edit: added in the same optimization flag (currently -O2) to the linker flags. |
I get around 180fps with gcc 8.2.0 on Slackware64-current here with or without -flto. The main difference I noticed is that my compressed package is 3 mb larger and the link time is a lot longer. |
If anything, LTO should make it smaller. It's normal for the link time to be longer, since all the optimization is moved there instead. |
I checked again, the current master.
And the parent commit.
Note that both the standalone snes9x and libretro core are contained in this package. |
@Tatsuya79 Apologies, seems I screwed up the first bisect somehow. It as PR libretro/RetroArch#6484. |
Yea, that PR. I found this diff stops the crashes and infinite loop, but it also breaks loading content...
I made this issue. libretro/RetroArch#7082 |
I just did a quick test, and in the current Git Master version of RetroArch, it runs the dummy core instead of the Snes9x core with no content loaded. So it never reaches the sanity check code. However, Retroarch is allowing access to the Quick Menu with no content loaded, and is also allowing leaving the menu with no content loaded. It does not do this if you use the Win32 Menu system to load a core rather than the main Load Core menu option. |
@Dwedit After reverting libretro/RetroArch@8cd8e7d I found snes9x does reach the sanity check code and exits without crashing or starting the dummy core, but asan still reveals problems. Other cores still just crash. I'm not sure where in your runahead PR this started, but I would really appreciate if you could help fix it. :) |
When retroarch is started from the command line, it appears to not have the dummy core set without content. edit:
|
I just want to point out that the issue with cores crashing and the infinite loop are mostly solved, there are some core bugs remaining, but as far as snes9x is concerned its fixed. |
Can this be merged then? |
Does this need to be implemented in upstream still or what is the deal there? Does the upstream libretro core have issues remaining still compared to the one in here? We need to start making the decision soon to completely migrate over to snes9xgit, and if;/when we do, I have to be certain we don't lose anything in the process. So just tell me what to do here - merge this, then update to snes9xgit latest sources again? Can this be individually pushed to upstream or did they veto this? |
From what I gather, Snes9x upstream reviewed this PR, and accepted the makefile changes, then completely removed screen clearing (no config flag), and accepted some minor changes. I believe you can outright replace libretro/Snes9x with the upstream version completely. |
OK - just a heads up - Can you push these two changes to upstream? Also, I just pulled all changes from upstream. Can you let me know if it already incorporates these runahead changes and if so, if we can either close this PR or it still needs to be merged? If it still needs to be merged, there is a merge conflict that has to be resolved first. |
82de673
to
30b4682
Compare
80301a8
to
958a5d4
Compare
bd02e32
to
dad0ae5
Compare
7bb4765
to
8b20cb5
Compare
Changes:
__WIN32__
in all MSVC targets