Skip to content
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

[Testers Needed][Optimization] SPU/PPU: Qualify PUTLLC updates with no data changes #12030

Closed
wants to merge 3 commits into from

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented May 18, 2022

Please test if there are regressions albeit there should be none. This affects TSX and non-TSX as one.

@elad335
Copy link
Contributor Author

elad335 commented May 18, 2022

Added another optimization mainly affecting TSX.

@@ -2624,6 +2624,21 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args)
const auto& to_write = _ref<spu_rdata_t>(args.lsa & 0x3ff80);
auto& res = vm::reservation_acquire(addr);

if (cmp_rdata(to_write, rdata))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be under the rsx lock below. Some games are not properly synchronized, which is why I have the "limit scope" warning below. I could not use a smaller scope without side effects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we can ask users to verify, the code has changed too much since it was originally written, no idea if its still an issue. Needs a fairly slow CPU with no TSX though.

@Xcedf
Copy link

Xcedf commented May 18, 2022

Before:
PUTLLC Perf completed in 1797 ms (PS3: 3364 ms)
After:
PUTLLC Perf completed in 749 ms (PS3: 3364 ms)

@cipherxof
Copy link
Contributor

cipherxof commented May 18, 2022

I'm noticing a significant fps decrease in Metal Gear Online (over 100%).

Before:

RPCS3-Before.log.gz

before

PR:

RPCS3-PR.log.gz

after

This is a really unusual case that has been bothering me for a bit. In both cases (Before & PR), setting Accurate PPU Reservations to Always Enabled and enabling Accurate RSX Reservations restores FPS to normal, however it introduces significant FPS drops when players begin shooting. It's odd because Accurate PPU Reservations isn't needed in MGS4, and there is no FPS penalty when shooting in that game.

Accurate PPU/RSX Reservations:

RPCS3-ppures.log.gz

ppures

As I was writing this, you pushed another commit 16f3da1 and that seems to have improved FPS a bit but it still doesn't match what it was before.

Latest Commit From this PR:

newpr

Also, please note that we use a custom launcher (NPMG00010) and build for Metal Gear Online. I am positive neither of these are affecting the results. If it's absolutely required, I can show the results on an unmodified build and game but it requires a lot more effort on my end.

@Xcedf
Copy link

Xcedf commented May 18, 2022

Perhaps MGO has smth speciffic, but have no fps difference in MGS4

@cipherxof
Copy link
Contributor

cipherxof commented May 18, 2022

Perhaps MGO has smth speciffic, but have no fps difference in MGS4

That's definitely the case, but I'm not sure what. It's quite frustrating because we would like to move on from 0.0.8 to a more recent build. I know both engines are very similar. MGO is based on the MGS4 engine and they share much of the same code. I tried disabling all HLE network related functions but it had no effect on performance.

I figure since this PR directly affects MGO it may lead to someone realizing what the bottleneck could be.

@elad335
Copy link
Contributor Author

elad335 commented May 18, 2022

Retest.

@elad335 elad335 force-pushed the spu-mb branch 2 times, most recently from dfc9815 to 879d425 Compare May 18, 2022 19:30
@cipherxof
Copy link
Contributor

cipherxof commented May 18, 2022

Retest.

Performance is worse after dfc9815 (69fps before, 60fps now)

Latest Commit From this PR:

Untitled

Once again, performance is significantly better / back to normal with Accurate RSX/PPU Reservations enabled (maybe slightly worse than it was before).

I did notice the FPS in the game menus seems to be faster than before with this PR. I am reaching ~430fps in the menus whereas before it would always stay below 400.

@elad335
Copy link
Contributor Author

elad335 commented May 18, 2022

Log?

@elad335 elad335 marked this pull request as draft May 18, 2022 19:52
@cipherxof
Copy link
Contributor

Upon re-testing performance seems a lot closer. Maybe some variance due to exact camera location and the training dummies moving in the background.

Re-test (with log)

RPCS3.log.gz

Untitled

@AniLeo
Copy link
Member

AniLeo commented May 19, 2022

Steam Deck - PUTLLC

Before: 2408 ms
After: 545 ms

@elad335
Copy link
Contributor Author

elad335 commented May 19, 2022

Added an ultra hack for non TSX, please test if improves or regresses performance in games.

@Xcedf
Copy link

Xcedf commented May 19, 2022

