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

SCM Repository

[diderot] Diff of /branches/charisee_dev/src/compiler/high-il/normalize-ein.sml
ViewVC logotype

Diff of /branches/charisee_dev/src/compiler/high-il/normalize-ein.sml

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

revision 2856, Thu Jan 15 01:42:24 2015 UTC revision 2867, Tue Feb 10 06:52:58 2015 UTC
# Line 56  Line 56 
56          | E.Add e     => (1,E.Add (List.map (fn(a)=>E.Sum(c1,a)) e))          | E.Add e     => (1,E.Add (List.map (fn(a)=>E.Sum(c1,a)) e))
57          | E.Div (a,b) => (1,E.Div(E.Sum(c1,a),E.Sum(c1,b)))          | E.Div (a,b) => (1,E.Div(E.Sum(c1,a),E.Sum(c1,b)))
58          | E.Lift e    => (1,E.Lift(E.Sum(c1,e)))          | E.Lift e    => (1,E.Lift(E.Sum(c1,e)))
59            | E.Sqrt e    => (1,E.Sqrt(E.Sum(c1,e)))
60          | E.Sum(c2,e2)=> (1,E.Sum(c1@c2,e2))          | E.Sum(c2,e2)=> (1,E.Sum(c1@c2,e2))
61          | E.Prod p    => filterSca(c1,p)          | E.Prod p    => filterSca(c1,p)
62          | E.Const 0   => (1,E.Const 0) (*expression could have been changed to 0*)          | E.Const 0   => (1,E.Const 0) (*expression could have been changed to 0*)
# Line 71  Line 72 
72      *)      *)
73      fun mkapply(d1,e1)=(case e1      fun mkapply(d1,e1)=(case e1
74          of E.Lift e   => (1,E.Const 0)          of E.Lift e   => (1,E.Const 0)
75            | E.Sqrt e   =>  (1,E.Prod[ E.Div(E.Const 1 ,E.Prod[E.Const 2, e1]), E.Apply( d1,e)])
76          | E.Prod []   => err("Apply of empty product")          | E.Prod []   => err("Apply of empty product")
77          | E.Add []    => err("Apply of empty Addition")          | E.Add []    => err("Apply of empty Addition")
78          | E.Conv(v, alpha, h, d2)    =>let          | E.Conv(v, alpha, h, d2)    =>let
# Line 122  Line 124 
124      *)      *)
125      fun mkprobe(e1,x)=(case e1      fun mkprobe(e1,x)=(case e1
126          of E.Lift e   => (1,e)          of E.Lift e   => (1,e)
127            | E.Sqrt a    => (1,E.Sqrt(E.Probe(a,x)))
128          | E.Prod []   => err("Probe of empty product")          | E.Prod []   => err("Probe of empty product")
129          | E.Prod p    => (1,E.Prod (List.map (fn(a)=>E.Probe(a,x)) p))          | E.Prod p    => (1,E.Prod (List.map (fn(a)=>E.Probe(a,x)) p))
130          | E.Apply _   => (0,E.Probe(e1,x))          | E.Apply _   => (0,E.Probe(e1,x))
# Line 130  Line 133 
133          | E.Sum(c,e') => (1,E.Sum(c,E.Probe(e',x)))          | E.Sum(c,e') => (1,E.Sum(c,E.Probe(e',x)))
134          | E.Add e     => (1,E.Add (List.map (fn(a)=>E.Probe(a,x)) e))          | E.Add e     => (1,E.Add (List.map (fn(a)=>E.Probe(a,x)) e))
135          | E.Sub (a,b) => (1,E.Sub(E.Probe(a,x),E.Probe(b,x)))          | E.Sub (a,b) => (1,E.Sub(E.Probe(a,x),E.Probe(b,x)))
136          | E.Neg e'    => (1,E.Neg(E.Probe(e',x)))          | E.Neg a    => (1,E.Neg(E.Probe(a,x)))
137          | E.Div (a,b) => (1,E.Div(E.Probe(a,x),E.Probe(b,x)))          | E.Div (a,b) => (1,E.Div(E.Probe(a,x),E.Probe(b,x)))
138          | E.Const _   => (1,e1)(*err("Const without Lift")*)          | E.Const _   => (1,e1)(*err("Const without Lift")*)
139          | E.Tensor _  => err("Tensor without Lift")          | E.Tensor _  => err("Tensor without Lift")
# Line 166  Line 169 
169          | E.Neg(E.Neg e)    => rewriteBody e          | E.Neg(E.Neg e)    => rewriteBody e
170          | E.Neg e           => E.Neg(rewriteBody e)          | E.Neg e           => E.Neg(rewriteBody e)
171          | E.Lift e          => E.Lift(rewriteBody e)          | E.Lift e          => E.Lift(rewriteBody e)
172            | E.Sqrt e          => E.Sqrt(rewriteBody e)
173          | E.Add es          => let          | E.Add es          => let
174              val (change,body')= mkAdd(List.map rewriteBody es)              val (change,body')= mkAdd(List.map rewriteBody es)
175              in if (change=1) then ( changed:=true;body') else body' end              in if (change=1) then ( changed:=true;body') else body' end
# Line 330  Line 334 
334      val (b,count) = loop(body,0)      val (b,count) = loop(body,0)
335      val _ =testp["\n Out of normalize \n",P.printbody(b),      val _ =testp["\n Out of normalize \n",P.printbody(b),
336          "\n    Final CounterXX:",Int.toString(count),"\n\n"]          "\n    Final CounterXX:",Int.toString(count),"\n\n"]
        val xx =G.reduceDelta([],[E.Delta(E.V 2,E.V 1),E.Delta(E.V 3,E.V 0)],[E.Conv(0,[E.V 1,E.V 3],1,[E.V 0])])  
337      in      in
338          (Ein.EIN{params=params, index=index, body=b},count)          (Ein.EIN{params=params, index=index, body=b},count)
339      end      end

Legend:
Removed from v.2856  
changed lines
  Added in v.2867

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