Skip to content

cmake: Enable LTO for rpcs3_emu target#16692

Merged
elad335 merged 3 commits into
RPCS3:masterfrom
Whatcookie:LTO
Feb 12, 2025
Merged

cmake: Enable LTO for rpcs3_emu target#16692
elad335 merged 3 commits into
RPCS3:masterfrom
Whatcookie:LTO

Conversation

@Whatcookie

@Whatcookie Whatcookie commented Feb 11, 2025

Copy link
Copy Markdown
Member

In the past, enabling LTO across the entire program would cause some crashes. With GCC, LLVM would crash when compiling programs, and with clang, QT would crash. Let's try just enabling LTO for the rpcs3_emu target, instead of all the code of RPCS3.

Provides a small speedup (for linux users in titles not limited by SPU or PPU performance) and saves some space in the binary.

Before:
image

After:
image

Let's leave it as a draft until we can confirm the CI builds run crash free.

- Provides a small speedup and saves some space in the binary.
@Whatcookie
Whatcookie marked this pull request as draft February 11, 2025 05:21
@cipherxof

Copy link
Copy Markdown
Contributor

Clang CI build ran fine for me under linux.

@Megamouse Megamouse added Build and CI Anything related to the build process and continuous integration Optimization Optimizes existing code labels Feb 11, 2025
@Romano44

Copy link
Copy Markdown

From the screenshots difference in that Ninja Gaiden game is about 22fps, which is ~15%! That is certainly more than a humble "small speedup".

@Whatcookie
Whatcookie marked this pull request as ready for review February 11, 2025 17:32
@Whatcookie

Copy link
Copy Markdown
Member Author

Both the GCC and Clang CI builds seem fine, so I unmarked it as draft.

@elad335

elad335 commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Possibly limit it to RSX projects? what is the toll on compilation time?

@Whatcookie

Copy link
Copy Markdown
Member Author

Possibly limit it to RSX projects? what is the toll on compilation time?

It adds less than a minute of time on my local builds. It's hard to tell what the impact is on the CI since the CI seems to have a large run to run variance to begin with.

It'd be nice to have LTO for more than just the RSX files since the PPU/SPU compilation is also noticeably faster.

@Yahfz

Yahfz commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

image
With LTO enabled RSX performance is much better, allowing RDR to reach 90FPS+ for the first time

@elad335
elad335 merged commit a9b0f76 into RPCS3:master Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build and CI Anything related to the build process and continuous integration Optimization Optimizes existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants