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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/types.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/types.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8, Fri Jan 8 21:50:42 2010 UTC revision 60, Tue May 4 15:55:00 2010 UTC
# Line 2  Line 2 
2   *   *
3   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4   * All rights reserved.   * All rights reserved.
5     *
6     * This file defines the internal representation of Diderot types.  Most values
7     * have the tensor type, which includes scalars, vectors, etc.  The internal
8     * type system supports polymorphism, which is used to give types to higher-order
9     * operators (e.g., derivatives).
10   *)   *)
11    
12  structure Types =  structure Types =
# Line 31  Line 36 
36        = T_Var of var        = T_Var of var
37        | T_Bool        | T_Bool
38      (* scalars, vectors, matrices, etc. *)      (* scalars, vectors, matrices, etc. *)
39    (* Question: perhaps we want {order : word, dim : dim, ty : raw_ty} instead *)
40        | T_Tensor of {order : dim list, ty : raw_ty}        | T_Tensor of {order : dim list, ty : raw_ty}
41      (* data sets from NNRD *)  (* Question: change "data set" to "image"? *)
42        (* data sets from NRRD *)
43        | T_Data of {        | T_Data of {
44            dim : dim,            (* 2D or 3D data set *)            dim : dim,            (* 2D or 3D data set *)
45            order : dim list,     (* tensor order/dimension info *)            shape : dim list,     (* tensor shape; order is length of list *)
46            repTy : raw_ty        (* representation type of elements (raw kind) *)            repTy : raw_ty        (* representation type of elements (raw kind) *)
47          }          }
48      (* continuous field reconstructed from a data set *)      (* continuous field reconstructed from a data set *)
49        | T_Field of {        | T_Field of {
50              diff : dim,           (* number of levels of differentiation supported *)
51            dim : dim,            (* 2D or 3D field *)            dim : dim,            (* 2D or 3D field *)
52            order : dim list,     (* tensor order/dimension info *)            shape : dim list,     (* tensor shape; order is length of list *)
53            repTy : raw_ty,       (* representation type of elements (raw kind) *)            repTy : raw_ty,       (* representation type of elements (raw kind) *)
54            ty : raw_ty           (* type of samples (float kind) *)            ty : raw_ty           (* type of samples (float kind) *)
55          }          }
# Line 91  Line 99 
99                  okDim dim                  okDim dim
100                  andalso List.all okDim order                  andalso List.all okDim order
101                  andalso okRawTy repTy                  andalso okRawTy repTy
102                  andalso okFloatTy repTy                  andalso okFloatTy ty
103              | wellFormed' _ = false              | wellFormed' _ = false
104            in            in
105              wellFormed' ty              wellFormed' ty
106            end            end
107    
108      (* some common types *)
109        local
110          fun scalarTy rty = T_Tensor{order=[], ty=rty}
111          fun vecTy (d, rty) = T_Tensor{order=[DIM d], ty=rty}
112        in
113        val intTy = scalarTy RT_Int32
114        val int2Ty = vecTy (0w2, RT_Int32)
115        val intT3y = vecTy (0w3, RT_Int32)
116        val intT4y = vecTy (0w4, RT_Int32)
117        val uintTy = scalarTy RT_UInt32
118        val uint2Ty = vecTy (0w2, RT_UInt32)
119        val uintT3y = vecTy (0w3, RT_UInt32)
120        val uintT4y = vecTy (0w4, RT_UInt32)
121        val floatTy = scalarTy RT_Float
122        val float2Ty = vecTy (0w2, RT_Float)
123        val floatT3y = vecTy (0w3, RT_Float)
124        val floatT4y = vecTy (0w4, RT_Float)
125        val doubleTy = scalarTy RT_Double
126        val double2Ty = vecTy (0w2, RT_Double)
127        val double3Ty = vecTy (0w3, RT_Double)
128        val double4Ty = vecTy (0w4, RT_Double)
129        end (* local *)
130    
131      (* new type variables *)
132        fun newVar k = TV{kind=k, stamp=Stamp.new()}
133    
134    end    end

Legend:
Removed from v.8  
changed lines
  Added in v.60

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