timing opt

This commit is contained in:
Edward Chen
2022-05-20 15:14:53 -04:00
parent 03bd078b67
commit 573326904e
2 changed files with 21 additions and 15 deletions

View File

@@ -286,21 +286,21 @@ fn main() {
),
};
for (name, comp) in cs.computations.iter() {
println!("functions: {}", name);
for t in &comp.outputs {
println!("function term: {}, {}", t, t.uid());
for t1 in PostOrderIter::new(t.clone()) {
println!("term: {}, {}", t1, t1.uid());
for c in t1.cs.iter() {
println!("children: {}, {}", c, c.uid());
}
println!();
}
println!();
}
println!("\n");
}
// for (name, comp) in cs.computations.iter() {
// println!("functions: {}", name);
// for t in &comp.outputs {
// println!("function term: {}, {}", t, t.uid());
// for t1 in PostOrderIter::new(t.clone()) {
// println!("term: {}, {}", t1, t1.uid());
// for c in t1.cs.iter() {
// println!("children: {}, {}", c, c.uid());
// }
// println!();
// }
// println!();
// }
// println!("\n");
// }
println!("Done with IR optimization");

View File

@@ -10,6 +10,8 @@ pub mod sha;
pub mod tuple;
mod visit;
use std::time::Instant;
use super::term::*;
use log::debug;
@@ -47,6 +49,8 @@ pub fn opt<I: IntoIterator<Item = Opt>>(mut fs: Functions, optimizations: I) ->
let mut opt_fs: Functions = fs.clone();
for (name, comp) in fs.computations.iter_mut() {
debug!("Applying: {:?}", i);
println!("Applying: {:?} to {}", i, name);
let now = Instant::now();
match i.clone() {
Opt::ScalarizeVars => scalarize_vars::scalarize_inputs(comp),
Opt::ConstantFold(ignore) => {
@@ -114,6 +118,8 @@ pub fn opt<I: IntoIterator<Item = Opt>>(mut fs: Functions, optimizations: I) ->
tuple::eliminate_tuples(comp);
}
}
println!("{:?} took {} seconds.\n", i, now.elapsed().as_secs());
debug!("After {:?}: {} outputs", i, comp.outputs.len());
//debug!("After {:?}: {}", i, Letified(cs.outputs[0].clone()));
debug!("After {:?}: {} terms", i, comp.terms());