-
Notifications
You must be signed in to change notification settings - Fork 596
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
Made feedback set algorithm not ignore the nodes post cycle. #5539
Conversation
fde84c2
to
588a8b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @orizi and @yuvalsw)
crates/cairo-lang-utils/src/graph_algos/feedback_set.rs
line 33 at r2 (raw file):
/// reached, it indicates it's in some cycle that was not "resolved" yet. in_flight: UnorderedHashSet<Node::NodeId>, /// Node already visited in the current run.
Suggestion:
/// Already visited nodes in the current run.
588a8b0
to
04b7d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
04b7d03
to
2f97689
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r1, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions
crates/cairo-lang-utils/src/graph_algos/feedback_set.rs
line 25 at r4 (raw file):
struct FeedbackSetAlgoContext<Node: ComputeScc> { /// Nodes that were discovered as reachable from the current run, but possibly were not yet /// visited.
please elaborate about the "possibly" here - what are the cases where they were visited and still pending? (IIUC, if visited after being added to pending)
Code quote:
/// Nodes that were discovered as reachable from the current run, but possibly were not yet
/// visited.
crates/cairo-lang-utils/src/graph_algos/feedback_set_test.rs
line 144 at r4 (raw file):
vec![1, 2], // 1: vec![1, 0],
Did this fail before the fix?
I think the bug was only relevant in the case of [0, 1]. Here you first find the size-1 cycle [1], and then don't add 0 to the fset and don't break. If it was [0, 1] (before the fix) you would not add 1, add 0 and break, and skip 2, missing the size-1 cycle [2].
Code quote:
vec![1, 0],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions
crates/cairo-lang-utils/src/graph_algos/feedback_set_test.rs
line 144 at r4 (raw file):
Previously, yuvalsw wrote…
Did this fail before the fix?
I think the bug was only relevant in the case of [0, 1]. Here you first find the size-1 cycle [1], and then don't add 0 to the fset and don't break. If it was [0, 1] (before the fix) you would not add 1, add 0 and break, and skip 2, missing the size-1 cycle [2].
it failed only on the case starting from 0.
a similar case failed for more. (where the edges were sorted)
Fixes #5524
This change is