-
Notifications
You must be signed in to change notification settings - Fork 156
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
Enable Garbage Collection for Interned Values #602
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for salsa-rs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
CodSpeed Performance ReportMerging #602 will not alter performanceComparing Summary
|
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.
Nice. This looks good to me after adding a few tests.
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.
Yes, looks good to me!
I see there is a test failure....have you investigated it at all? |
My hunch is that the test is testing behavior that's not relevant anymore but I can look. |
@nikomatsakis I'm also hitting the assertion error in this example: #[salsa::tracked]
fn function<'db>(db: &'db dyn Database, input: Input) -> Interned<'db> {
Interned::new(db, 0)
}
let input = Input::new(&db, 0);
function(&db, input);
input.set_field1(&mut db).to(1);
function(&db, input); The function does not read the input so the interned value is memoized, meaning it is not re-interned in R2. What should be done in this case (and the similar failing test)? I'm also a little unclear about the testing instructions. Should I add a log event for when values are re-interned, or is there another way I can test that? I'm also not sure how to access the |
That would sound reasonable to me, similar to the backdate event. We could also consider adding an event when a value is garbage collected. |
If I understand it correctly the problem is that interned ingredients created outside of a query are never revalidated because there's no corresponding query that creates them. I see two options:
|
I took a closer look at I think the problem here is that |
We had a brief discussion in our meeting today--- @ibraheemdev I think values that are interned outside of any salsa query have to be concerned immortal. |
The This one seems trickier. The query does not have a dependency on its input. However, changing the input still causes the database revision to be advanced. I'm not exactly sure why, but I believe the second query call only performs a shallow memoization check, meaning that |
|
||
// Record a dependency on this value. | ||
let index = self.database_key_index(id); | ||
zalsa_local.report_tracked_read(index, Durability::MAX, current_revision); |
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.
Just making sure, is current_revision
the correct argument to pass here?
Oh this is interesting. I have to take a closer look. We probably have a similar problem for when the input has a higher durability and Salsa skips the deep verification because of it. |
Per the mentoring instructions in #597.
Still needs some tests. Note this does not actually implement garbage collection but adds the necessary plumbing to do so.