Skip to content
Snippets Groups Projects
cpu.sch 3.75 KiB
Newer Older
  • Learn to ignore specific revisions
  • rarbore2's avatar
    rarbore2 committed
    macro simpl!(X) {
      ccp(X);
      simplify-cfg(X);
      lift-dc-math(X);
      gvn(X);
      phi-elim(X);
      dce(X);
      infer-schedules(X);
    }
    
    simpl!(*);
    
    ip-sroa(*);
    sroa(*);
    simpl!(*);
    
    no-memset(gaussian_smoothing@res);
    fixpoint {
      forkify(gaussian_smoothing);
      fork-guard-elim(gaussian_smoothing);
      fork-coalesce(gaussian_smoothing);
    }
    predication(gaussian_smoothing);
    simpl!(gaussian_smoothing);
    predication(gaussian_smoothing);
    simpl!(gaussian_smoothing);
    
    rarbore2's avatar
    rarbore2 committed
    let par = gaussian_smoothing@image_loop \ gaussian_smoothing@filter_loop;
    fork-tile[4, 1, false, false](par);
    fork-tile[4, 0, false, false](par);
    fork-interchange[1, 2](par);
    let split = fork-split(par);
    let gaussian_smoothing_body = outline(split._0_gaussian_smoothing.fj2);
    fork-coalesce(gaussian_smoothing, gaussian_smoothing_body);
    simpl!(gaussian_smoothing, gaussian_smoothing_body);
    
    rarbore2's avatar
    rarbore2 committed
    
    no-memset(laplacian_estimate@res, laplacian_estimate@shr1, laplacian_estimate@shr2);
    fixpoint {
      forkify(laplacian_estimate);
      fork-guard-elim(laplacian_estimate);
      fork-coalesce(laplacian_estimate);
    }
    simpl!(laplacian_estimate);
    
    rarbore2's avatar
    rarbore2 committed
    let par = laplacian_estimate@image_loop \ laplacian_estimate@filter_loop;
    fork-tile[4, 1, false, false](par);
    fork-tile[4, 0, false, false](par);
    fork-interchange[1, 2](par);
    let split = fork-split(par);
    let body = split._1_laplacian_estimate.fj2 | laplacian_estimate.shr1 | laplacian_estimate.shr2;
    let laplacian_estimate_body = outline(body);
    fork-coalesce(laplacian_estimate, laplacian_estimate_body);
    simpl!(laplacian_estimate, laplacian_estimate_body);
    
    rarbore2's avatar
    rarbore2 committed
    
    no-memset(zero_crossings@res, zero_crossings@shr1, zero_crossings@shr2);
    fixpoint {
      forkify(zero_crossings);
      fork-guard-elim(zero_crossings);
      fork-coalesce(zero_crossings);
    }
    simpl!(zero_crossings);
    
    rarbore2's avatar
    rarbore2 committed
    let par = zero_crossings@image_loop \ zero_crossings@filter_loop;
    fork-tile[4, 1, false, false](par);
    fork-tile[4, 0, false, false](par);
    fork-interchange[1, 2](par);
    let split = fork-split(par);
    let body = split._2_zero_crossings.fj2 | zero_crossings.shr1 | zero_crossings.shr2;
    let zero_crossings_body = outline(body);
    fork-coalesce(zero_crossings, zero_crossings_body);
    simpl!(zero_crossings, zero_crossings_body);
    
    rarbore2's avatar
    rarbore2 committed
    
    no-memset(gradient@res);
    fixpoint {
      forkify(gradient);
      fork-guard-elim(gradient);
      fork-coalesce(gradient);
    }
    predication(gradient);
    simpl!(gradient);
    predication(gradient);
    simpl!(gradient);
    
    fixpoint {
      forkify(max_gradient);
      fork-guard-elim(max_gradient);
      fork-coalesce(max_gradient);
    }
    simpl!(max_gradient);
    
    rarbore2's avatar
    rarbore2 committed
    fork-dim-merge(max_gradient);
    simpl!(max_gradient);
    
    rarbore2's avatar
    rarbore2 committed
    fork-tile[16, 0, false, false](max_gradient);
    
    rarbore2's avatar
    rarbore2 committed
    let split = fork-split(max_gradient);
    clean-monoid-reduces(max_gradient);
    let out = outline(split._4_max_gradient.fj1);
    simpl!(max_gradient, out);
    unforkify(out);
    let out = fork-fission[split._4_max_gradient.fj0](max_gradient);
    simpl!(max_gradient);
    unforkify(out._4_max_gradient.fj_bottom);
    
    rarbore2's avatar
    rarbore2 committed
    
    no-memset(reject_zero_crossings@res);
    fixpoint {
      forkify(reject_zero_crossings);
      fork-guard-elim(reject_zero_crossings);
      fork-coalesce(reject_zero_crossings);
    }
    predication(reject_zero_crossings);
    simpl!(reject_zero_crossings);
    
    rarbore2's avatar
    rarbore2 committed
    fork-tile[4, 1, false, false](reject_zero_crossings);
    fork-tile[4, 0, false, false](reject_zero_crossings);
    fork-interchange[1, 2](reject_zero_crossings);
    let split = fork-split(reject_zero_crossings);
    let reject_zero_crossings_body = outline(split._5_reject_zero_crossings.fj2);
    fork-coalesce(reject_zero_crossings, reject_zero_crossings_body);
    simpl!(reject_zero_crossings, reject_zero_crossings_body);
    
    rarbore2's avatar
    rarbore2 committed
    
    async-call(edge_detection@le, edge_detection@zc);
    
    
    rarbore2's avatar
    rarbore2 committed
    fork-split(gaussian_smoothing_body, laplacian_estimate_body, zero_crossings_body, gradient, reject_zero_crossings_body);
    unforkify(gaussian_smoothing_body, laplacian_estimate_body, zero_crossings_body, gradient, reject_zero_crossings_body);
    
    rarbore2's avatar
    rarbore2 committed
    
    simpl!(*);
    
    delete-uncalled(*);
    gcm(*);