Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@maerhart
Copy link
Member

  • Simplify materializer to work on only one basic block
  • Remove unused addWorklist argument and use a class field instead
  • Because the way invocations are elaborated has changed, we don't need the worklist anymore within sequences or tests (we can just iterate over the operations since it's not a graph region), this is a big performance benefit in large tests/sequences.
  • Do a BFS over the sequence invocation hierarchy such that callees are only elaborated when all parents are elaborated (because only the sequence_closure operation should fix the randomization within a sequence, thus they create a clone before elaborating the referenced sequence)
  • Inline all sequences and remove them.

@maerhart maerhart added the RTG Involving the `rtg` dialect label Dec 11, 2024
@maerhart maerhart marked this pull request as draft December 11, 2024 13:57
@maerhart maerhart marked this pull request as ready for review December 12, 2024 16:56
auto *curr = worklist.front();
worklist.pop();

if (table.lookup<SequenceOp>(curr->getName()))
Copy link
Member

Choose a reason for hiding this comment

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

Should this be getNameAttr()?

Copy link
Member Author

Choose a reason for hiding this comment

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

SequenceValue doesn't have a getNameAttr. To return a StringAttr we'd need to first create one from the StringRef we get from name uniquing. However, if we just add a million sequences generated from a sequence family (result of sequence_closure op) to a set and only pick one, then we internalize almost a million attributes that we never use and attribute internalization is expensive. But yeah, this lookup would be faster, so it depends on the ratio of how many sequences end up being used. The name uniquing is actually consuming a big portion of the time in the outlined example case. So we might want to use IDs instead of directly generating unique names if it really becomes a bottleneck. It would complicate a few other things though, so need to be a bit careful with that.

@maerhart maerhart force-pushed the maerhart-rtg-elaboration-sequences branch from 75e65f4 to 1d5640f Compare January 14, 2025 19:59
@maerhart maerhart merged commit bbef1fa into main Jan 14, 2025
4 checks passed
@maerhart maerhart deleted the maerhart-rtg-elaboration-sequences branch January 14, 2025 20:28
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
* Simplify materializer to work on only one basic block
* Remove unused addWorklist argument and use a class field instead
* Because the way invocations are elaborated has changed, we don't need the worklist anymore within sequences or tests (we can just iterate over the operations since it's not a graph region), this is a big performance benefit in large tests/sequences.
* Do a BFS over the sequence invocation hierarchy such that callees are only elaborated when all parents are elaborated (because only the `sequence_closure` operation should fix the randomization within a sequence, thus they create a clone before elaborating the referenced sequence)
* Inline all sequences and remove them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RTG Involving the `rtg` dialect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants