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 3581, Wed Jan 13 03:18:52 2016 UTC revision 3582, Wed Jan 13 22:14:05 2016 UTC
# Line 8  Line 8 
8    
9  structure ProbeEin : sig  structure ProbeEin : sig
10    
11    end = struct      val expand : MidIR.assign -> MidIR.assign list
12    
13      end = struct
14    
15      structure IR = MidIR      structure IR = MidIR
16      structure IROp = MidOps      structure Op = MidOps
17      structure V = IR.Var      structure V = IR.Var
18      structure Ty = MidTypes      structure Ty = MidTypes
19      structure E = Ein      structure E = Ein
# Line 48  Line 49 
49            (* end case *))            (* end case *))
50    
51      fun getImageDst (imgArg, args) = (case (getRHSDst imgArg)      fun getImageDst (imgArg, args) = (case (getRHSDst imgArg)
52          of (IROp.LoadImage(_, _,info),_) => info             of (Op.LoadImage(Ty.ImageTy info, _), _) => info
53          | (i,_) => raise Fail (String.concat[" Expected Image: ", IROp.toString i])  (* FIXME: also border control! *)
54                | (i, _) => raise Fail (String.concat[" Expected Image: ", Op.toString i])
55          (* end case *))          (* end case *))
56    
57      fun getKernelDst (hArg, args) = (case (getRHSDst hArg)      fun getKernelDst (hArg, args) = (case (getRHSDst hArg)
58          of (IROp.Kernel(h, _), _) => Kernel.support h             of (Op.Kernel(h, _), _) => Kernel.support h
59          | (k,_) => raise Fail (String.concat["Expected kernel: ", IROp.toString k])              | (k,_) => raise Fail (String.concat["Expected kernel: ", Op.toString k])
60          (* end case *))          (* end case *))
61    
62      (*handleArgs():int*int*int*Mid IR.Var list      (*handleArgs():int*int*int*Mid IR.Var list
# Line 198  Line 200 
200          val FArg = V.new ("T", Ty.TensorTy(sizes))          val FArg = V.new ("T", Ty.TensorTy(sizes))
201          val einApp0 = IR.EINAPP(ein0, [PArg,FArg])          val einApp0 = IR.EINAPP(ein0, [PArg,FArg])
202          val rtn0 = if(splitvar)          val rtn0 = if(splitvar)
203              then List.map (fn IR.ASSGN(e)=>e) (FloatEin.transform(y, EinSums.transform ein0, [PArg, FArg]))              then FloatEin.transform(y, EinSums.transform ein0, [PArg, FArg])
204              else [(y,IR.EINAPP(ein0, [PArg,FArg]))]              else [(y,IR.EINAPP(ein0, [PArg,FArg]))]
205    
206          (*reconstruct the lifted probe*)          (*reconstruct the lifted probe*)
# Line 217  Line 219 
219      * A this point we only have simple ein ops      * A this point we only have simple ein ops
220      * Looks to see if the expression has a probe. If so, replaces it.      * Looks to see if the expression has a probe. If so, replaces it.
221      *)      *)
222     fun expandEinOp (e as (_, IR.EINAPP(Ein.EIN{body, ...},_))) =      fun expand (e as (_, IR.EINAPP(Ein.EIN{body, ...}, _))) = (case body
223          (case body             of (E.Probe(E.Conv(_, _, _, []) ,_)) => replaceProbe(e, body, [])
224              of  (E.Probe(E.Conv(_,_,_,[]),_))              | (E.Probe(E.Conv(_, alpha, _, dx) ,_)) => liftProbe (e, body, []) (*scans dx for contant*)
225                 => replaceProbe(e, body, [])              | (E.Sum(sx, p as E.Probe(E.Conv(_, _, _, []), _))) => replaceProbe(e, p, sx)  (*no dx*)
226              | (E.Probe(E.Conv (_,alpha,_,dx),_))              | (E.Sum(sx, p as E.Probe(E.Conv(_, [], _, dx), _))) => liftProbe (e, p, sx) (*scalar field*)
227                 => liftProbe (e, body, []) (*scans dx for contant*)              | (E.Sum(sx, E.Probe p)) => replaceProbe(e, E.Probe p, sx)
228              | (E.Sum(sx,p as E.Probe(E.Conv(_,_,_,[]),_)))              | (E.Sum(sx, E.Opn(E.Prod, [eps, E.Probe p]))) => replaceProbe(e ,E.Probe p, sx)
                => replaceProbe(e, p, sx)  (*no dx*)  
             | (E.Sum(sx,p as E.Probe(E.Conv(_,[],_,dx),_)))  
                => liftProbe (e, p, sx) (*scalar field*)  
             | (E.Sum(sx,E.Probe p))  
                => replaceProbe(e, E.Probe p, sx)  
             | (E.Sum(sx,E.Opn(E.Prod, [eps,E.Probe p])))  
                => replaceProbe(e ,E.Probe p, sx)  
229              | _ => [e]              | _ => [e]
230          (* end case *))          (* end case *))
231    

Legend:
Removed from v.3581  
changed lines
  Added in v.3582

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