Skip to content

Improving global folding and IPO for immutable globals. - #18066

Merged
benvanik merged 1 commit into
mainfrom
users/benvanik/immutable-globals
Jul 31, 2024
Merged

benvanik merged 1 commit into
mainfrom
users/benvanik/immutable-globals

Conversation

@benvanik

Copy link
Copy Markdown
Collaborator

Parameters and constants end up as globals that previously were not getting marked as immutable unless the globals were default initialized. Now the GlobalTable tracks whether a global is exclusively stored within initializers (or functions only called from initializers) in order to mark them as immutable. IPO was updated to support propagating uniform immutable global loads across call edges as if they were constants (as they effectively are just constants stored on the global scope).

Required for #17875 (to avoid treating constants/parameters as dynamic binding table values).

@benvanik benvanik added the compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) label Jul 31, 2024
@benvanik
benvanik requested a review from ScottTodd July 31, 2024 18:25
@benvanik
benvanik marked this pull request as draft July 31, 2024 21:50
@ScottTodd

Copy link
Copy Markdown
Member

Oh, test failures :P well, code LGTM

@benvanik
benvanik force-pushed the users/benvanik/immutable-globals branch from f7eb973 to c3847e5 Compare July 31, 2024 22:23
Parameters and constants end up as globals that previously were not
getting marked as immutable unless the globals were default initialized.
Now the GlobalTable tracks whether a global is exclusively stored within
initializers (or functions only called from initializers) in order to
mark them as immutable. IPO was updated to support propagating uniform
immutable global loads across call edges as if they were constants (as
they effectively are just constants stored on the global scope).
@benvanik
benvanik force-pushed the users/benvanik/immutable-globals branch from c3847e5 to a2db7d0 Compare July 31, 2024 22:41
@benvanik
benvanik marked this pull request as ready for review July 31, 2024 22:53
@benvanik
benvanik requested review from ScottTodd and removed request for IanWood1, MaheshRavishankar and hanhanW July 31, 2024 22:54
@benvanik

Copy link
Copy Markdown
Collaborator Author

(fixed tests/lint, PTAL)

@benvanik
benvanik enabled auto-merge (squash) July 31, 2024 22:59
@benvanik
benvanik merged commit e792c32 into main Jul 31, 2024
@benvanik
benvanik deleted the users/benvanik/immutable-globals branch July 31, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants