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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/ein/ein.sml
ViewVC logotype

View of /branches/vis15/src/compiler/ein/ein.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3574 - (download) (annotate)
Mon Jan 11 23:05:08 2016 UTC (3 years, 10 months ago) by jhr
File size: 2389 byte(s)
working on merge
(* ein.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure Ein =
  struct

(*TEN 0-Don't Subst,shape of arguement *)
    datatype param_kind
      = TEN of bool * int list	(* the boolean specifies if the parameter is substitutable *)
      | FLD of int
      | KRN
      | IMG of int * int list
(* FIXME: need some comments here!!! *) 
    type index_kind = int
    type field_id = int
    type tensor_id = int
    type kernel_id = int
    type image_id = int
    type index_id = int

    datatype ein = EIN of {
	params : param_kind list,
	(* Parameters to equation are either tensors or fields *)
	(* These variables are named using de Bruijn indexing *)
(* QUESTION: why is this index_kind list and not index_id list? *)
	index : index_kind list,	(* Index variables in the equation. *)
	body : ein_exp
      }

    and mu
      = V of index_id
      | C of int

    and unary
      = Neg
      | Exp
      | Sqrt
      | Cosine
      | ArcCosine
      | Sine
      | ArcSine
      | Tangent
      | ArcTangent
(* QUESTION: should the int be IntInf.int? *)
      | PowInt of int
      | PowReal of Rational.t
      | PowEmb of sumrange list * int

    and binary = Sub | Div

    and opn = Add | Prod

    and ein_exp
    (* Basic terms *)
      = Const of int
(* QUESTION: should this be RealLit.t? *)
      | ConstR of Rational.t
      | Tensor of tensor_id * alpha
(* FIXME: the "mu * mu" should be "index_id * index_id" in the sumrange type *)
      | Delta of mu * mu
      | Epsilon of index_id * index_id * index_id
      | Eps2 of index_id * index_id
    (* High-IL Terms *)
      | Field of field_id * alpha
      | Lift of ein_exp
      | Conv of image_id * alpha * kernel_id * alpha
      | Partial of alpha
      | Apply of ein_exp * ein_exp
      | Probe of ein_exp * ein_exp
    (* Mid-IL Terms *)
      | Value of index_id (* Lift index *)
      | Img of image_id * alpha * pos list
      | Krn of kernel_id * (mu * mu) list * pos
    (* Ops *)
      | Sum of sumrange list * ein_exp
      | Op1 of unary * ein_exp
      | Op2 of binary * ein_exp * ein_exp
      | Opn of opn * ein_exp list

    withtype alpha = mu list
	and pos = ein_exp
(* FIXME: the "mu" should be "index_id" in the sumrange type *)
	and sumrange = mu * int * int

  end

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