Skip to content

Conversation

@ziadomalik
Copy link
Collaborator

See also related PR for Reconvergent paths enumeration.

This feature enumerates synchronizing cycles, as they are defined in Xu, Josipović, FPGA'24, Section 4:

Definition 3: Two cycles are a pair of synchronizing cycles in a
dataflow circuit if the following properties hold: (1) The two cycles
are disjoint (i.e. they do not have any common units) and belong to
the same CFC (defined in Section 3.2). (2) There exists at least one
join that is reachable from both cycles without crossing any edge
on the cycle in the CFC they belong to.

We start out by computing all the strongly-connected-components of the CFC using Kosaraju's algorithm, then we find all the cycles in the CFC using Boost's tiernan_all_cycles function. Using both of our findings, we can enumerate each pair of cycles, check them against above criteria and reconstruct a path between the pair and the common join if they do match.

Also it's more modular now, take the logic out of the constructor, and a data flow graph describes a single thing, not an array of things
@ziadomalik ziadomalik force-pushed the feat/ziad/synchronizing-cycles branch from ac3944e to 75a54b4 Compare January 6, 2026 00:37
Copy link
Member

@Jiahui17 Jiahui17 left a comment

Choose a reason for hiding this comment

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

Some readability suggestions I missed last time

Comment on lines 339 to 343
/// Find all edges (from nonCyclicAdjList) on any path from cycle to join.
/// An edge is included if its source is reachable from the cycle and its
/// destination can reach the join.
std::vector<size_t> findEdgesToJoin(const SimpleCycle &cycle,
NodeIdType joinId) const;
Copy link
Member

Choose a reason for hiding this comment

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

Explain the returned type (e.g., what is size_t for?)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

Choose a reason for hiding this comment

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

Have you missed this? Here we could write something like:

  /// Returns a vector of XXX (here I really don't know what is being returned haha

/// Find all edges (from nonCyclicAdjList) on any path from cycle to join.
/// An edge is included if its source is reachable from the cycle and its
/// destination can reach the join.
/// @returns A vector indices into the edges vector.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Jiahui17 I added it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Okay this is why i am a bit confused: is this an id of the edge? If yes we could define another EdgeIdType

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mean the index is unique to every edge, so in that sense it's an ID. We can also add EdgeIdType

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also now that I am thinking about it, we could remove id from the Node struct and just use llvm::enumerate everywhere, since it's pretty much an index aswell.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done adding a new EdgeIdType!
Let me know if my latter comment is worth the refactor @Jiahui17

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