Skip to content

[prediction] pipeline duplication#956

Open
emorbach wants to merge 86 commits into
mainfrom
emorbach/valueprediction
Open

[prediction] pipeline duplication#956
emorbach wants to merge 86 commits into
mainfrom
emorbach/valueprediction

Conversation

@emorbach

@emorbach emorbach commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

The Pipeline Duplication Pass duplicates specific program paths with hardcoded constants. By using pragmas, you can specify a variable that frequently holds a specific value. The pass then generates an additional parallel path in the pipeline where that variable is treated as a constant.

@murphe67 murphe67 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Elena!

Thanks for the really nice work on this PR, it is in super great shape 😁

I wrote a lot of comments, but they are kind of all in the same vein of:

I think you know what this does, and I think it works the way you think it works, but I think you could spend more time reading and writing it so that the file exists as an "act of communication"- the code is not only about doing what it is supposed to do, but also about taking a reader on a journey of what decisions you made and why.

Secondly, I think this PR currently assumes no branches in the duplicated region? and I think it would be nice to support that before merging 😁 Also duplicated regions which have additional input beyond the one we will eventually do data prediction on, so theyre not replaced with constants, just branched to their consumers in the different bbs based on which bb executes from the comparisons?

Let me know about any questions or concerns you have, I will maybe write more later but I think this is plently for you to get started with in terms of building a narrative in the code files 😁

Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated

@murphe67 murphe67 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Elena!

Thanks for the really nice work on this PR, it is in super great shape 😁

I wrote a lot of comments, but they are kind of all in the same vein of:

I think you know what this does, and I think it works the way you think it works, but I think you could spend more time reading and writing it so that the file exists as an "act of communication"- the code is not only about doing what it is supposed to do, but also about taking a reader on a journey of what decisions you made and why.

Secondly, I think this PR currently assumes no branches in the duplicated region? and I think it would be nice to support that before merging 😁 Also duplicated regions which have additional input beyond the one we will eventually do data prediction on, so theyre not replaced with constants, just branched to their consumers in the different bbs based on which bb executes from the comparisons?

Let me know about any questions or concerns you have, I will maybe write more later but I think this is plently for you to get started with in terms of building a narrative in the code files 😁

@murphe67 murphe67 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the integration tests and documentation file are very nice now 😁 We discussed in the meeting but for the general thread to follow is this idea of "will my provided evidence convince someone skeptical I have thought about this thoroughly and that my decisions make sense" 😁

Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated
Comment thread docs/DeveloperGuide/DynamaticFeaturesAndOptimizations/PipelineDuplication.md Outdated

### Helper Functions

`readPredictMarker`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this bit needed with the func signature below it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you remove it completely or just remove the function signature?

Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp
Comment thread experimental/lib/Transforms/Duplication/PipelineDuplication.cpp Outdated
Comment thread tools/dynamatic/scripts/compile.sh Outdated
Comment thread tools/dynamatic/scripts/visualize.sh Outdated
: terminator->getSuccessor(1);

// sweep the operations of the side-tracked block
for (mlir::Operation &op : otherSuccessor->getOperations()) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we are sweeping a block, we do not look at its branch operation. This means that if there are no values that go into the next block(s), we might not collect all of the operations that would be in these following blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants