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

Advanced LayerSink #7548

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Advanced LayerSink #7548

wants to merge 11 commits into from

Conversation

rwy7
Copy link
Contributor

@rwy7 rwy7 commented Aug 23, 2024

Add advanced layer sink, a new FIRRTL-dialect transform pass. Advanced layer sink serves the same purpose as the original layer sink pass: move ops into layers if their uses permits it. Advanced layer sink works by finding the shallowest block a value is used by an effectful op, and then sinking the defining op to that block. Compared to the original layer sink pass, which only relied on dominance info, this pass can sink cyclical structures, such as registers.

@rwy7 rwy7 force-pushed the advanced-layer-sink branch 3 times, most recently from 5464ac7 to 5031be0 Compare September 18, 2024 17:44
// implementation assumes it can run at a time where every register is
// currently in the final module it will be emitted in, all registers have
// been created, and no registers have yet been removed.
if (opt.isRandomEnabled(FirtoolOptions::RandomKind::Reg))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving register randomization to before layerSink, which, as an optimization, can delete registers.

@@ -1,5 +1,5 @@
// RUN: circt-opt %s -split-input-file | circt-opt -split-input-file
// RUN: firtool %s -split-input-file
// RUN: firtool %s -preserve-values=named -split-input-file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using interesting_name and preserve-values=named together to prevent layer-sink from deleting instances or wires that are necessary for the test.

@rwy7 rwy7 force-pushed the advanced-layer-sink branch 4 times, most recently from ef5e5c2 to 82c3e10 Compare September 18, 2024 21:57
@rwy7 rwy7 marked this pull request as ready for review September 26, 2024 15:54
@rwy7 rwy7 force-pushed the advanced-layer-sink branch 2 times, most recently from 371c340 to d22c585 Compare October 3, 2024 14:08
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.

1 participant