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

Skip to content

Conversation

@seldridge
Copy link
Member

Change the LowerXMR pass to reuse previously created XMRRefOps within a module. This is done for later, easier processing of these operations in LowerToHW. While these operations could be made to be CSE'd (by giving them the Pure trait), it is advantageous to instead not create duplicate operations as this avoids needing to run schedule a mostly useless CSE.

This is primarily done to allow for Verilator-compatible lowering of force_initial and release_initial in LowerToHW where it would be useful to know when a force and release are referring to the same reference. (Yes, full alias analysis is necessary to do this correctly and relying on the CSE of LowerXMR is going to be buggy.)

Change the `LowerXMR` pass to reuse previously created `XMRRefOp`s within
a module.  This is done for later, easier processing of these operations
in `LowerToHW`.  While these operations could be made to be CSE'd (by
giving them the `Pure` trait), it is advantageous to instead not create
duplicate operations as this avoids needing to run schedule a mostly
useless CSE.

This is primarily done to allow for Verilator-compatible lowering of
`force_initial` and `release_initial` in `LowerToHW` where it would be
useful to know when a force and release are referring to the same
reference.  (Yes, full alias analysis is necessary to do this correctly
and relying on the CSE of `LowerXMR` is going to be buggy.)

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge requested a review from darthscsi as a code owner January 10, 2025 23:18
Copy link
Contributor

@prithayan prithayan left a comment

Choose a reason for hiding this comment

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

Looks good.

@seldridge seldridge merged commit c3c0b08 into main Jan 13, 2025
5 checks passed
@seldridge seldridge deleted the dev/seldridge/firrtl-lowerxmr-cse-xmrrefops branch January 13, 2025 17:33
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
Change the `LowerXMR` pass to reuse previously created `XMRRefOp`s within
a module.  This is done for later, easier processing of these operations
in `LowerToHW`.  While these operations could be made to be CSE'd (by
giving them the `Pure` trait), it is advantageous to instead not create
duplicate operations as this avoids needing to run schedule a mostly
useless CSE.

This is primarily done to allow for Verilator-compatible lowering of
`force_initial` and `release_initial` in `LowerToHW` where it would be
useful to know when a force and release are referring to the same
reference.  (Yes, full alias analysis is necessary to do this correctly
and relying on the CSE of `LowerXMR` is going to be buggy.)

Signed-off-by: Schuyler Eldridge <[email protected]>
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