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
Rewrite waitable atomics #9117
Rewrite waitable atomics #9117
Conversation
0b3f604
to
9cd2d50
Compare
I was reached out to by friends on Discord, that you wanted this PR tested in relation to #8363. I tested the latest PR build against the latest master build, and the issue persists: On the left half of the frametime graph the game window was focused, on the right half the game window was unfocused. This is the same as on master. Please mention the issue through Github next time instead, if you want it tested by those affected. |
Ahh that's unfortunate, but thank you for testing. I have other ideas in mind. |
ab22024
to
265f12c
Compare
Added new Win8+ API path which may dramatically change performance for everyone. |
5fcf90f
to
c389fed
Compare
Checked with the latest commit, the game (Demon's Souls) hangs on loading now. I also didn't notice an improvement sadly, but I couldn't check properly due to said hang. Gonna go sleep now. Edit: uploaded a new log, cause I originally had logging off. |
Last version seems working! |
Use individual semaphore for each thread. Unfortunately, limit max thread waiting for single address (60). If limit is reached, use busy waiting.
Try non-blocking wake up function first.
Using raw_notify() everywhere was overkill.
Some of them are available only since Windows 8.
5f6329d
to
8db8125
Compare
Color me impressed, the latest commit resolves most of #8363! Demon's Souls is now working better than ever on my system. A curious case to look at would be F1 Race Stars though. The game suffers massively from scheduling issues, it used to be that it'd run seamlessly unfocused, and lag then hang catastrophically when focused. That situation has improved with this, but I noticed that it's also having issues unfocused now. Whether this is due to the PR's changes, or the past months' master changes, I'm yet to test. Gonna go do that now. Update: Seems like it's the latter, so this PR is a net improvement. 🎉 I can open a separate ticket for F1 Race Stars if preferred, since that's definitely an odd one out game. Update 2: Tested another game called Dead Nation. There still seems to be a discrepancy between focused and unfocused unfortunately, but it's a lot milder now. I also asked for a retest in the original issue ticket, and a user already reported that they're still having issues; therefore, I'll keep the ticket open. Thanks for the fixes though, this is already a major step forward. |
Win7 will remain using old API (keyed events).
This broke SW Force Unleashed 2: |
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag)
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag) * Added some thread_ctrl::wait_on to fix emulation stopping.
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag) * Added some thread_ctrl::wait_on to fix emulation stopping.
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by RPCS3#9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0") * Remove cpu_flag::dbg_global_stop, use cpu_flag::exit instead. (essentially a duplicated flag) * Added some thread_ctrl::wait_on to fix emulation stopping.
* Use atomic waitables instead instead of global thread wait as often as possible. * Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions) * Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by #9117) * Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0")
Relatively big change to waitable atomics.