-
Notifications
You must be signed in to change notification settings - Fork 50
[eagerly-elastic] Rewrites A and D with FTD #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emorbach
wants to merge
25
commits into
main
Choose a base branch
from
emorbach/eagerly-elastic-AD
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f272091
print suppressor branches
emorbach 624cf7e
fixes
emorbach 2045aca
convert single branch into two supps
emorbach 0ccdce2
first version of rewrite A
emorbach b18d75b
add kernel and get branches correctly
emorbach d7e2cc1
rewrite a fixed
emorbach 640f8ae
rewrite D
emorbach a9079be
make rewrite D cleaner
emorbach 0fc417e
make rewrite D conditional
emorbach 1c268fa
print suppressor branches
emorbach e1a5a90
fix rewrite D
emorbach a79600d
fixes and more tests
emorbach 34458a7
fixes and cleanup
emorbach 85f17c1
add docs and make n
emorbach 10c5318
use repeatinginit
emorbach 4189991
fix errors
emorbach b1b1583
fix buffering and rewrite D
emorbach 3d8ea2a
more fixes
emorbach a4dd387
improve comments and docs
emorbach 66f20b5
revert unnecessary changes
emorbach 4561f17
fixes for the PR
0c88328
rename functions
emorbach adbb33b
Merge branch 'main' into emorbach/eagerly-elastic-AD
emorbach dd11023
implement stuff from comments
48192b8
renaming
emorbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/EagerlyElastic.md
|
emorbach marked this conversation as resolved.
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Eagerly Elastic | ||
|
|
||
| The eagerly elastic pass implements eager execution through two main Rewrites, specifically Rewrite A and Rewrite D from the [EagerlyElastic Paper](https://dl.acm.org/doi/pdf/10.1145/3748173.3779196). To execute this pass during compilation, it must be paired with fast token delivery by specifying both the `--fast-token-delivery` and `--eagerlyelastic` flags. | ||
|
|
||
| When no buffer algorithm is specified, no speedup can be achieved. However, with the buffer algorithm `fpga20` the necessary buffers are placed and the desired speedup can be achieved. | ||
|
|
||
| ## Code Structure | ||
|
|
||
| The pass begins by converting all conditional branches into suppressors. This means each branch discards tokens on its true path by routing them to a sink, while allowing tokens on the false path to proceed normally through the circuit. If a branch does not initially have a sink, it is split into two separate branches where one uses an inverted condition. Next, the pass enters its main phase by executing Rewrite A as many times as possible and then enters a loop driven by the user-defined `numRewriteD` parameter. This loop alternates between applying Rewrite D once and then running Rewrite A as often as possible to move all suppressors as far down the circuit as possible. The execution sequence follows the pattern: A, (D, A)^n. | ||
|
|
||
| ### Rewrite A | ||
| Rewrite A pushes suppressors past eligible downstream operations. An operation is eligible if it is pure and matched, such as arithmetic operations or a fork, and all of its other inputs either match the suppressor's condition or originate from a constant source. If an eligible operation has multiple independent consumers, the pass inserts a fork to make it possible for a suppressor to only move past some of the consumers. The functions that implement this are `advanceSuppressorMotion`, `isEligibleForSuppressorMotion`, and `performSuppressorMotion`. | ||
|
|
||
|  | ||
|
|
||
| ### Rewrite D | ||
| Rewrite D identifies loop multiplexers and moves the suppressor past them. When a suppressor is connected to the true data path of the multiplexer, this rewrite builds an additional control structure. This structure is simplified in the code into a `RepeatingInitOp`, which implements the pink circuit seen in the picture below. This allows the suppressor to safely move past the mux. Rewrite D is implemented with the functions `checkForLoopMuxSuppressorMotion` and `applyLoopMuxSuppressorMotion`. After Rewrite D, Rewrite A is applied to move this suppressor further down the loop. | ||
|
|
||
|  |
Binary file added
BIN
+22.7 KB
...operGuide/DynamaticFeaturesAndOptimizations/Figures/EagerlyElastic/RewriteA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.1 KB
...operGuide/DynamaticFeaturesAndOptimizations/Figures/EagerlyElastic/RewriteD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| add_dynamatic_library(DynamaticEagerlyElastic | ||
| EagerlyElasticAD.cpp | ||
|
|
||
| DEPENDS | ||
| DynamaticTransformsPassIncGen | ||
|
|
||
| LINK_LIBS PUBLIC | ||
| MLIRIR | ||
| MLIRMemRefDialect | ||
| MLIRFuncDialect | ||
| MLIRSupport | ||
| MLIRTransformUtils | ||
| DynamaticHandshake | ||
| DynamaticSupport | ||
| DynamaticExperimentalSupport | ||
| DynamaticBufferPlacement | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.