Last commit worse in the test
Before:
SPU MFC 64 Bits War completed in 4535 ms (PS3: 3370 ms)
PPU/SPU MFC 64 Bits War completed in 7171 ms (PS3: 4443 ms)
After:
SPU MFC 64 Bits War completed in 5623 ms (PS3: 3370 ms)
PPU/SPU MFC 64 Bits War completed in 8081 ms (PS3: 4443 ms)

@cipherxof
Copy link
Contributor

Added an ultra hack for non TSX, please test if improves or regresses performance in games.

Performance is significantly better now in MGO. With Accurate PPU Reservations disabled, performance actually exceeds what it did before.

image

@elad335
Copy link
Contributor Author

elad335 commented May 19, 2022

Updated the hack to be near purely performance advantageous.

@cipherxof
Copy link
Contributor

Updated the hack to be near purely performance advantageous.

I'm seeing a few percent increase in fps in some areas. In other areas it's about the same. In any case, this hack is a massive improvement for MGO. I also tested MGS4 briefly, and I can't say I noticed any difference on my machine. I suspect it may improve performance on machines that are SPU bottlenecked though.

@Xcedf
Copy link

Xcedf commented May 19, 2022

Last update - tests back to normal, MGS still fine

@raveskirza
Copy link

raveskirza commented May 19, 2022

In "Beyond: Two souls" the performance in the Intro screen has reduced

Master : 8-10 FPS
image
RPCS3_Master.log.gz

PR: 5-9 FPS
image
RPCS3_PR.log.gz

Note: This is on a quad Core CPU(i5-7300HQ). The game uses SPU heavily & gets bottlenecked due to the low CPU core count.

EDIT: Looks like when the window is unfocused(e.g. keep snipping tool in the front and GLFrame window behind it), there is a FPS increase with this PR.
PR (Unfocused): 9-11 FPS
image
RPCS3unfocused.log.gz

With master there is no considerable FPS difference between Keeping the GLFrame focused and unfocused

@00ChuChu00
Copy link

Tested 2 games on a i5 11400
Sonic Unleashed: no difference?
Master
Master1
PR
PR 1

Resident Evil Operation Raccoon City: Slight increase
Master
Master
PR
PR

@cipherxof
Copy link
Contributor

cipherxof commented May 19, 2022

I'm reporting back after some more testing with Metal Gear Online. I was curious how it would run for lower end hardware, and for people that would struggle to maintain 30fps previously. I also tested on my machine under Linux, and performance even better there.

Linux 12700k (+20fps)

On Windows this same spot is 118fps. Without this PR (on Windows) it's 108fps.

unknown

The following were taken on a i7 10700, but with a severely gimped off-brand motherboard and power supply. This user in particular struggled to get decent fps. Even my old r5 3600 was performing much better than his CPU. It's hard to capture direct comparisons in a multiplayer match, so I also included the gameplay streams.

Before this PR (10700):

Full video: https://youtu.be/GcKcCkcuvhg?t=7491
Screenshot from 2022-05-19 12-17-06

20220517_163954

PR (10700):

Full video: https://youtu.be/r31w0TJzqNg

Screenshot from 2022-05-19 12-24-38

20220519_153106

The biggest difference is in the lows. I'm guessing this is mainly due to not need Accurate PPU Reservations anymore. We essentially saw improvements across the board. We tested with a 3600, 3700x, 5950x, 9700k, 10700, and a 12700k.

@elad335
Copy link
Contributor Author

elad335 commented May 20, 2022

What do you mean not needing Accurate PPU Reservations? this pr is not meant to fix that.

@cipherxof
Copy link
Contributor

cipherxof commented May 20, 2022

What do you mean not needing Accurate PPU Reservations? this pr is not meant to fix that.

I mean that's probably the main reason FPS is so much better in MGO, whereas other titles that didn't require the setting are only seeing marginal improvements.

Whether or not it's not meant to fix it, it does 😄

@Megamouse Megamouse added the Optimization Optimizes existing code label May 20, 2022
@Nerboruto
Copy link

is it possible to retest this with the latest optimizations introduced?
or is it obsolete?

@elad335
Copy link
Contributor Author

elad335 commented Sep 12, 2022

See #12628

@elad335 elad335 closed this Sep 12, 2022
@elad335 elad335 deleted the spu-mb branch September 19, 2022 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Optimization Optimizes existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants