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 2529, Wed Jan 29 06:58:55 2014 UTC revision 2530, Wed Jan 29 20:58:31 2014 UTC
# Line 82  Line 82 
82  fun ccons(rest,shape)= let  fun ccons(rest,shape)= let
83      val(vE,E)=genHelper.aaV(DstOp.cons(DstTy.TensorTy shape),rest,"Cons",DstTy.TensorTy(shape))      val(vE,E)=genHelper.aaV(DstOp.cons(DstTy.TensorTy shape),rest,"Cons",DstTy.TensorTy(shape))
84      in (vE,E) end      in (vE,E) end
85    fun printMap ix=String.concat(List.map (fn e1=>Int.toString(e1)) ix)
86    
87    
88  (*Images*)  (*Images*)
# Line 96  Line 97 
97      val sx''=List.map (fn n=>n+1) sx'      val sx''=List.map (fn n=>n+1) sx'
98      val argType=DstTy.tensorTy (List.tabulate(dim, fn _ =>R))      val argType=DstTy.tensorTy (List.tabulate(dim, fn _ =>R))
99    
100      fun printMap ix=String.concat(List.map (fn e1=>Int.toString(e1)) ix)  
101      fun  createImgVar mapp=let      fun  createImgVar mapp=let
102          fun mkpos([E.Add[E.Tensor(t1,ix1),_]],rest,code)= let          fun mkpos([E.Add[E.Tensor(t1,ix1),_]],rest,code)= let
103              val (vA,A)=genHelper.mkSca(mapp,(t1,ix1,args))              val (vA,A)=genHelper.mkSca(mapp,(t1,ix1,args))
# Line 111  Line 112 
112              end              end
113          val ix1=List.map (fn (e1)=> genHelper.mapIndex(e1,mapp)) ix          val ix1=List.map (fn (e1)=> genHelper.mapIndex(e1,mapp)) ix
114          val (vF,F)= mkpos(px,[],[])          val (vF,F)= mkpos(px,[],[])
115          val imgType=DstTy.tensorTy ix1          val imgType=DstTy.imgIndex ix1
116          val (vA,A)=genHelper.aaV(DstOp.imgAddr(imgType,dim),vF,"Imageaddress",DstTy.intTy)          val (vA,A)=genHelper.aaV(DstOp.imgAddr(imgType,dim),vF,"Imageaddress",DstTy.intTy)
117          val (vB,B)=genHelper.aaV(DstOp.imgLoad(dim,R),[vA],"imgLoad"^(printMap mapp)^"---",DstTy.tensorTy([R]))          val (vB,B)=genHelper.aaV(DstOp.imgLoad(dim,R),[vA],"imgLoad"^(printMap mapp)^"---",DstTy.tensorTy([R]))
118          in          in
# Line 144  Line 145 
145    
146  (* kernels*)  (* kernels*)
147  fun  mkkrns(a,sx,k1,h,args)=let  fun  mkkrns(a,sx,k1,h,args)=let
148      val ll=print("\n\n\n Krn Code \n\n")      val ll=print("\n\n\n Kernel code \n ")
149    
150      val k= List.map (fn (id,d1,pos)=>(id,genHelper.evalDelta(d1,a),pos)) k1      val k= List.map (fn (id,d1,pos)=>(id,genHelper.evalDelta(d1,a),pos)) k1
151        val tester=print "Differentiaiton value of kernels:"
152      val uu=List.map (fn(id,v, pos)=> print(Int.toString(v)))  k      val uu=List.map (fn(id,v, pos)=> print(Int.toString(v)))  k
153    
154      fun q([],fin,l,_,_,_,code)=(fin,code)      fun q([],fin,l,_,_,_,code)=(fin,code)
# Line 202  Line 204 
204      in (case krnArg      in (case krnArg
205          of [hy,hx]=>let          of [hy,hx]=>let
206              val ty=DstTy.TensorTy[R]              val ty=DstTy.TensorTy[R]
207              val (vD,code)=dhy(imgArg,[],[],ty,hy)              val (vD,code)=dhy(imgArg,[],[],hy)
208              val (vE,E)=sumP(vD,hx,R)              val (vE,E)=sumP(vD,hx,R)
209              in              in
210                  (vE,code@E)                  (vE,code@E)
# Line 221  Line 223 
223      end      end
224    
225  fun  evalField(a,(E.Sum(sx,E.Prod e),h,args))=let  fun  evalField(a,(E.Sum(sx,E.Prod e),h,args))=let
226      val ar=print "\n\n ************** new direction **********\n\n"      val ar=print "\n\n ************** new direction **********\n\n Outer Bound:"
227        val tester=print(printMap a)
228    
229      val (img1,k1)=sortK([],[],e)      val (img1,k1)=sortK([],[],e)
230      val (_,lb,ub)=hd(sx)      val (_,lb,ub)=hd(sx)
231      val R=(ub-lb)+1      val R=(ub-lb)+1

Legend:
Removed from v.2529  
changed lines
  Added in v.2530

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