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

Print the egglog program before the last schedule for multi-pass schedule in --run-mode egglog #675

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yihozhang
Copy link
Collaborator

@yihozhang yihozhang commented Nov 21, 2024

Follow up of #670

Copy link
Member

@oflatt oflatt left a comment

Choose a reason for hiding this comment

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

Some suggested improvments

pub stop_after_n_passes: usize,
/// Stop after this many passes.
/// If stop_after_n_passes is negative,
/// run [0 ... schedule.len() + stop_after_n_passes + 1] passes.
Copy link
Member

Choose a reason for hiding this comment

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

This seems weird... I would expect -1 to run all but the last pass, but it looks like it runs all of them.
Perhaps you should make it i64::MAX by default and use [0 .. scheduler.len() + stop_after_n_passes ] in the neg case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the code to reflect this, although it is a little less elegant now to handle the pass before i64::MAX

@@ -173,8 +173,6 @@ pub fn parallel_schedule() -> Vec<CompilerPass> {
)),
CompilerPass::InlineWithSchedule(format!(
"
;; HACK: when INLINE appears in this string
Copy link
Member

Choose a reason for hiding this comment

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

good catch

src/util.rs Show resolved Hide resolved
src/util.rs Show resolved Hide resolved
src/util.rs Outdated
.map_err(EggCCError::EggLog)?;

let schedules = parallel_schedule();
let last_schedule_step = schedules.last().unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

You're still using the wrong pass here- didn't you want the stop_after_n_passes pass?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch, fixed!

.eggcc_config
.get_normalized_cutoff(parallel_schedule().len());
assert!(cutoff != 0);
let cutoff = cutoff - 1;
Copy link
Member

Choose a reason for hiding this comment

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

Why are you subtracting 1 here? Shouldn't you pass it to the config as-is?

Copy link
Collaborator Author

@yihozhang yihozhang Nov 22, 2024

Choose a reason for hiding this comment

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

say there are N passes and the user passes stop-after-n-passes=N (the default value). This will run 0..(N-1) passes, and use the last schedule, which is at position N-1. Maybe I miss something here?

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