Skip to content

Conversation

rwy7
Copy link
Contributor

@rwy7 rwy7 commented Jul 2, 2025

An old verifier for the RWPRobe op asserted that the target was under at least the same conditions as the probe op itself, ensuring that we could not create a forceable probe from within a layer, to something outside of that layer. This verifier helped ensure that "enabling a layer cannot change the behaviour of the design". We no longer have nor want this restriction, so this PR is removing the verifier.

This fixes an issue with advanced layer sink, where ALS will sink rwprobe ops into a layer and trigger this verification check.

Fixes: #8640

@rwy7 rwy7 requested review from darthscsi and seldridge as code owners July 2, 2025 13:40
@rwy7 rwy7 requested review from dtzSiFive and seldridge and removed request for seldridge and darthscsi July 2, 2025 13:40
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +828 to +833
// CHECK: %w = firrtl.wire sym @sym : !firrtl.uint<1>
// CHECK-NEXT: firrtl.layerblock @A {
// CHECK-NEXT: %0 = firrtl.ref.rwprobe <@SinkRWProbe::@sym> : !firrtl.rwprobe<uint<1>>
// CHECK-NEXT: %1 = firrtl.ref.cast %0 : (!firrtl.rwprobe<uint<1>>) -> !firrtl.rwprobe<uint<1>, @A>
// CHECK-NEXT: firrtl.ref.define %p, %1 : !firrtl.rwprobe<uint<1>, @A>
// CHECK-NEXT: }
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR: it seems like not sinking %w is a missed optimization here given that the only user of the wire is (now) inside the layer block. This is probably worth looking into in a follow-on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. It's the symbol from the rwprobe preventing advanced-layer-sink from sinking the op. Maybe we can revisit the use of symbols for rwprobes, or teach ALS how to find and interpret inner symbol users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Forceable would help with this, if we aren't removing it (it's presently unused, see #7138 which removes it).

@rwy7 rwy7 merged commit b5a0c46 into llvm:main Jul 2, 2025
7 checks passed
@rwy7 rwy7 deleted the fix-rwprobe-op branch July 2, 2025 15:16
uenoku pushed a commit that referenced this pull request Jul 3, 2025
* Revert "[FIRRTL] Verify RWProbeOp target has layer requirements. (#7372)"

This reverts commit 4415b9c.

* Add test for sinking RWProbe into layer
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
* Revert "[FIRRTL] Verify RWProbeOp target has layer requirements. (llvm#7372)"

This reverts commit 4415b9c.

* Add test for sinking RWProbe into layer
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.

[FIRRTL] Advanced layer sink will sink RWProbeOps and cause verifier errors
3 participants