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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/mid-to-low/vec-to-low-set.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/vec-to-low-set.sml

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

revision 3632, Sun Jan 31 17:45:58 2016 UTC revision 3633, Sun Jan 31 19:06:56 2016 UTC
# Line 25  Line 25 
25    
26      in      in
27    
28    
29    (*
30    * Each EIN operator has a list of arguments.
31    * To reduce code size each argument is grouped together with its index binding (ix), low-il variable (var_a),
32    * argument type(argTy), and operation type (opTy) in a datatype called paramTy.
33    * ParamTy =(id,a,argTy,ix, opTy).
34    *
35    * The EIN operator λA<A_ijk>_{ijk} (a)
36    * has a single argument a.
37    * It's paramTy is (id,a,argTy,ix, opTy) where id=0 and  argTy=Ty.TensorTy[i,j,k]
38    *
39    * The opTy or operation type determines if second order tensor argument A
40    * will be treated as a scalar or vector arguement in the next operation.
41    * If opTy=Proj k then then last index is projected to a vector tensor[k] result= A[i,j,:]
42    * If opTy=Ind then each index in the the Tensor is indexed.  real result= A[i,j,k]
43    *
44    *
45    * ParamTy(id,a,argTy,[i,j], opTy) where opTy= Proj(k) creates a vector
46    *       => Op.ProjectLast (0,k ixx,Ty.TensorTy[i,j,k])
47    *          A[i,j,:]
48    *
49    * ParamTy (id,a,argTy,[i,j,k],opTy) where opTy= Indx  creates a scalar
50    *       => Op.IndexTensor (0, ixx, Ty.TensorTy[i,j,k])
51    *       A[i,j,:]
52    *
53    * Vector operations(Op.AddVec, Op.SubVec, Op.ProdVec) expects 2 vector arguements and
54    * Vector operations (Op.scaVec) expects 1 scalar and 1 vector argument.
55    *)
56    
57    
58      datatype opTy=  Indx| Proj of int      datatype opTy=  Indx| Proj of int
59      datatype paramTy  (*param id, argument var * argument type* ein binding* result type*)      datatype paramTy  (*param id, argument var * argument type* ein binding* result type*)
60      = Param of int * LowIL.var * Ty.ty * E.mu list * opTy      = Param of int * LowIL.var * Ty.ty * E.mu list * opTy
# Line 39  Line 69 
69      fun insert  (k, v) d =  IMap.insert (d, k, v)      fun insert  (k, v) d =  IMap.insert (d, k, v)
70      fun iToss e = String.concat (List.map Int.toString e)      fun iToss e = String.concat (List.map Int.toString e)
71    
72    
73        (*paramToOp: converts each parameter to low-ir operator*)
74      fun paramToOp(avail, mapp, paramTy)= case paramTy      fun paramToOp(avail, mapp, paramTy)= case paramTy
75          of Param(_, vA ,_ , [], Proj _) => (avail,vA)          of Param(_, vA ,_ , [], Proj _) => (avail,vA)
76          |  Param(_, vA, Ty.TensorTy[], _, Indx) =>  (avail, vA)          |  Param(_, vA, Ty.TensorTy[], _, Indx) =>  (avail, vA)
77          |  Param(id,vA ,argTy, ix, opType) => let          |  Param(id,vA ,argTy, ix, opType) => let
78                (* binds each index in ix using mapp*)
79              val ixx = (List.map  (fn  (e1) => mapIndex (e1, mapp))  ix) (*index Ty*)              val ixx = (List.map  (fn  (e1) => mapIndex (e1, mapp))  ix) (*index Ty*)
80              val str=String.concat (List.map Int.toString ixx)              val str=String.concat (List.map Int.toString ixx)
81                (*create low-ir operator *)
82              val (ty,opp,name)= (case opType              val (ty,opp,name)= (case opType
83                  of (Proj vecIX) => let                  of (Proj vecIX) => let
84                      val vecTy = Ty.TensorTy [vecIX]                      val vecTy = Ty.TensorTy [vecIX]

Legend:
Removed from v.3632  
changed lines
  Added in v.3633

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