Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/compiler/simplify/map-reduce-opt.sml
ViewVC logotype

View of /branches/vis15/src/compiler/simplify/map-reduce-opt.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4315 - (download) (annotate)
Sat Jul 30 13:33:50 2016 UTC (2 years, 11 months ago) by jhr
File size: 1247 byte(s)
working on merge: preparing for global reductions
(* map-reduce-opt.sml
 *
 * Optimize global map-reduce computations that can occur in the global "initially" and
 * "update" blocks.
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *)

structure MapReduceOpt : sig

    val transform : Simple.program -> Simple.program

  end = struct

    structure S = Simple
    structure ST = Stats

    fun doGlobalPhase NONE = NONE
      | doGlobalPhase (SOME blk) = NONE (* FIXME *)

    fun transform prog = let
	  val S.Program{
		  props, consts, inputs, constInit, globals, globInit, funcs,
		  strand, create, init, update
		} = prog
	  fun result (init', update') = S.Program{
		  props = props, consts = consts, inputs = inputs,
		  constInit = constInit, globals = globals, globInit = globInit,
		  funcs = funcs, strand = strand, create = create,
		  init = init', update = update'
		}
	  in
	    case (doGlobalPhase init, doGlobalPhase update)
	     of (NONE, NONE) => prog
	      | (SOME init', NONE) => result (init', update)
	      | (NONE, SOME update') => result (init, update')
	      | (SOME init', SOME update') => result (init', update')
	    (* end case *)
	  end

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0