Repository navigation
Reworking stream.async.dispatch to allow for in-place allocation/concurrency scheduling. - #11173
Merged
Merged
Conversation
benvanik
force-pushed
the
benvanik-emplace-allocations
branch
5 times, most recently
from
November 16, 2022 06:10
0ac0328 to
fd7e3ac
Compare
benvanik
force-pushed
the
benvanik-emplace-allocations
branch
from
November 16, 2022 20:17
fd7e3ac to
90dc549
Compare
Contributor
Collaborator
Author
|
Need to write some tests for the emplace path but otherwise this should be ready for review! |
benvanik
marked this pull request as ready for review
November 16, 2022 21:56
ScottTodd
approved these changes
Nov 16, 2022
This simplifies the scheduling code as it can assume that all ops that exist should be executed and their IR locations are consistent.
benvanik
force-pushed
the
benvanik-emplace-allocations
branch
from
November 17, 2022 04:17
90dc549 to
ae6b570
Compare
benvanik
force-pushed
the
benvanik-emplace-allocations
branch
from
November 17, 2022 18:46
ae6b570 to
5703ac8
Compare
Member
|
Yay, thanks Ben! Great to see the ~10% latency drop for mobilebert! :D https://perf.iree.dev/serie?IREE?MobileBertSquad%20%5Bfp32%5D%20(TFLite)%20full-inference%2Cdefault-flags%20with%20IREE-Vulkan%20%40%20Pixel-6-Pro%20(GPU-Mali-G78) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds subranges to
stream.async.dispatchso that we can express the active regions of accesses without needing separate ops likestream.async.sliceandstream.async.update. Though not currently done this will let us perform much more aggressive folding of ranges and not need to worry about breaking scheduling by hiding the ranges inside of dispatch regions. For now there's a simpleiree-stream-emplace-allocationspass that runs after copy-on-write materialization to fold just update ranges in. Concurrency scheduling has been updated to use an extremely simple hazard analysis that is aware of the subrange accesses - future changes can extend that to support more involved non-local analysis.I'm not happy with the asm syntax but given that it's an internal layer and does not proliferate outside of the stream dialect lit tests I'm ok with this state.
On models with concats from the frontend peak memory consumption will drop by the sum of the concatenated values; for example mobilebertsquad drops 12386304B (~12.4MB) -> 9437184B (~9.4MB). More importantly we'll now avoid the serialized copies that originated from the subrange updates and drop the total number of commands issued at runtime by O(concated values) - for example 197 in mobilebertsquad. This removes the pipeline bubbles when measuring end-to-end latency - relatively small bits but it all adds up: mobilebertsquad on my nvidia GPU goes from 32ms -> 28ms, with nearly all time now in dispatches. MobileSSD transient usage doesn't change size because the peak usage is dominated by padding fills/copies, but it does lose 15 serialized copies.
Example bubbles before change with serialized copies:



After change with no copies, no bubble (just normal dispatch overhead):
Corresponding IR:
Progress on #6972 (now have the ranges tracked per op but nothing eliding updates yet).
Fixes #7729.