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

[FIRRTL][CheckCombLoops] don't crash on force+rwprobeop, workaround. #6821

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/Dialect/FIRRTL/Transforms/CheckCombLoops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ class DiscoverLoops {
if (leader == rwProbeClasses.member_end())
return;
auto iter = rwProbeRefersTo.find(*leader);

// This should be found, but for now may not be due to needing
// RWProbeOp support. May cause missed loops involving force for now.
// https://github.com/llvm/circt/issues/6820
if (iter == rwProbeRefersTo.end())
return;

assert(iter != rwProbeRefersTo.end());
if (iter->second != dstNode)
drivenBy[iter->second].second.push_back(getOrAddNode(srcVal));
Expand Down
20 changes: 20 additions & 0 deletions test/Dialect/FIRRTL/check-comb-cycles.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1086,3 +1086,23 @@ firrtl.circuit "OutsideDialectSource" {
firrtl.strictconnect %b, %a : !firrtl.uint<32>
}
}

// -----

// Check RWProbeOp + force doesn't crash.
// No loop here.
firrtl.circuit "Issue6820" {
firrtl.module private @Foo(in %clock: !firrtl.clock sym @sym, out %clockProbe_bore: !firrtl.rwprobe<clock>) {
%0 = firrtl.ref.rwprobe <@Foo::@sym> : !firrtl.rwprobe<clock>
firrtl.ref.define %clockProbe_bore, %0 : !firrtl.rwprobe<clock>
}
firrtl.module @Issue6820(in %clock: !firrtl.clock, out %clockProbe: !firrtl.rwprobe<clock>) attributes {convention = #firrtl<convention scalarized>} {
%foo_clock, %foo_clockProbe_bore = firrtl.instance foo @Foo(in clock: !firrtl.clock, out clockProbe_bore: !firrtl.rwprobe<clock>)
firrtl.strictconnect %foo_clock, %clock : !firrtl.clock
firrtl.ref.define %clockProbe, %foo_clockProbe_bore : !firrtl.rwprobe<clock>
%c1_ui1 = firrtl.constant 1 : !firrtl.uint<1>
%c0_ui1 = firrtl.constant 0 : !firrtl.uint<1>
%0 = firrtl.asClock %c0_ui1 : (!firrtl.uint<1>) -> !firrtl.clock
firrtl.ref.force %clock, %c1_ui1, %clockProbe, %0 : !firrtl.clock, !firrtl.uint<1>, !firrtl.clock
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Can the PR add an XFAIL test (would have to be another file) that is checking that a cycle involving a force is fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You got it, here: #6823 .

Loading