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

SCM Repository

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

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

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

revision 2611, Mon May 5 21:21:12 2014 UTC revision 2612, Wed May 7 02:58:55 2014 UTC
# Line 275  Line 275 
275      in (body',(params',args') ,code)      in (body',(params',args') ,code)
276      end      end
277    
278  (*Checks if vairable occurs just once. If it does then we can lift *)  (*Checks if (1) Summation variable occurs just once (2) it matches n.
279  fun checkSum([(E.V i,lb,ub)],E.Probe(E.Conv(V,alpha,h,dx), E.Tensor(id,beta)),info,index,origargs)=let  Then we lift otherwise expand in place *)
280    fun checkSum(sx,b,info,index,origargs)=(case sx
281        of [(E.V i,lb,ub)]=>  let
282            val E.Probe(E.Conv(V,alpha,h,dx), E.Tensor(id,beta))=b
283      val n=length(index)      val n=length(index)
284      val _=print "in check Sum\n "          val _=(case testing
285      val _=print(P.printbody(E.Sum([(E.V i,lb,ub)],E.Probe(E.Conv(V,alpha,h,dx),E.Tensor(id,beta)))))              of 1=> (print(String.concat["in check Sum\n " ,P.printbody(E.Sum([(E.V i,lb,ub)],b))]);1)
286                |_ => 1)
287      in      in
288       if (i=n) then (case F.findOcc(i,alpha@dx)              if (i=n) then (case F.countSx(sx,b)
289              of  1 => liftProbe(E.Probe(E.Conv(V,alpha,h,dx),E.Tensor(id,beta)),info,index@[ub], [],origargs)                  of (1,ixx) => liftProbe(b,info,index@[ub], [],origargs)
290              | _ =>  replaceProbe(E.Probe(E.Conv(V,alpha,h,dx),E.Tensor(id,beta)), info,index, [(E.V i,lb,ub)],origargs)                  | _ => replaceProbe(b, info,index,sx,origargs)
291              (*end case*))              (*end case*))
292      else replaceProbe(E.Probe(E.Conv(V,alpha,h,dx),E.Tensor(id,beta)), info,index, [(E.V i,lb,ub)],origargs)              else replaceProbe(b, info,index, sx,origargs)
293      end      end
294        | _ =>replaceProbe(b, info,index, sx,origargs)
295        (*end case*))
296    
297    
298  fun flatten []=[]  fun flatten []=[]
299      | flatten(e1::es)=e1@(flatten es)      | flatten(e1::es)=e1@(flatten es)

Legend:
Removed from v.2611  
changed lines
  Added in v.2612

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