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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-to-mid/probe-ein.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-to-mid/probe-ein.sml

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

revision 4290, Wed Jul 27 19:11:47 2016 UTC revision 4291, Wed Jul 27 20:39:06 2016 UTC
# Line 175  Line 175 
175                    end                    end
176          (* image positions *)          (* image positions *)
177            val s'= 2*s            val s'= 2*s
178            (* DEBUG
179             fun f es =String.concatWith"," (List.map (fn e => Int.toString(e)) es)
180             fun g es =String.concatWith"," (List.map (fn (E.V e) => "v"^Int.toString(e)  | E.C(c) => "c"^Int.toString(c)) es)
181            *)
182            val supportshape = List.tabulate (dim, fn _ => s')            val supportshape = List.tabulate (dim, fn _ => s')
183            val ldty = Ty.TensorTy(shape @ supportshape)            val ldty = Ty.TensorTy(shape @ supportshape)
184              (* DEBUG val _ = print(String.concat["\n","look here inside load voxel = ",  " shape = ", f shape, " dim:", f([dim])," supportshape: ", f(supportshape)," alpha: ", g alpha  ])
185              *)
186            val op1 = (case border            val op1 = (case border
187                   of NONE => Op.LoadVoxels (info, s')                   of NONE => Op.LoadVoxels (info, s')
188                    | SOME b => Op.LoadVoxelsWithCtl (info, s', b)                    | SOME b => Op.LoadVoxelsWithCtl (info, s', b)
# Line 197  Line 203 
203            val imgexp = E.Img(Vidnew, alpha, List.map (fn i=> E.Value i)  vs, s, E.None)            val imgexp = E.Img(Vidnew, alpha, List.map (fn i=> E.Value i)  vs, s, E.None)
204          (* create load voxel operator for image *)          (* create load voxel operator for image *)
205            val vLd = mkLdVoxel (avail, vI, vN, info, alpha, shape, dim, s, border)            val vLd = mkLdVoxel (avail, vI, vN, info, alpha, shape, dim, s, border)
206            (* DEBUG
207              fun f es =String.concatWith"," (List.map (fn e => Int.toString(e)) es)
208              fun g es =String.concatWith"," (List.map (fn (E.V e) => "v"^Int.toString(e)  | E.C(c) => "c"^Int.toString(c)) es)
209              val Ty.TensorTy(cat) = V.ty(vLd)
210              val _ = print(String.concat["\n","after load voxel ", f cat, " = ", V.name(vLd), " alpha = ", g alpha, " dim:", f([dim])," support: ", f([s])])
211            *)
212    
213          (* create kernel body *)          (* create kernel body *)
214            fun createKrn (0,  krnexp, vAs) = (krnexp, vAs)            fun createKrn (0,  krnexp, vAs) = (krnexp, vAs)
215              | createKrn (dir, krnexp, vAs) = let              | createKrn (dir, krnexp, vAs) = let
# Line 263  Line 276 
276      *)      *)
277      fun replaceProbe (avail, (y, IR.EINAPP(Ein.EIN{params, index, body}, args)), probe, sx) = let      fun replaceProbe (avail, (y, IR.EINAPP(Ein.EIN{params, index, body}, args)), probe, sx) = let
278          (* tensor ids for position, transform matrix P, and kernel terms*)          (* tensor ids for position, transform matrix P, and kernel terms*)
279    
280            val pid = length params            val pid = length params
281            val Vidnew = pid+1            val Vidnew = pid+1
282            val kid = Vidnew            val kid = Vidnew
# Line 310  Line 324 
324    
325    (* floats the reconstructed field term *)    (* floats the reconstructed field term *)
326      fun liftProbe (avail, (y, IR.EINAPP(Ein.EIN{params, index, body}, args)), probe, sx) = let      fun liftProbe (avail, (y, IR.EINAPP(Ein.EIN{params, index, body}, args)), probe, sx) = let
327    
328            val E.Probe(E.Conv(Vid, alpha, hid, dx), E.Tensor(tid, _)) = probe            val E.Probe(E.Conv(Vid, alpha, hid, dx), E.Tensor(tid, _)) = probe
329            val freshIndex = getsumshift(sx, length(index))            val freshIndex = getsumshift(sx, length(index))
330            val E.IMG(dim, shape) = List.nth(params, Vid)            val E.IMG(dim, shape) = List.nth(params, Vid)
# Line 323  Line 338 
338            val params' = List.nth(params,Vid)::(List.tabulate(dim,fn _=> E.KRN))            val params' = List.nth(params,Vid)::(List.tabulate(dim,fn _=> E.KRN))
339          (* create body for ein expression *)          (* create body for ein expression *)
340            val sxn = length sizes (*next available index id *)            val sxn = length sizes (*next available index id *)
341              val Vidnew = 0
342            val (args', vP, probe') =            val (args', vP, probe') =
343                  fieldReconstruction (avail, sxn, alpha', shape, dx,  Vid, Vid, kid, hid, tid, args)                  fieldReconstruction (avail, sxn, alpha', shape, dx,  Vid, Vidnew, kid, hid, tid, args)
344            val einApp1 = IR.EINAPP(mkEin(params', sizes, probe'), args')            val einApp1 = IR.EINAPP(mkEin(params', sizes, probe'), args')
345            val einr= mkEin(params', sizes, probe')            val einr= mkEin(params', sizes, probe')
346    
347          (* transform T*P*P..Ps *)          (* transform T*P*P..Ps *)
348            val rtn0 = if splitvar            val rtn0 = if splitvar
349                  then FloatEin.transform(y, EinSums.transform ein0, [vP, vT])                  then FloatEin.transform(y, EinSums.transform ein0, [vP, vT])

Legend:
Removed from v.4290  
changed lines
  Added in v.4291

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