forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize
moveOp[Up,Down]InBlock
functions in `SimplifyGlobalAccesse…
…s`. (iree-org#15245) Following discussion in [this Discord thread](https://discord.com/channels/689900678990135345/1163611525009920082). Profiling revealed that cleanup patterns in the Stream dialect can be particularly slow for large programs (1000s of ops in a function, with 100s of global constants): ![image](https://github.com/openxla/iree/assets/4010439/4f3f2211-f159-4635-b175-6915e0246c8e) Of particular note, the `moveOpUpInBlock` and `moveOpDownInBlock` functions in `SimplifyGlobalAccesses` were shown to be inefficient (loop around "can move down -> move down"). This optimizes those functions by caching the set of ops in each block that block motion and deferring op movement until the final movement location is determined. Results are: * Stream compilation phase from ~17s to ~15s on llama2_7b_int4_stripped.mlir on my machine * `SimplifyGlobalAccesses` mean time from 10.66ms to 1.45ms (no 1s+ outliers) * `SimplifyGlobalAccesses` median time from 113us to 151us (more overhead for very small blocks) Yellow ("this trace") is baseline, Red ("external trace") is with this PR: ![image](https://github.com/openxla/iree/assets/4010439/8291f319-8e8f-4932-b33a-fb5146bf8698) Structural changes like reordering passes or splitting up blocks/functions could yield larger improvements.
- Loading branch information
Showing
2 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters