Repository navigation
Replacing hal.ex.submit_and_wait with queued operations and fences. - #9754
Merged
Merged
Conversation
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
3 times, most recently
from
July 11, 2022 19:00
0a75695 to
d6a8151
Compare
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
3 times, most recently
from
July 20, 2022 22:12
6547ac4 to
2bd3437
Compare
hal.ex.submit_and_wait with proper queued operations and fences.hal.ex.submit_and_wait with queued operations and fences.
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
from
July 21, 2022 01:42
2bd3437 to
aa7c0de
Compare
benvanik
marked this pull request as ready for review
July 21, 2022 02:15
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
from
July 25, 2022 17:12
aa7c0de to
cde102e
Compare
ScottTodd
approved these changes
Jul 27, 2022
This makes it possible to print information about Values consistently.
This will be used during stream->hal lowering as a placeholder for where a program timeline is advanced. It's currently a placeholder for what it'll need to be with multiple devices but fine for now.
Today with our single device and single queue usage there's only ever one global timeline. In the future we can have independent timelines based on device queues managed by stream partitioning.
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
from
August 2, 2022 17:52
cde102e to
4e6397a
Compare
Collaborator
Author
|
I reworked the elide timepoints pass in Adding --iree-stream-elide-timepoints pass. to be simpler/support more cases (and have tests) - no major changes anywhere else and it's just simpler now (replaced nasty flaky fixed-point iteration algo with a single loop). |
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
from
August 2, 2022 18:03
4e6397a to
fb67161
Compare
This runs as part of a fixed-point iteration alongside IPO and canonicalization to allow us to fully propagate timepoint dependencies across the program.
This is not going to work with the incomplete CUDA/ROCM backends :(
We want to support SCF here but it needs some reworking.
Pass needs to be rewritten to use data flow analysis.
This will allow the new async behavior to be selectively enabled for targets that are known to support it. Remove the stone of submit_and_wait... attach the stone of wait and execute and wait.
It's possible for null fences to come in from external sources or conditional globals.
benvanik
force-pushed
the
benvanik-timepoint-to-hal
branch
from
August 2, 2022 18:43
fb67161 to
b1688f4
Compare
Contributor
Abbreviated Benchmark Summary@ commit b1688f4991a9e22ac024902ac35ea737efeb03d3 (vs. base 29c6ab50d4565928fca557e2731dc1004bb90b36) Improved Latencies 🎉
[Top 3 out of 5 results showed] No improved or regressed compilation metrics 🏖️ For more information: |
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.
Adding compiler/runtime support for lowering the asynchronous stream dialect ops into HAL ops, materializing a timeline (today just one but multiple in the future), and passing through to the runtime HAL module. This allowed for the removal of the existing placeholder submit_and_wait op and enables queue-ordered allocations to be implemented in the HAL.
This is likely not the final design but unblocks work on coroutines, queue-ordered allocations, webgpu, and plumbing fences through the user-facing API/native ABI. Future refinements may create overrides that use semaphores instead of fences to avoid fence heap allocations when not required, but for most single-function classic ML models once we plumb fences through the ABI no internal fences are required. The current timeline materialization also strictly orders all invocations where instead we should be able to elide those when there's no internal program state to protect.
Because the various HAL backends all need work (CUDA/ROCM in particular need massive work) nearly everything is synchronized exactly as it was before but now that synchronization happens in the IR we emit and we can selectively start supporting async per target.
Progress on #1285 (just need to put fences on the ABI!).
Progress on #8093 (added yieldable fence waits).
Progress on #9572 (added compiler/runtime glue for queue-ordered allocs).