Skip to content

Add extrapolation to fork module#68

Open
Suad0 wants to merge 1 commit into
elftausend:mainfrom
Suad0:fork-extrapolation
Open

Add extrapolation to fork module#68
Suad0 wants to merge 1 commit into
elftausend:mainfrom
Suad0:fork-extrapolation

Conversation

@Suad0

@Suad0 Suad0 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

No description provided.

// 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];

Copy link
Copy Markdown
Owner

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];

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

same as above

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>() {

Copy link
Copy Markdown
Owner

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

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

Copy link
Copy Markdown
Owner

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

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