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

PPU LLVM: Memory Consumption Enhancements #16537

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Jan 10, 2025

PPU LLVM's memory manager was not able to handle more than 512MB of data, but at same time instead of reporting an error on outage it reused memory buffers. This resulted in corrupted PPU LLVM cache files for affected titles.

Fixes PES games with their humongous executable file.
Fixes #11469 (you need to remove broken PPU LLVM and SPU LLVM cache)

Additional impovements

  • Reduces RPCS3 RAM memory consumption by 100MB-300MB ingame and more than twice this amount during PPU LLVM compilation. This is because PPU analyzer information is stored much more efficiently, size of data members has been reduced and PPU LLVM compilation no longer makes copies of this memory.

@elad335 elad335 added Bugfix LLVM Related to LLVM instruction decoders labels Jan 10, 2025
@elad335 elad335 force-pushed the func-hash branch 5 times, most recently from f9284bc to 067c5d5 Compare January 10, 2025 19:42
@elad335 elad335 marked this pull request as draft January 10, 2025 19:45
@elad335 elad335 force-pushed the func-hash branch 3 times, most recently from 18d7e3b to 4fe4ce3 Compare January 10, 2025 19:58
@elad335
Copy link
Contributor Author

elad335 commented Jan 10, 2025

Maybe the proper solution would also require splitting huge executable files caches.

@elad335
Copy link
Contributor Author

elad335 commented Jan 10, 2025

I need testers to report the size of their EBOOT.BIN and its PPU LLVM module count for taxing games

@digant73
Copy link
Contributor

digant73 commented Jan 10, 2025

Removed all caches and started Resistance 1. It freezes at the the end of Applying PPU Code with the following error, also reported on the GUI:

F {PPU[0x1000000] main_thread} VM: Access violation writing location 0x28ec8348 (unmapped memory)

RPCS3.log

image

@Satan86
Copy link

Satan86 commented Jan 10, 2025

PES 2017 crashes to desktop after Compiling PPU Modules. It has 347 modules and the EBOOT.BIN is 16.996 KB.
RPCS3.log
The log says this at the end: ·F 0:05:53.309380 {PPU[0x1000000] main_thread} JIT: Out of memory (size=0xd1a78, align=0x10)

@bigol83
Copy link

bigol83 commented Jan 11, 2025

I don't know if this is relevant but FF XIII still crashes when applying PPU modules

The game has 119 modules and the eboot is 8.150 KB

@Darkhost1999
Copy link
Contributor

I don't know if this is relevant but FF XIII still crashes when applying PPU modules

I was thinking about adding a comment #16112
Because this PR didn't introduce the issue.
If this PR did introduce the issue I would've commented here.

FFXIII has gone through ~3 or 4 regressions experiencing close to desktop on a clean cache. If the llvm cache version is bumped again then only older builds will be able to play for now. But it seems we can compile on the older build, update, and play just fine on the current master.

@elad335 elad335 force-pushed the func-hash branch 10 times, most recently from 7918343 to 38d8862 Compare January 14, 2025 15:30
@digant73
Copy link
Contributor

PPU LLVM's memory manager was not able to handle more than 512MB of data, but at same time instead of reporting an error on outage it reused memory buffers. This resulted in corrupted PPU LLVM cache files for affected titles.

is that an issue we could see just at boot? or something that can occur during the game (e.g. access on unmapped memory etc.)?

@elad335 elad335 force-pushed the func-hash branch 2 times, most recently from c6b6b47 to e8c152e Compare January 15, 2025 15:42
@elad335 elad335 force-pushed the func-hash branch 2 times, most recently from cc1064d to 2fe6a56 Compare January 21, 2025 11:39
@Satan86
Copy link

Satan86 commented Jan 21, 2025

PES now works with PPU LLVM, but it took absolutely ages to compile PPU LLVM modules when booting, using 10% of the CPU.
image

@elad335
Copy link
Contributor Author

elad335 commented Jan 22, 2025

@Satan86 Can you upload log? I want to see the compilation stage of it.

@elad335
Copy link
Contributor Author

elad335 commented Jan 22, 2025

Reduced size of module trampolines to 16! This should make PPU relative branches fillers super efficient!
image

@elad335 elad335 force-pushed the func-hash branch 3 times, most recently from 7f23a89 to 8d2cf85 Compare January 22, 2025 13:41
@Darkhost1999
Copy link
Contributor

image
Compiling times are back to normal or faster. Just not 10% observed

@elad335
Copy link
Contributor Author

elad335 commented Jan 22, 2025

I need someone to test the ARM build for 100+ modules games.

@mavethee
Copy link

I need someone to test the ARM build for 100+ modules games.

@elad335 MacOS ARM build is fine?
I assume I have to rebuild cache for test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Enhancement LLVM Related to LLVM instruction decoders Optimization Optimizes existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: PES 2018 doesn't boot with LLVM PPU Decoder (#9059)
8 participants