-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add extrapolation to fork module #68
base: main
Are you sure you want to change the base?
Conversation
// Extrapolate if input is outside known range | ||
if input_lengths_sum < anals.first().unwrap().input_lengths.iter().sum::<usize>() { | ||
let lhs = &anals[0]; | ||
let rhs = &anals[1]; |
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.
At this stage, there could be only a single analyzation in the vector. Therefore, this can panic
let rhs = &anals[1]; | ||
return self.extrapolate_and_execute(lhs, rhs, input_lengths_sum, cpu_op, gpu_op); | ||
} else if input_lengths_sum > anals.last().unwrap().input_lengths.iter().sum::<usize>() { | ||
let lhs = &anals[anals.len() - 2]; |
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.
same as above
@@ -81,6 +115,18 @@ impl<Mods> UseGpuOrCpu for Fork<Mods> { | |||
|
|||
let input_lengths_sum = input_lengths.iter().sum::<usize>(); | |||
|
|||
// Extrapolate if input is outside known range | |||
if input_lengths_sum < anals.first().unwrap().input_lengths.iter().sum::<usize>() { |
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.
There is no chance to add new data points as the interpolation step takes any two analyzations (lhs, rhs) where the new analyzation (x) input size sum is lhs_input_sum <= x_input_sum <= rhs_input_sum.
Hence the max analyzations amount would be 2 ig
@@ -90,10 +136,14 @@ impl<Mods> UseGpuOrCpu for Fork<Mods> { | |||
|
|||
if input_lengths_sum >= input_lengths_lhs && input_lengths_sum <= input_lengths_rhs { | |||
let new_cpu_dur = lhs.cpu_dur.as_secs_f32() | |||
+ 0.5 * (rhs.cpu_dur.as_secs_f32() - lhs.cpu_dur.as_secs_f32()); | |||
+ (input_lengths_sum - input_lengths_lhs) as f32 | |||
/ (input_lengths_rhs - input_lengths_lhs) as f32 |
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.
could leave this factor at 0.5
No description provided.