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-to-mid/split.sml
ViewVC logotype

Diff of /branches/charisee_dev/src/compiler/high-to-mid/split.sml

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

branches/charisee/src/compiler/high-to-mid/split.sml revision 3229, Thu Jul 30 16:10:54 2015 UTC branches/charisee_dev/src/compiler/high-to-mid/split.sml revision 3317, Sat Oct 17 02:36:54 2015 UTC
# Line 32  Line 32 
32    
33      in      in
34    
35      val numFlag=1   (*remove common subexpression*)      val numFlag=0   (*remove common subexpression*)
36      val testing=0      val testing=0
37      fun setEin(params,index,body)=Ein.EIN{params=params, index=index, body=body}      fun mkEin e = E.mkEin e
38      fun assignEinApp(y,params,index,body,args)= (y,DstIL.EINAPP(setEin(params,index,body),args))      val einappzero= DstIL.EINAPP(mkEin([],[],E.Const 0),[])
     val einappzero=DstIL.EINAPP(setEin([],[],E.Const 0),[])  
39      fun setEinZero y=  (y,einappzero)      fun setEinZero y=  (y,einappzero)
40      fun cleanParams e =cleanP.cleanParams e      fun cleanParams e =cleanP.cleanParams e
41      fun cleanIndex e =cleanI.cleanIndex e      fun cleanIndex e =cleanI.cleanIndex e
42      fun printEINAPP e=MidToString.printEINAPP e      fun toStringBind e= MidToString.toStringBind e
43      fun itos i =Int.toString i      fun itos i =Int.toString i
     fun filterSca e=Filter.filterSca e  
44      fun err str=raise Fail str      fun err str=raise Fail str
45      val cnt = ref 0      val cnt = ref 0
46      fun incUse (DstIL.V{useCnt, ...}) = (useCnt := !useCnt + 1)      fun incUse (DstIL.V{useCnt, ...}) = (useCnt := !useCnt + 1)
# Line 116  Line 114 
114          | _           => 2          | _           => 2
115      (*end case*))      (*end case*))
116    
   
   
117      fun rewriteOp3(name,sx,e1,x)=let      fun rewriteOp3(name,sx,e1,x)=let
118          val ((y, DstIL.EINAPP(ein,args)),fieldset,flag)=x          val ((y, DstIL.EINAPP(ein,args)),fieldset,flag)=x
119          val params=Ein.params ein          val params=Ein.params ein
# Line 138  Line 134 
134          | 2     => (e1,params,args,[],fieldset)             (*not lifted*)          | 2     => (e1,params,args,[],fieldset)             (*not lifted*)
135          (*end*))          (*end*))
136    
   
   
   
137      fun rewriteOps(name,list1,params,index,sx,args,fieldset0,flag)=let      fun rewriteOps(name,list1,params,index,sx,args,fieldset0,flag)=let
138          fun m([],rest,params,args,code,fieldset)=(rest,params,args,code,fieldset)          fun m([],rest,params,args,code,fieldset)=(rest,params,args,code,fieldset)
139          | m(e1::es,rest,params,args,code,fieldset)=let          | m(e1::es,rest,params,args,code,fieldset)=let
# Line 350  Line 343 
343              | E.Sum(sx,E.Tensor _)    => default              | E.Sum(sx,E.Tensor _)    => default
344              | E.Sum(sx,_)             => err(" summation not distributed:"^str)              | E.Sum(sx,_)             => err(" summation not distributed:"^str)
345              | E.Add e1                => handleAdd(y,e1,params,index,args,fieldset,flag)              | E.Add e1                => handleAdd(y,e1,params,index,args,fieldset,flag)
346                | E.Prod[E.Tensor(id0,[]),E.Tensor(id1,[i]),E.Tensor(id2,[])]=>
347                        rewrite (E.Prod[E.Prod[E.Tensor(id0,[]),E.Tensor(id2,[])],E.Tensor(id1,[i])])
348              | E.Prod e1               => handleProd(y,e1,params,index,args,fieldset,flag)              | E.Prod e1               => handleProd(y,e1,params,index,args,fieldset,flag)
349              | E.Partial _             => err(" Partial used after normalize")              | E.Partial _             => err(" Partial used after normalize")
350              | E.Krn _                 => err("Krn used before expand")              | E.Krn _                 => err("Krn used before expand")
# Line 382  Line 377 
377          | itercode(e1::newbies,rest,code,cnt)=let          | itercode(e1::newbies,rest,code,cnt)=let
378              val ((einapp3,code3),_) = split(e1,fieldset,numFlag)              val ((einapp3,code3),_) = split(e1,fieldset,numFlag)
379              val (rest4,code4)=itercode(code3,[],[],cnt+1)              val (rest4,code4)=itercode(code3,[],[],cnt+1)
380                  val _ =testp [printEINAPP(e1),"\n\t===>\n",printEINAPP(einapp3),"\nand\n",(String.concatWith",\n\t"(List.map printEINAPP (code4@rest4)))]                  val _ =testp [toStringBind(e1),"\n\t===>\n",toStringBind(einapp3),"\nand\n",(String.concatWith",\n\t"(List.map toStringBind (code4@rest4)))]
381              in              in
382                  itercode(newbies,rest@[einapp3],code4@( rest4)@code,cnt+2)                  itercode(newbies,rest@[einapp3],code4@( rest4)@code,cnt+2)
383              end              end
# Line 397  Line 392 
392          (* **** split in parts **** *)          (* **** split in parts **** *)
393          (*          (*
394          val ((einapp4,newbies4),fieldset)=split(einapp3,fieldset,0)          val ((einapp4,newbies4),fieldset)=split(einapp3,fieldset,0)
395          val _ =testp["\n\t===>\n",printEINAPP(einapp4),"\nand\n",(String.concatWith",\n\t"(List.map printEINAPP newbies4))]          val _ =testp["\n\t===>\n",toStringBind(einapp4),"\nand\n",(String.concatWith",\n\t"(List.map toStringBind newbies4))]
396          val (newbies5)= iterMultiple(einapp4,newbies4,fieldset)          val (newbies5)= iterMultiple(einapp4,newbies4,fieldset)
397          *)          *)
398    

Legend:
Removed from v.3229  
changed lines
  Added in v.3317

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