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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-ir/high-ir.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-ir/high-ir.sml

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

revision 3796, Fri Apr 29 21:40:04 2016 UTC revision 3797, Mon May 2 21:10:12 2016 UTC
# Line 36  Line 36 
36      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
37    
38    (* required helper functions for the mask type *)    (* required helper functions for the mask type *)
39      type mask = bool list      type mask = TensorSlice.t
40      val samemask : (mask * mask -> bool) = (op =)      val samemask = TensorSlice.same
41      fun hashmask m =      val hashmask = TensorSlice.hash
42            List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)      val maskToString = TensorSlice.toString
43              (Word.fromInt(List.length m)) m  
44      fun maskToString m =    (* required helper functions for the shape type *)
45            String.concat(List.map (fn true => "_" | false => ":") m)      type shape = TensorShape.t
46        val sameshape = TensorShape.same
47        val hashshape = TensorShape.hash
48        val shapeToString = TensorShape.toString
49    
50      datatype rator      datatype rator
51        = IAdd        = IAdd
# Line 68  Line 71 
71        | Eigen3x3        | Eigen3x3
72        | Zero of ty        | Zero of ty
73        | TensorSlice of ty * mask        | TensorSlice of ty * mask
74        | TensorIndex of ty        | TensorIndex of ty * shape
75        | Select of ty * int        | Select of ty * int
76        | Subscript of ty        | Subscript of ty
77        | MkDynamic of ty * int        | MkDynamic of ty * int
# Line 184  Line 187 
187        | arity Eigen3x3 = 1        | arity Eigen3x3 = 1
188        | arity (Zero _) = 0        | arity (Zero _) = 0
189        | arity (TensorSlice _) = 1        | arity (TensorSlice _) = 1
190        | arity (TensorIndex _) = ~1        | arity (TensorIndex _) = 1
191        | arity (Select _) = 1        | arity (Select _) = 1
192        | arity (Subscript _) = 2        | arity (Subscript _) = 2
193        | arity (MkDynamic _) = 1        | arity (MkDynamic _) = 1
# Line 249  Line 252 
252        | same (Eigen3x3, Eigen3x3) = true        | same (Eigen3x3, Eigen3x3) = true
253        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
254        | same (TensorSlice(a0,a1), TensorSlice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)        | same (TensorSlice(a0,a1), TensorSlice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)
255        | same (TensorIndex(a0), TensorIndex(b0)) = samety(a0, b0)        | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)
256        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
257        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
258        | same (MkDynamic(a0,a1), MkDynamic(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (MkDynamic(a0,a1), MkDynamic(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
# Line 308  Line 311 
311        | hash Eigen3x3 = 0w79        | hash Eigen3x3 = 0w79
312        | hash (Zero(a0)) = 0w83 + hashty a0        | hash (Zero(a0)) = 0w83 + hashty a0
313        | hash (TensorSlice(a0,a1)) = 0w89 + hashty a0 + hashmask a1        | hash (TensorSlice(a0,a1)) = 0w89 + hashty a0 + hashmask a1
314        | hash (TensorIndex(a0)) = 0w97 + hashty a0        | hash (TensorIndex(a0,a1)) = 0w97 + hashty a0 + hashshape a1
315        | hash (Select(a0,a1)) = 0w101 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w101 + hashty a0 + hashint a1
316        | hash (Subscript(a0)) = 0w103 + hashty a0        | hash (Subscript(a0)) = 0w103 + hashty a0
317        | hash (MkDynamic(a0,a1)) = 0w107 + hashty a0 + hashint a1        | hash (MkDynamic(a0,a1)) = 0w107 + hashty a0 + hashint a1
# Line 366  Line 369 
369        | toString Eigen3x3 = "Eigen3x3"        | toString Eigen3x3 = "Eigen3x3"
370        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
371        | toString (TensorSlice(a0,a1)) = concat["TensorSlice<", tyToString a0, ",", maskToString a1, ">"]        | toString (TensorSlice(a0,a1)) = concat["TensorSlice<", tyToString a0, ",", maskToString a1, ">"]
372        | toString (TensorIndex(a0)) = concat["TensorIndex<", tyToString a0, ">"]        | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", shapeToString a1, ">"]
373        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
374        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
375        | toString (MkDynamic(a0,a1)) = concat["MkDynamic<", tyToString a0, ",", intToString a1, ">"]        | toString (MkDynamic(a0,a1)) = concat["MkDynamic<", tyToString a0, ",", intToString a1, ">"]

Legend:
Removed from v.3796  
changed lines
  Added in v.3797

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