fix: accumulated values lost when reused tracked fn skips re-execution#1099
Merged
MichaReiser merged 2 commits intoJun 2, 2026
Merged
Conversation
…cute Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
👷 Deploy Preview for salsa-rs processing.
|
✅ Deploy Preview for salsa-rs canceled.
|
Merging this PR will improve performance by 5.82%
Performance Changes
Tip Curious why this is faster? Comment Comparing |
MichaReiser
reviewed
May 28, 2026
Comment on lines
+188
to
+207
| InputAccumulatedValues::Any | ||
| } else { | ||
| accumulated | ||
| } |
Contributor
There was a problem hiding this comment.
Let's avoid the unreachable here
Suggested change
| } | |
| if let VerifyResult::Unchanged { accumulated } = deep_verify { | |
| // Check if the inputs are still valid. We can just compare `changed_at`. | |
| return Some(if old_memo.revisions.changed_at > revision { | |
| VerifyResult::changed() | |
| } else { | |
| // Propagate accumulated values from inputs *and* from this memo itself. | |
| // Without the own-accumulated check, a caller querying accumulated values | |
| // would see `Empty` and skip traversing into this subtree even though | |
| // this memo directly pushed accumulated values. | |
| VerifyResult::unchanged_with_accumulated( | |
| #[cfg(feature = "accumulator")] | |
| { | |
| if old_memo.revisions.accumulated().is_some() { | |
| InputAccumulatedValues::Any | |
| } else { | |
| accumulated | |
| } |
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Contributor
Author
|
Destructured deep_verify directly so the cfg-gated accumulated binding falls out of the if-let, dropping the unreachable (b928af4). Local cargo test on accumulate*, accumulated_backdate, cycle_accumulate all green with --features accumulator. |
MichaReiser
approved these changes
Jun 2, 2026
This was referenced Jun 2, 2026
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a tracked fn's inputs haven't changed,
maybe_changed_after_coldfast-paths throughdeep_verify_memoand returns theVerifyResultdirectly. That result carries the accumulated flag from the fn's edge inputs only; if the fn itself pushed accumulated values, those are ignored. Callers upstream then seeEmptyand skip traversing this subtree, so accumulated values are silently dropped.Fix: after
deep_verifysucceeds, check whether the memo's ownAccumulatedMapis non-empty and returnAnyin that case, matching what the re-execute path already does (lines 229-232).Fixes #923.