Skip to content

refactor: Discard unnecessary atomic load #780

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 26, 2025

No description provided.

db,
revision_now,
database_key_index,
memo.revisions.accumulated_inputs.load(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This one specifically, we load the value here just to set it to the same one

Copy link

netlify bot commented Mar 26, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit e046789
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67f0e9d0f9bb010008fb11ae

Comment on lines -415 to +405
break 'cycle VerifyResult::Unchanged(
InputAccumulatedValues::Empty,
CycleHeads::from(cycle_heads),
);
break 'cycle VerifyResult::Unchanged(inputs, CycleHeads::from(cycle_heads));
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to get a check on this, I believe Empty by default is incorrect here hence the change, but I am not 100% sure

Copy link
Contributor

Choose a reason for hiding this comment

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

CC: @carljm

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, sorry for missing this ping, apparently twice! I think this is change is right. It would probably be ideal to write a test that fails without this fix, though. If this fix is needed, I don't think the test should even require a cycle, as this is also the path for non-cycles. It would probably be a test with accumulated values across multiple revisions, with some inputs changing but some sub-graph (that has accumulated values in it) not changing?

Copy link

codspeed-hq bot commented Mar 26, 2025

CodSpeed Performance Report

Merging #780 will not alter performance

Comparing Veykril:veykril/push-zxssxpkmuqlr (e046789) with master (296a8c7)

Summary

✅ 12 untouched benchmarks

@Veykril Veykril force-pushed the veykril/push-zxssxpkmuqlr branch from a552fd9 to 64b0746 Compare March 28, 2025 07:51
Comment on lines -415 to +405
break 'cycle VerifyResult::Unchanged(
InputAccumulatedValues::Empty,
CycleHeads::from(cycle_heads),
);
break 'cycle VerifyResult::Unchanged(inputs, CycleHeads::from(cycle_heads));
Copy link
Contributor

Choose a reason for hiding this comment

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

CC: @carljm

@Veykril
Copy link
Member Author

Veykril commented Mar 28, 2025

CC: @carljm

Unsure why I can't reply to that but right, forgot to call that change out. It looks like a bug to me but please double check

@Veykril Veykril force-pushed the veykril/push-zxssxpkmuqlr branch from 64b0746 to e046789 Compare April 5, 2025 08:29
@MichaReiser
Copy link
Contributor

Sorry for the ping but @carljm did you see @Veykril comment?

Comment on lines +166 to 172
// We don't access the accumulator anyways
let revisions = AssertUnwindSafe(revisions);
self.with_query_stack(|stack| {
if let Some(top_query) = stack.last_mut() {
top_query.add_read(input, durability, changed_at, accumulated, cycle_heads);
top_query.add_read(input, { revisions }.0, cycle_heads);
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I prefer the old method signature in that case to avoid this very easy to get outdated comment about accumulators.

Not changing the signature (or only remuving accumulated) also has the benefit that it makes the diff a bit clearer.

@@ -217,12 +216,12 @@ impl<V> Memo<V> {

/// Mark memo as having been verified in the `revision_now`, which should
/// be the current revision.
#[inline]
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to have a comment here mentioning that it's the caller's responsibility to update accumulated if their accumulated values have changed since the query ran last

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.

3 participants