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

CELL: Postponed address notifications #14491

Merged
merged 2 commits into from Aug 17, 2023
Merged

CELL: Postponed address notifications #14491

merged 2 commits into from Aug 17, 2023

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Aug 16, 2023

  • Try to postpone address notification to when PPU is asleep or join notifications on the same address. This also optimizes a mutex - won't notify after lock is aqcuired (prolonging the critical section duration), only notifies on unlock
  • Use usermode waiting for supported CPUs on detection GETLLAR busy-waiting loop in order to reduce power consumtion and improve performance.

Please compare:

  1. Framerate.
  2. SPU usage.
  3. PPU usage.

Note: Make sure that you are using the default setting for "Maximum Number Of SPURS Threads" and "Preferred SPU Threads" when testing.

@elad335 elad335 added CPU Optimization Optimizes existing code labels Aug 16, 2023
@cipherxof
Copy link
Contributor

CPU: 12700KF /w AVX-512 (stock clocks)

MGS4 seems to be performing worse.

RPCS3-master.log.gz
RPCS3-pr.log.gz

image

Same with MGO2.

image

@00ChuChu00
Copy link

I5-11400

Resident Evil ORC also performs a bit worse

Master
RE ORC MASTER

PR
RE ORC PR

@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

Changed the code a bit.

@elad335 elad335 force-pushed the cell branch 3 times, most recently from 56028bb to 23e87a4 Compare August 16, 2023 11:25
@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

Also test Persona 5 maybe.

@Ordinary205
Copy link
Contributor

CPU: Ryzen 5900x

Both of these games seems to perform slightly better.

RDR:
RDR

DS1:
Dark Souls FPS

@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

I added something that may improve performance and reduce power consumption in Demon's Souls.

@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

The last commit may behave differently between Intel and AMD cpus and only affects 12+ thread CPUs.

@elad335 elad335 force-pushed the cell branch 4 times, most recently from fc42039 to d8fc7b4 Compare August 16, 2023 14:13
@Ordinary205
Copy link
Contributor

Ordinary205 commented Aug 16, 2023

Demon's Souls seems to perform slightly better!
Nice power consumption tho.

Master:
Demon's Souls FPS Test 1

PR:
Demon's Souls FPS Test 2

@elad335 elad335 changed the title [Eexperimental/TESTERS NEEDED] CELL: Selective and postponed address notifications [TESTERS NEEDED] CELL: Selective and postponed address notifications Aug 16, 2023
@elad335 elad335 force-pushed the cell branch 4 times, most recently from 9031e46 to 8096da2 Compare August 16, 2023 16:31
@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

Removed 12+ threads requirement from the last optimization.

@elad335
Copy link
Contributor Author

elad335 commented Aug 16, 2023

Fixed a performance bug, this seems mostly affecting lower-count CPUs but may affect others.

@Gael2433
Copy link

Unsurprisingly not much difference in Sonic Unleashed on my potato.
Master:
BLES00425_master

PR:
BLES00425_CELL

@cipherxof
Copy link
Contributor

cipherxof commented Aug 16, 2023

Performance between master and this PR in MGS4 seem to be about the same now.

Lost ~2fps on average with Metal Gear Online.

image

image

@@ -4150,7 +4156,7 @@ bool spu_thread::process_mfc_cmd()

if (getllar_busy_waiting_switch == 1)
{
if (utils::has_appropriate_um_wait())
if (utils::has_um_wait())
Copy link
Member

Choose a reason for hiding this comment

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

nice

@solarmystic
Copy link

solarmystic commented Aug 17, 2023

Also test Persona 5 maybe.

With the latest test PR commit and using the usual school hallway scene, P5 shows a minor improvement using default SPU (Auto) and SPURS (Unlimited) settings.

Test PR - 106.2 FPS average/98.9 1% FPS

Screenshot

image

Master (15487) - 103.6 FPS average/98.0 1% FPS

Screenshot

image

The fastest result for that scene however, is achieved with the latest master with SPU Auto and SPURS set to 5.

Master with SPU Auto/SPURS set to 5 - 112 FPS average/109.6 1% FPS.

Screenshot

image

Tested on a 12700KF/2080TI machine at stock.

}
}
#endif
else
Copy link
Contributor

Choose a reason for hiding this comment

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

Else should be before end of if I'm not mistaken

#define waitpkg_func __attribute__((__target__("waitpkg")))
#endif

#if defined(ARCH_X64)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be moved above the upper function definitions?

@@ -465,7 +465,7 @@ struct lv2_obj

// While IDM mutex is still locked (this function assumes so) check if the notification is still needed
// Pending flag is meant for forced notification (if the CPU really has pending work it can restore the flag in theory)
if (cpu != &g_to_notify && static_cast<const decltype(cpu_thread::state)*>(cpu)->none_of(cpu_flag::signal + cpu_flag::pending))
if (0) if (cpu != &g_to_notify && static_cast<const decltype(cpu_thread::state)*>(cpu)->none_of(cpu_flag::signal + cpu_flag::pending))
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing explanation.
Also, would probably look and read better if you simply wrote if (false &&

@elad335 elad335 changed the title [TESTERS NEEDED] CELL: Selective and postponed address notifications CELL: Selective and postponed address notifications Aug 17, 2023
@elad335 elad335 merged commit 6adc7f9 into RPCS3:master Aug 17, 2023
5 checks passed
@elad335 elad335 changed the title CELL: Selective and postponed address notifications CELL: Postponed address notifications Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CPU Optimization Optimizes existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants