-
Notifications
You must be signed in to change notification settings - Fork 48
[Formal][PropertyAnnotation] Annotating IOG-based invariants #855
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
53ca2ff
algorithm for finding IOGs
e56f380
annotating invariant 6: Consecutive tokens within an IOG must have an…
8a4696f
invariant now works for any slot within an operation (rather than jus…
935a000
small cleanup of IOG generation code with better naming
e742725
extraction of IOG finding into separate file
b9f632b
fixed IOG path code to support multiple possible paths
3c64778
handle pipeline slots as well as normal slots in invariant 6
b4e5fd4
added some more explaining comments for the IOG finding algorithm
f52748b
start of IOG-single-token invariant:
5accc26
getAllSlotsOfOperation properly handles load's hidden slot in MC
c05778f
slot of terminating sink is annotatable
82ec8c6
change testbench generator to work with IOG single-token invariant
eb3e39f
Merge branch 'main' into invariant5
dcb74b6
change testbench to:
bb75abf
set default testbench to not use dead buffers
f437c3a
format
bc68eef
change types.mlir unit test
789d98b
attempt fix types.mlir
39adf31
more comments
7418c16
fixed an issue that made smv module arguments mismatch
daa3dc0
Merge branch 'main' into invariant5
df03ade
replace template with ValueRange
e1401b5
Add dead buffer unit to ends of IOGs:
b69f6f6
Merge branch 'main' into invariant5
Basmet0 4dbefde
fixed some bugs due to merge
Basmet0 d0d5f97
fixed test case to without attribute
Basmet0 833fcef
flow expresssions now handle dead buffer op
5ed765b
resolved merge-conflicts
20e867b
Merge branch 'main' into invariant5
c239467
more logical TokenCountNamer which does not need special smv definitions
b227f81
formatting
f33ef2f
Merge branch 'main' into invariant5
4ee3a5d
comments
3fce970
small fixes for clarity
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
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,81 @@ | ||
| #pragma once | ||
|
|
||
| #include "dynamatic/Analysis/NameAnalysis.h" | ||
| #include "dynamatic/Support/LLVM.h" | ||
| #include "mlir/IR/Value.h" | ||
| #include <unordered_set> | ||
|
|
||
| namespace dynamatic { | ||
| struct IOG; | ||
| struct IOGPathSet; | ||
|
|
||
| // An IOG path set is a structure that describes a set of paths between two | ||
| // operations: For any unit `u` within the IOG, it says whether there exists a | ||
| // path going through `u` or not. | ||
| struct IOGPathSet { | ||
|
Jiahui17 marked this conversation as resolved.
|
||
| IOGPathSet(Operation *start, Operation *end) : start(start), end(end) {} | ||
|
|
||
| std::unordered_set<Operation *> units; | ||
| Operation *start; | ||
| Operation *end; | ||
| }; | ||
|
|
||
| // An In-order graph (IOG) of a dataflow circuit is a subgraph of the dataflow | ||
| // circuit. It contains one and only one entry channel (i.e. an argument of a | ||
| // FuncOp) which can reach all other operations using only channels part of the | ||
| // IOG. The IOG does not lose or gain any tokens: For any merge/mux, all the | ||
| // data inputs must be contained in the IOG, and for any fork, only a single | ||
| // output can be part of the IOG. Similarly, all branch outputs are part of the | ||
| // IOG, and for each join-operation, only a single input is part of the IOG. | ||
| // This way, there is a fixed number of tokens within the IOG. | ||
| struct IOG { | ||
|
Jiahui17 marked this conversation as resolved.
|
||
| IOG() = default; | ||
| std::unordered_set<Operation *> units; | ||
| llvm::DenseSet<mlir::Value> channels; | ||
| BlockArgument entry; | ||
|
|
||
| IOGPathSet findAllPaths(Operation *startOp, Operation *endOp) const; | ||
|
|
||
| inline bool contains(Operation *op) const { | ||
| auto iter = units.find(op); | ||
| return iter != units.end(); | ||
| } | ||
|
|
||
| inline bool contains(mlir::Value channel) const { | ||
| auto iter = channels.find(channel); | ||
| return iter != channels.end(); | ||
| } | ||
|
|
||
| void debug() const { | ||
| std::vector<mlir::Value> stack; | ||
| llvm::DenseSet<mlir::Value> visited; | ||
| stack.push_back(entry); | ||
| visited.insert(entry); | ||
| while (!stack.empty()) { | ||
| mlir::Value channel = stack.back(); | ||
| stack.pop_back(); | ||
| Operation *prev = channel.getDefiningOp(); | ||
| if (prev == nullptr) { | ||
| llvm::errs() << "entry"; | ||
| } else { | ||
| llvm::errs() << getUniqueName(prev); | ||
| } | ||
| Operation *next = channel.getUses().begin()->getOwner(); | ||
| assert(next); | ||
| assert(contains(next)); | ||
| llvm::errs() << " -> " << getUniqueName(next) << "\n"; | ||
| for (mlir::Value out : next->getResults()) { | ||
| if (auto iter = visited.find(out); iter != visited.end()) | ||
| continue; | ||
| if (contains(out)) { | ||
| visited.insert(out); | ||
| stack.push_back(out); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| std::vector<IOG> findAllIOGs(ModuleOp modOp); | ||
|
|
||
| } // namespace dynamatic | ||
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.