-
Notifications
You must be signed in to change notification settings - Fork 131
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
Lightning+Lightrec updates and other optimizations #862
base: master
Are you sure you want to change the base?
Conversation
This pull request introduces 1 alert when merging 8ae372a into bd6b9ef - view on LGTM.com new alerts:
|
@@ -375,7 +376,8 @@ ifeq ($(HAVE_LIGHTREC), 1) | |||
$(DEPS_DIR)/lightrec/memmanager.c \ | |||
$(DEPS_DIR)/lightrec/optimizer.c \ | |||
$(DEPS_DIR)/lightrec/reaper.c \ | |||
$(DEPS_DIR)/lightrec/regcache.c | |||
$(DEPS_DIR)/lightrec/regcache.c \ | |||
$(DEPS_DIR)/lightrec/tlsf/tlsf.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't have to compile TLSF since you disabled the code buffer support (ENABLE_CODE_BUFFER=0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENABLE_CODE_BUFFER=1 was set in 3012b97 of this PR, there were many changes squashed together, and it could maybe use even more to make this more clear maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I saw it after my message. I guess this change should be squashed into 3012b97 then.
After testing this with a few games on my Windows 11 system, I have noticed a few Runahead-related issues:
|
This pull request introduces 1 alert when merging 1e71531 into bd6b9ef - view on LGTM.com new alerts:
|
@Ryunam Hi, are your issues addressed now? |
Okay, I have performed a few more tests after the last commit:
|
@Ryunam The SPU Samples option was expected to cause that, I'll add a note in the description about it, it's basically just running the sampling at a lower frequency and then running multiple times to catch up, it's a performance hack, I'm surprised it works as well as it does. Though now that you found a game I can test I might be able to improve it further by doing some run time detection or tweaking the timing code, but that may be a bigger project for the future. |
Sorry @ZachCook, I stand corrected. The crashes appeared once again while I was testing other games, so they seem to be unrelated to the SPU changes. One consistent situation where I can reproduce the crash right now is with the Japanese PS1 port of Street Fighter Zero 2:
The same core as compiled from current master, before this PR, never triggers any crash with these same steps and/or settings. |
Hi there, what is the state of this PR as it stands? Are there any roadblocks? |
I'll update it again to latest lightrec+lightning, and see if I can reproduce the above mentioned crash, or at least narrow down what triggers it, I wouldn't really want to merge this until that is dealt with. |
1e71531
to
c41b8a7
Compare
Updated to recently released Lightning 2.2.0 and Lightrec 0.6 Still working on crashes with runahead and loading, the hack I had there (restart entire dynarec and switch to interpreter for a while) looks awfully suspect and I'm working on a proper fix to at least rule that out as a cause if it doesn't just fix it. |
This pull request introduces 1 alert and fixes 1 when merging c41b8a7 into f8a904e - view on LGTM.com new alerts:
fixed alerts:
Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog. |
@ZachCook Is this ready for merging now? Will this have any known regressions vs. the current state of things? |
@LibretroAdmin It is not ready yet, I am seeing lots of crashing now than can be triggered by any kind of run-ahead or loading a save state. You could apply just 8814bcb for now, it is quite a useful improvement by itself. |
OK, I cherry-picked that commit for now and pushed it to master |
c41b8a7
to
1f36680
Compare
Still have to re-fix the runahead/savestate issue right after bios since I ripped out the previous next_interpreter hack, but otherwise I have tried to update and clean up the code a bit. I think some of the older commits are a bit messy/WIP that are fixed later in the series since there was such a long period of time since I last was working on this, so it might be easier to view the changes as a whole for some parts in cpu/cpu_lightrec. |
Fix bios freeze with lightrec, AssertIRQ must change lightrec's CAUSE too cleanup unused cop0 functions
Codebuffer is much faster due to lightrec's 32-bit LUT optimization Moved lightning.h to lightning-actual.h and made lightning.h include lightning-actual.h and define HAVE_MMAP for lightning, instead of defining in the Makefile which applied it to other parts of beetle, causing issues on Windows in libretro-common/vfs
This allows less code to be emitted by lightrec, but will only be used if root user enables it with sysctl -w vm.mmap_min_addr=0
…htrec api This was only useful for debugging, users don't benefit from it, the config will fallback to using the beetle interpreter if it was selected The lightrec execute_one function this option called was removed, for equivalent debugging pass current timestamp instead of next_event_ts to lightrec_execute Use lightrec cop2_notify for PGXP, update interpreter to new api
subrepo: subdir: "deps/lightning" merged: "edc57df2" upstream: origin: "https://git.savannah.gnu.org/git/lightning.git" branch: "master" commit: "bfd695a9" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886"
subrepo: subdir: "deps/lightrec" merged: "ea20362c" upstream: origin: "https://github.com/pcercuei/lightrec.git" branch: "master" commit: "ea20362c" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886"
tweak lightrec startup and syncing stuff remove next_interpreter hack tweak setoptions, should be safer
Disabled by default for max compatibility Enabling should generate faster code for most normal games that do not have sp and gp registers pointing outside of RAM
This was broken by cpu.cpp and cpu_lightrec.cpp being split apart
Add breakpoint handling to match interpreter Fix setting of options to lightrec
ea881ad
to
c3a4eaa
Compare
Replaces supported_io_bases array with min/inc/max_io_base Makes it easier to avoid ranges of address for different platforms Fix unmap of lightrec codebuffer
cc3e61b
to
a38d0ae
Compare
Split out cpu_lightrec.cpp from cpu.cpp instead of being mashed together.
Added hugepage, codebuffer, mmap at 0x0, and SP GP hit RAM optimizations and fallbacks, see commits for more details.
Use lightrec's GTE registers directly when not using beetle interpreter (while maintaining backwards compatibility with savestates).
Removed the Cycle Timing Check dynarec option.