Skip to content
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

[DC] Add fork/sink materialization passes #5159

Merged
merged 5 commits into from
May 17, 2023
Merged

Conversation

mortbopet
Copy link
Contributor

No description provided.

@mortbopet mortbopet changed the base branch from dev/mpetersen/dc_3 to main May 15, 2023 11:58
Copy link
Contributor

@lucas-rami lucas-rami left a comment

Choose a reason for hiding this comment

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

LGTM (once build/tests are passing)! Just left two questions but I'm most likely missing something

static LogicalResult addForkOps(Region &r, OpBuilder &rewriter) {
for (Operation &op : r.getOps()) {
// Ignore terminators, and don't add Forks to Forks.
if (op.getNumSuccessors() == 0 && !isa<ForkOp>(op)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it possible that a ForkOp instance that was present in the input IR before the fork/sink materialization pass runs has one of its results used multiple times? In that case, it seems we could end up with a value used more than once after the pass is finished. Does the pass assume that no forks/sinks are present in the input IR?

Copy link
Contributor

Choose a reason for hiding this comment

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

It shouldn't assume that IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most definitely - to create a vague excuse for myself, this code is just duplicated from the Handshake stuff. I'll fix it and add a test for it, good catch 👍

lib/Dialect/DC/Transforms/DCMaterialization.cpp Outdated Show resolved Hide resolved
include/circt/Dialect/DC/DCPasses.td Outdated Show resolved Hide resolved
lib/Dialect/DC/Transforms/CMakeLists.txt Outdated Show resolved Hide resolved
static LogicalResult addForkOps(Region &r, OpBuilder &rewriter) {
for (Operation &op : r.getOps()) {
// Ignore terminators, and don't add Forks to Forks.
if (op.getNumSuccessors() == 0 && !isa<ForkOp>(op)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It shouldn't assume that IMO.

lib/Dialect/DC/Transforms/DCMaterialization.cpp Outdated Show resolved Hide resolved
@mortbopet mortbopet merged commit dcc4b03 into main May 17, 2023
@darthscsi darthscsi deleted the dev/mpetersen/dc_4 branch June 4, 2024 14:50
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.

3 participants