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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-to-mid/splitEin.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/high-to-mid/splitEin.sml

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

revision 2826, Mon Nov 10 21:06:46 2014 UTC revision 2827, Tue Nov 11 00:18:38 2014 UTC
# Line 15  Line 15 
15    
16  val testing=0  val testing=0
17    
18    fun testp n =(case testing
19        of 0=> 1
20        | _ => (print(String.concat n);1)
21    (*end case*))
22    
23  fun printA(id,e,arg)=let  fun printA(id,e,arg)=let
24      val a=String.concatWith " , " (List.map Var.toString arg)      val a=String.concatWith " , " (List.map Var.toString arg)
25      in      in
# Line 31  Line 36 
36  fun createEin( params,index, body)=Ein.EIN{params=params, index=index, body=body}  fun createEin( params,index, body)=Ein.EIN{params=params, index=index, body=body}
37  fun flat xs = List.foldr op@ [] xs  fun flat xs = List.foldr op@ [] xs
38  val counter=ref 0  val counter=ref 0
39  fun printINT L= List.map (fn e1=>Int.toString(e1)^",") L  
40    
41  (*How to create new ein variable*)  (*How to create new ein variable*)
42  fun fresh ty=let  fun fresh ty=let
# Line 40  Line 45 
45      val Q="Q" ^ Int.toString(m)      val Q="Q" ^ Int.toString(m)
46      val x=DstIL.Var.new(Q ,ty)      val x=DstIL.Var.new(Q ,ty)
47      val DstTy.TensorTy ty1=ty      val DstTy.TensorTy ty1=ty
     val _ =(case testing of 0 => 1  
         | _ => (print(String.concat(["\n Tensor[ "]@printINT(ty1)@["]  ",Q,"\n"]));1))  
48      in      in
49          (counter:=m;x)          (counter:=m;x)
50      end      end
# Line 244  Line 247 
247      end      end
248    
249  fun splitein(id,E.EIN{params,index,body},arg)=let  fun splitein(id,E.EIN{params,index,body},arg)=let
250      val _=(case testing      val _=testp ["\n Pre Shift \n", printA(id,E.EIN{params=params,index=index,body=body},arg)]
         of 0 => 1  
         | _ =>  (print(String.concat["\n Pre Shift \n", printA(id,E.EIN{params=params,index=index,body=body},arg)]);1)  
         (*end case *))  
   
251      val (p',i',b',args')=shift.clean(params, index, body, arg)      val (p',i',b',args')=shift.clean(params, index, body, arg)
252      val einn'=createEin(p',i', b')      val einn'=createEin(p',i', b')
253      val _ = (case testing      val _ = testp["\n Post shift-\n ",printA(id,einn',args'),"\n"]
         of 0 => 1  
         | _ =>  (print(String.concat["\n Post shift-\n ",printA(id,einn',args'),"\n \n"]);1)  
         (*end case *))  
254      in      in
255          splitIt(0,(id,einn',args'))          splitIt(0,(id,einn',args'))
256      end      end

Legend:
Removed from v.2826  
changed lines
  Added in v.2827

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