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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-to-mid/ProbeEin.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/high-to-mid/ProbeEin.sml

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

revision 3173, Sun Mar 29 23:39:25 2015 UTC revision 3174, Mon Mar 30 11:46:58 2015 UTC
# Line 44  Line 44 
44      fun printEINAPP e=MidToString.printEINAPP e      fun printEINAPP e=MidToString.printEINAPP e
45      fun transformToIndexSpace e=T.transformToIndexSpace e      fun transformToIndexSpace e=T.transformToIndexSpace e
46      fun transformToImgSpace  e=T.transformToImgSpace  e      fun transformToImgSpace  e=T.transformToImgSpace  e
47         fun printEINAPP e=MidToString.printEINAPP e
48    
49      fun transitionToString(testreplace,a,b)=(case testreplace      fun transitionToString(testreplace,a,b)=(case testreplace
50          of 0=> 1          of 0=> 1
# Line 184  Line 185 
185          val originalb=Ein.body e          val originalb=Ein.body e
186          val params=Ein.params e          val params=Ein.params e
187          val index=Ein.index e          val index=Ein.index e
188            (*val _=print("\n"^P.printbody originalb)*)
189    
190          val E.Probe(E.Conv(Vid,alpha,hid,dx),E.Tensor(tid,_))=p          val E.Probe(E.Conv(Vid,alpha,hid,dx),E.Tensor(tid,_))=p
191          val fid=length(params)          val fid=length(params)
# Line 243  Line 244 
244          val originalb=Ein.body e          val originalb=Ein.body e
245          val params=Ein.params e          val params=Ein.params e
246          val index=Ein.index e          val index=Ein.index e
247            (*val _=print("\n"^P.printbody originalb)*)
248    
249          val E.Probe(E.Conv(Vid,alpha,hid,dx),E.Tensor(tid,_))=p          val E.Probe(E.Conv(Vid,alpha,hid,dx),E.Tensor(tid,_))=p
250          val fid=length(params)          val fid=length(params)
# Line 276  Line 278 
278      *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.
279      * Note how we keeps eps expressions so only generate pieces that are used      * Note how we keeps eps expressions so only generate pieces that are used
280      *)      *)
281      fun expandEinOp( e as (y, DstIL.EINAPP(ein,args))) = let  (*    fun expandEinOp( e as (y, DstIL.EINAPP(ein,args))) = let*)
282                fun expandEinOp( e as (y, DstIL.EINAPP(ein,args)),fieldset)=let
283    
284    
285          fun checkConst ([],a) = liftProbe a          fun checkConst ([],a) = liftProbe a
286          | checkConst ((E.C _::_),a) =replaceProbe a          | checkConst ((E.C _::_),a) =(("\n \n constant field"^(printEINAPP e));replaceProbe a)
287          | checkConst ((_ ::es),a)= checkConst(es,a)          | checkConst ((_ ::es),a)= checkConst(es,a)
288          fun rewriteBody b=(case b          fun rewriteBody b=(case b
289              of E.Probe(E.Conv(_,_,_,[]),_)              of E.Probe(E.Conv(_,_,_,[]),_)
# Line 301  Line 306 
306                  => replaceProbe(0,e,E.Probe p,sx)                  => replaceProbe(0,e,E.Probe p,sx)
307              | _ => [e]              | _ => [e]
308              (* end case *))              (* end case *))
309          in  
310              rewriteBody (Ein.body ein)          val (fieldset,var) = einSet.rtnVar(fieldset,y,DstIL.EINAPP(ein,args))
311            in  (case var
312            of NONE=> (("\n \n not replacing"^(printEINAPP e));(rewriteBody(Ein.body ein),fieldset))
313            | SOME v=> (("\n replacing"^(P.printerE ein));( [(y,DstIL.VAR v)] , fieldset))
314                (*end case*))
315    
316            (*val code=rewriteBody(Ein.body ein)
317            in (code,fieldset)*)
318          end          end
319    
320    end; (* local *)    end; (* local *)

Legend:
Removed from v.3173  
changed lines
  Added in v.3174

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