Skip to content

LTO - #2169

Open
mark9064 wants to merge 1 commit into
InfiniTimeOrg:mainfrom
mark9064:lto
Open

LTO#2169
mark9064 wants to merge 1 commit into
InfiniTimeOrg:mainfrom
mark9064:lto

Conversation

@mark9064

@mark9064 mark9064 commented Nov 23, 2024

Copy link
Copy Markdown
Member

Based off #867, a compiler upgrade isn't needed anymore and I also simplified the changeset to the minimal needed.

I'm testing it locally now and all seems good so far, but I've only been running it for a few hours.

The original in discussion in #867 regarding why the memory usage has changed is still to be answered - I haven't looked into this yet

@github-actions

github-actions Bot commented Nov 23, 2024

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 353632B -26372B
data 912B -24B
bss 22940B 4B

Run in InfiniEmu

@mark9064 mark9064 added the maintenance Background work label Nov 25, 2024
@mark9064
mark9064 marked this pull request as draft January 26, 2025 00:21
@mark9064

mark9064 commented Jan 26, 2025

Copy link
Copy Markdown
Member Author

Since more functions get inlined, the stack has to accommodate more local variables at once. Given the increased stack usage of LTO, I think this is may be not such a good idea, as InfiniTime is very RAM limited - moreso than it is flash limited.

This PR works perfectly fine though, so keeping it around as a draft

Edit: Need to collect some actual numbers for memory usage LTO off/on

@mark9064

Copy link
Copy Markdown
Member Author

With #2331 systemtask stack pressure is reduced now. Still, it needs some extra compared to before. I'm using GCC 14 locally, but I've never seen it go below 48 minimum with 400 size so that should be sufficient

@mark9064
mark9064 marked this pull request as ready for review August 19, 2026 22:06
@mark9064

Copy link
Copy Markdown
Member Author

One thing to do is make the CI build with LTO and without LTO (if it doesn't already), since some compiler errors will only appear with LTO off

@mark9064

Copy link
Copy Markdown
Member Author

I've also been running this for a long time, and I think it's well worth merging. Memory requirements for the SystemTask still do rise a bit, but 26K of flash back is huge and gives us plenty of breathing room for things like #2399

@mark9064 mark9064 added this to the 1.17.0 milestone Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Background work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant