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/gen-kernel.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/gen-kernel.sml

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

revision 2604, Fri Apr 25 18:23:44 2014 UTC revision 2605, Wed Apr 30 01:46:09 2014 UTC
# Line 30  Line 30 
30    
31  val empty =fn key =>NONE  val empty =fn key =>NONE
32    
33    val testing=1
34  (*Add,Subtract Scalars*)  (*Add,Subtract Scalars*)
35  fun mkSimpleOp(mapp,e,args)=let  fun mkSimpleOp(mapp,e,args)=let
36    
# Line 74  Line 75 
75    
76    
77    
 fun printgetRHS x  = (case SrcIL.Var.binding x  
     of SrcIL.VB_RHS(SrcIL.OP(SrcOp.Kernel(h, _),_))=> h  
     | vb => (raise Fail (String.concat["\n -- ", SrcIL.Var.toString x,"but found ", SrcIL.vbToString vb,"\n"]))  
 (* end case *))  
   
   
78  val bV= ref 0  val bV= ref 0
79    
80    
# Line 99  Line 94 
94  (*Images*)  (*Images*)
95  fun mkImg(mappOrig,sx,[(fid,ix,px)],v,args)=let  fun mkImg(mappOrig,sx,[(fid,ix,px)],v,args)=let
96    
     val ll=print("\n\n\n image \n\n")  
97      val (E.V vid,lb,ub)=hd(sx)      val (E.V vid,lb,ub)=hd(sx)
98      val top=ub-lb      val top=ub-lb
99      val R=top+1      val R=top+1
# Line 156  Line 150 
150    
151    
152      val(lft,code)=sumI1([],mappOrig,top,dim-2,[],vid)      val(lft,code)=sumI1([],mappOrig,top,dim-2,[],vid)
153      val g=print ("Number of Assignments returned"^Int.toString(length(lft)))  
154      in      in
155          (lft,BB@code)          (lft,BB@code)
156    
# Line 166  Line 160 
160  (* kernels*)  (* kernels*)
161    
162  fun  mkkrns2(mappOrig,sx,k1,h,args)=let  fun  mkkrns2(mappOrig,sx,k1,h,args)=let
163      val r= print("\n\n\n Kernel code \n  outer Index")  
    val mm= gHelper.printIndexXX(0,mappOrig)  
164    
165      val k= List.map (fn (id,d1,pos)=>(id,gHelper.evalDelta(d1,mappOrig),pos)) k1      val k= List.map (fn (id,d1,pos)=>(id,gHelper.evalDelta(d1,mappOrig),pos)) k1
166      val tester=print "Differentiation value of kernels:"  
     val uu=List.map (fn(id,v, pos)=> print(Int.toString(v)))  k  
167    
168      val (E.V sid,lb,ub)=hd(sx)      val (E.V sid,lb,ub)=hd(sx)
169      val R=(ub-lb)      val R=(ub-lb)
170      val R'=R+1      val R'=R+1
171    
172      fun mm(e)=Int.toString e      fun mm(e)=Int.toString e
173      val qq=print(String.concat["\n ub:", mm ub, "lb:", mm lb, "Range", mm R ])  
174        val _ =(case testing
175            of 1=> let
176                val _ =print "Differentiation value of kernels:"
177                val _= List.map (fn(id,v, pos)=> print(Int.toString(v)))  k
178                val _ =print(String.concat["\n ub:", mm ub, "lb:", mm lb, "Range", mm R ])
179                in 1 end
180            | _ => 1)
181    
182    
183      fun q([],fin,l,ix, i,code,n')=(fin,code)      fun q([],fin,l,ix, i,code,n')=(fin,code)
184          | q((id1,d,pos1)::ks,fin,l,ix,0,code,n')=let          | q((id1,d,pos1)::ks,fin,l,ix,0,code,n')=let
# Line 199  Line 199 
199      val(lftkrn,code)=q(k,[],[],mappOrig,R,[],sid)      val(lftkrn,code)=q(k,[],[],mappOrig,R,[],sid)
200      val (lft,code')=consfn((lftkrn),[],[],R,0)      val (lft,code')=consfn((lftkrn),[],[],R,0)
201    
202      (*evalKernel-comment this part out to simplify code generated*)  
     val t=print "\n Eval Kernel \n"  
203    
204      fun evalK([],[],n,code,newId)=(newId,code)      fun evalK([],[],n,code,newId)=(newId,code)
205      | evalK(kn::kns,x::xs,n,code,newId)=let      | evalK(kn::kns,x::xs,n,code,newId)=let
# Line 218  Line 217 
217    
218  (*Written for 2-d and 3-d*)  (*Written for 2-d and 3-d*)
219  fun prodImgKrn(imgArg,krnArg,R)=let  fun prodImgKrn(imgArg,krnArg,R)=let
220      val ll=print("\n\n prod Img Krn Code \n")  
221    
222      val tyM=DstTy.TensorTy[R,R]      val tyM=DstTy.TensorTy[R,R]
223      val tyV=DstTy.TensorTy[R]      val tyV=DstTy.TensorTy[R]
224          val g=print ("Number of Assignments  in prodImgArg returned"^Int.toString(length(imgArg)))      val _=(case testing of 0=> 1
225            | _ =>(print ("Number of Assignments  in prodImgArg returned"^Int.toString(length(imgArg)));1))
226    
227      fun dhz([],conslist,rest,code,_,_)=(conslist,code)      fun dhz([],conslist,rest,code,_,_)=(conslist,code)
228      | dhz(e::es,conslist,rest,code,hz,0)=let      | dhz(e::es,conslist,rest,code,hz,0)=let
# Line 273  Line 273 
273      end      end
274    
275  fun  evalField(mapp,(E.Sum(sx,E.Prod e),v,h,args))=let  fun  evalField(mapp,(E.Sum(sx,E.Prod e),v,h,args))=let
276      val ar=print "\n\n ************** new direction **********\n\n Outer Bound:"      val _=(case testing
277            of 0 => 1
278            | _ => (print "\n\n ************** new direction **********\n\n Outer Bound:";1)
279            (*end test*))
280    
281    
282      val (img1,k1)=sortK([],[],e)      val (img1,k1)=sortK([],[],e)

Legend:
Removed from v.2604  
changed lines
  Added in v.2605

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