mirror of
https://github.com/circify/circ.git
synced 2026-04-21 03:00:54 -04:00
timing opt
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user