-
Notifications
You must be signed in to change notification settings - Fork 151
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
[RFC] fixpoint iteration support #603
Open
carljm
wants to merge
28
commits into
salsa-rs:master
Choose a base branch
from
carljm:fixpoint
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,436
−1,411
Open
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
207656a
add example test for fixpoint iteration
carljm 6d065ca
add a multi-symbol test
carljm 915b245
simplify test case
carljm fd454f7
WIP: remove existing cycle handling tests for now
carljm fe1de3c
WIP: remove all existing cycle handling, add fixpoint options
carljm 08901b2
WIP: added provisional value and cycle fields
carljm abb6fdd
rename to CycleRecoveryStrategy::Fixpoint
carljm 8dc4a0b
WIP: rip out ProvisionalValue
carljm ff455fc
WIP: working single-iteration with provisional memo
carljm cd01235
WIP: add count arg to cycle_recovery_fn
carljm 79a1ada
WIP: move insert-initial out into fetch_cold
carljm 7b6b1a7
WIP: cycle-head iteration
carljm eb0325b
WIP: move loop into execute
carljm c6c972c
WIP: delay storing memo
carljm 7a425f7
WIP: remove ourself from cycle heads when done iterating
carljm f84ef80
WIP: working convergence and fallback
carljm 05a7d5b
WIP: clippy and cleanup
carljm b816aa0
WIP: improve comments and add a type annotation
carljm 7fcfd7f
WIP: don't allow cycle_fn with no_eq
carljm f411766
WIP: add tracing for cycle iteration
carljm e16055d
WIP: fail fast if we get an evicted provisional value
carljm 446d655
WIP: use FxHashSet::from_iter
carljm 3325861
add tests, fix multiple-revision, lazy provisional value
carljm ce1e57b
review feedback, more tracing
carljm b114580
fix multi-revision bug
carljm 0b59209
better fix for multi-revision bug
carljm 706d0ad
test fixes
carljm c1bbdcf
pass inputs to cycle recovery functions
carljm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 14 additions & 9 deletions
23
components/salsa-macro-rules/src/unexpected_cycle_recovery.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
// Macro that generates the body of the cycle recovery function | ||
// for the case where no cycle recovery is possible. This has to be | ||
// a macro because it can take a variadic number of arguments. | ||
// for the case where no cycle recovery is possible. Must be a macro | ||
// because the signature types must match the particular tracked function. | ||
#[macro_export] | ||
macro_rules! unexpected_cycle_recovery { | ||
($db:ident, $cycle:ident, $($other_inputs:ident),*) => { | ||
{ | ||
std::mem::drop($db); | ||
std::mem::drop(($($other_inputs),*)); | ||
panic!("cannot recover from cycle `{:?}`", $cycle) | ||
} | ||
} | ||
($db:ident, $value:ident, $count:ident) => {{ | ||
std::mem::drop($db); | ||
panic!("cannot recover from cycle") | ||
}}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! unexpected_cycle_initial { | ||
($db:ident) => {{ | ||
std::mem::drop($db); | ||
panic!("no cycle initial value") | ||
}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I suspect that it's possible that the initial value function or the recover functions itself could create new cycles. Is this indeed the case and if so, what's salsa's behavior?
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.
Hmm. In the use cases I have in mind (e.g. for red-knot) there should not be any reason to call a query from within one of these functions. And it seems like this could be quite difficult to deal with. So unless we have clear use cases, I would rather consider this out of scope. We could just document "don't do that," or we could add some kind of explicit prevention.
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.
Yeah. I'm not suggesting that users should do that. I only wonder about what happens if a user does it regardless.
Ideally, we wouldn't provide a
Db
but we can't do that because a user might want to create a tracked struct.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.
I think the simplest approach here would be to add some state on
Runtime
that causes an error if you try to push a new active query. I'll wait for Niko review before doing that, though.