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 4533, Wed Sep 7 08:34:09 2016 UTC revision 4534, Wed Sep 7 21:40:06 2016 UTC
# Line 141  Line 141 
141    (* `mkLdVoxel (avail, vI, vN, info, alpha, shape, dim, s, border)`    (* `mkLdVoxel (avail, vI, vN, info, alpha, shape, dim, s, border)`
142     *    creates load voxel operator to represent image addressing.  The parameters are     *    creates load voxel operator to represent image addressing.  The parameters are
143     *        avail       -- available assignments     *        avail       -- available assignments
144     *        vI          --     *        vI          -- image argument
145     *        vN          -- the integer indices into the image (IntTy for 1D, SeqTy for 2D+)     *        vN          -- the integer indices into the image (IntTy for 1D, SeqTy for 2D+)
146     *        info        -- image info     *        info        -- image info
147     *        alpha       --     *        alpha       -- ein variable indices that represent the shape of a tensor field
148     *        shape       --     *        shape       -- binding of alpha
149     *        dim         -- the dimension of the image     *        dim         -- the dimension of the image
150     *        s           -- half the support of the reconstruction kernel     *        s           -- half the support of the reconstruction kernel
151     *        border      -- optional border control     *        border      -- optional border control
# Line 258  Line 258 
258              formBody(E.Sum(sx, E.Opn(E.Prod, exp)))              formBody(E.Sum(sx, E.Opn(E.Prod, exp)))
259            end            end
260    
 (* FIXME: what is the transformation? *)  
261    (* arrangeBody - function changes the ordering of multiplication    (* arrangeBody - function changes the ordering of multiplication
262     * to match vis12 branch and pass regression tests     * to match vis12 branch and pass regression tests
263     *)     *)
# Line 301  Line 300 
300              AvailRHS.addAssignToList (avail, einapp)              AvailRHS.addAssignToList (avail, einapp)
301            end            end
302    
303      (* transform T*P*P..Ps *)      (* multply probe by transformation matrix and split product operation
304        input is a differentiated field of the form
305        eF = ∇_dx F_α
306        variable differentiation indices are transformed
307        (dx′,dx_tshape, Ps) = Transform(dx)
308        et is a tensor that represents probe
309        et =  T_tshape
310        tshape(e_F) = {α+dx_tshape}
311        multply probe (et) by transformation matrix (Ps)
312        eout = et *Ps
313        ein0 = λ(T,P)⟨eout⟩ij(Tx,P)
314        The next part of the compler reconstructs probed field ec to lower IR
315        ec = Clean(∇dx′Fα)−→∇dx′′Fα′′
316        Tx = λ(F,x)⟨ec(x)⟩ij(F,x)
317        *)
318      fun createEinApp (body, alpha, index, freshIndex, dim, dx, sx) = let      fun createEinApp (body, alpha, index, freshIndex, dim, dx, sx) = let
319            val Pid = 0            val Pid = 0
320            val tid = 1            val tid = 1
321            val (dx', tshape, newsx, Ps) = T.imageToWorld(freshIndex, dim, dx, Pid)            val (dx', dx_tshape, newsx, Ps) = T.imageToWorld(freshIndex, dim, dx, Pid)
322          (* need to rewrite dx *)          (* need to rewrite dx *)
323            val sxx = sx@newsx            val sxx = sx@newsx
324            val (_, sizes, E.Conv(_, alpha', _, dx)) = (case sxx            fun filterAlpha [] = []
325                | filterAlpha (E.C _::es) = filterAlpha es
326                | filterAlpha (e1::es) = e1::(filterAlpha es)
327              val tshape = (filterAlpha (alpha))@ dx_tshape
328              val et = E.Tensor(tid, tshape)
329              val (splitvar, eout) = arrangeBody(body, Ps, newsx, et)
330              val (_, sizes, ec) = (case sxx
331                   of [] => ([], index, E.Conv(0, alpha, 1, dx'))                   of [] => ([], index, E.Conv(0, alpha, 1, dx'))
332                    | _ => CleanIndex.clean(E.Conv(0, alpha, 1, dx'), index, sxx)                    | _ => CleanIndex.clean(E.Conv(0, alpha, 1, dx'), index, sxx)
333                  (* end case *))                  (* end case *))
           fun filterAlpha [] = (*dx'*) tshape  
             | filterAlpha (E.C _::es) = filterAlpha es  
             | filterAlpha (e1::es) = e1::(filterAlpha es)  
           val alpha3 = alpha (*alpha'*)  
           val exp = E.Tensor(tid, filterAlpha alpha3)  
           val (splitvar, body') = arrangeBody(body, Ps, newsx, exp)  
334            val params = [E.TEN(true, [dim,dim]), E.TEN(true, sizes)]            val params = [E.TEN(true, [dim,dim]), E.TEN(true, sizes)]
335            val ein0 = mkEin(params, index, body')            val ein0 = mkEin(params, index, eout)
336              (* clean index *)
337              val E.Conv(_, alpha', _, dx) = ec
338            in            in
339              (splitvar, ein0, sizes, dx, alpha')              (splitvar, ein0, sizes, dx, alpha')
340            end            end

Legend:
Removed from v.4533  
changed lines
  Added in v.4534

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