Skip to content
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

Allow custom exertion logic #411

Merged
merged 3 commits into from
Nov 9, 2023
Merged

Allow custom exertion logic #411

merged 3 commits into from
Nov 9, 2023

Conversation

frankmcsherry
Copy link
Member

This PR allows users to set their own "exertion logic", replacing the hardwired reduced function for spines. This was the method that indicated whether there was work to perform in the absence of actual updates. This PR combines this with the effort argument to allow logic that produces an Option<usize> indicating how many updates should be virtually applied, as a function of the shape of the spine. It's a bit of a leaky abstraction (not all traces need to have a spine, right?) but the moment at which an opinion is currently injected requires the trace abstraction.

Some follow-on thoughts:

  1. We could change the Option<usize> output to usize, and commit to 0 to mean "do no work, and do not reschedule".
  2. We could change the idle_merge_effort config to be usize rather than isize, which I think it is because ultimately the exert function needs that. But it doesn't make a lot of sense to provide negative idle merge effort.
  3. We could try and put the method on a Spine type, rather than as part of Trace, but I'm not certain how to thread the system-wide config of "do this with a spine" other than across the trace.

cc: @antiguru, @teskje

Copy link
Member

@antiguru antiguru left a comment

Choose a reason for hiding this comment

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

Looks good! Left some comments inline.

@@ -483,7 +490,7 @@ where
}

// Having performed all of our work, if more than one batch remains reschedule ourself.
if !self.reduced() {
if !self.exert_effort().is_some() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !self.exert_effort().is_some() {
if self.exert_effort().is_none() {

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooh, I think this is wrong both ways, actually. We want to reschedule if there is exert effort to apply. Oops. Will fix.

@@ -140,5 +140,17 @@ impl Config {
pub fn configure(config: &mut timely::WorkerConfig, options: &Config) {
if let Some(effort) = options.idle_merge_effort {
config.set("differential/idle_merge_effort".to_string(), effort);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we're referencing idle_merge_effort anymore, so we should probably remove it here, and extend options to also take a default_excert_logic.

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 think I'm up for waiting just a bit to see how this looks before locking things in. I wrote a bunch of code before realizing that it all needs to cross thread boundaries, and if it turns out that it needs to be SerDe also .. what a mess. :D

@frankmcsherry frankmcsherry merged commit 0673ecd into master Nov 9, 2023
2 checks passed
This was referenced Oct 29, 2024
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.

2 participants