-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
SPU: Implement "double" SNR storage #12258
Conversation
68909dc to
cd822a7
Compare
rpcs3/Emu/Cell/SPUThread.h
Outdated
| const u64 old = data.fetch_op([&](u64& data) | ||
| { | ||
| if (pushed_to_jostling) | ||
| { |
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.
It looks like setting data to 0 may be abandoned here.
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, the cmpxchg in that situation is allowed to fail in case other thread pushed another value and set a count of 1 and a value. In both cases the wait bit is cleared so what needs to be done is done.
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.
Still looks like a reckless "optimization". It should be assumed that the fail can be sponatneous.
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.
Fixed.
What Sonic The Hedgehog does is to send a pair of succeeding values to the SPU SNR. If the SPU does not wait on SNR reading, the first value should be overwritten by the second and this is what RPCS3 does.
On real hw however concluded by reversing this game, If the SPU currently reads from the empty SNR channel, the insertion of the first value keeps the channel empty and the SPU quits reading SNR, the SNR is available the obtain the second value freely.
This implements this mechanism and allows Sonic The Hedgehog to display some images and fixes the random crashes with its loading, but it is still not the same as the hacked build of mine which also waits for SNR to empty before each write and thus ensuring values are not overwritten. Because on real hw the SPU finished its execution path faster than PPU and is already executing SPU SNR read instruction when the PPU writes the pair of values allowing it to work on real hw.