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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/mid-to-low/field-to-low.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/mid-to-low/field-to-low.sml

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

revision 3784, Wed Apr 27 18:13:26 2016 UTC revision 3790, Thu Apr 28 18:57:03 2016 UTC
# Line 102  Line 102 
102    
103      (* evaluate image expression *)      (* evaluate image expression *)
104      fun imgToargs(avail, mapp, sx, E.Img(Vid, alpha,  vs, s, _), args) = let      fun imgToargs(avail, mapp, sx, E.Img(Vid, alpha,  vs, s, _), args) = let
   
105          val vI =List.nth(args, Vid)          val vI =List.nth(args, Vid)
106          val s' = 2*s          val s' = 2*s
107          val jx = List.map (fn id => Mk.lookupMu(mapp, id)) alpha          val jx = List.map (fn id => Mk.lookupMu(mapp, id)) alpha
108    (* FIXME: 3-d case only*)
         (* 3-d case only*)  
109          val [_, _, _] = vs          val [_, _, _] = vs
110          fun f(0, _, rest) = rest          fun f(0, _, rest) = rest
111          | f (i, 0, rest) =  f(i-1, s', rest)          | f (i, 0, rest) =  f(i-1, s', rest)
112          | f (i, j, rest) = let          | f (i, j, rest) = let
113              val ix = jx@[i-1, j-1]              val ix = jx@[i-1, j-1]
            val _ =print("\n attempt"^ Int.toString(i)^"-"^Int.toString(j))  
114              val vA = Mk.tensorIndexIX (avail, mapp, vI,  ix)              val vA = Mk.tensorIndexIX (avail, mapp, vI,  ix)
         in f(i, j-1, vA::rest) end  
         val rtn = f(s', s', [])  
         val _ =print("create imgvars"^ Int.toString(length(rtn)))  
     (*  
     val imgArgs = EvalImg.expand{  
     avail = avail, mapp = mapp,  sx = sx, imgexp = E.Img e1, args = args  
     }  
     *)  
     in rtn end  
   
   
   
 (*  
   (* expand a MidIR probe to LowIR code. *)  
     fun expand {avail, mapp, sx, prod as E.Img e1::krnexps, args} = let  
         (* evaluate image expression *)  
           val imgArgs = EvalImg.expand{  
                   avail = avail, mapp = mapp,  sx = sx, imgexp = E.Img e1, args = args  
                 }  
         (* get piece for each kernel *)  
           fun getf (E.Krn(id, dels, _)) = let  
               (* evaluate dels to integer *)  
                 val delta = List.foldl (fn((i, j), y) => Mk.evalDelta(mapp, i, j) + y) 0 dels  
115                  in                  in
116                    getHolder (args, id, delta)  (* selects variable in holder/cons list *)                    f(i, j-1, vA::rest)
117                  end                  end
118          (* evaluate kernel expression(s) *)            val rtn = f (s', s', [])
           val krnArgs = List.map getf krnexps  (* doesn't create code *)  
119            in            in
120              prodImgKrn (avail, imgArgs, krnArgs, #4 e1)              rtn
121            end            end
122  *)  
123  (* expand a MidIR probe to LowIR code. *)  (* expand a MidIR probe to LowIR code. *)
124  fun expand {avail, mapp, sx, prod as E.Img e1::krnexps, args} = let  fun expand {avail, mapp, sx, prod as E.Img e1::krnexps, args} = let
125      val imgArgs = imgToargs(avail, mapp, sx, E.Img e1, args)      val imgArgs = imgToargs(avail, mapp, sx, E.Img e1, args)
# Line 159  Line 132 
132      end      end
133      (* evaluate kernel expression(s) *)      (* evaluate kernel expression(s) *)
134      val krnArgs = List.map getf krnexps  (* doesn't create code *)      val krnArgs = List.map getf krnexps  (* doesn't create code *)
    val  _ = print (String.concat["\n krnargs: ",Int.toString(length (krnArgs)), "imgargs:", Int.toString(length(imgArgs))])  
135      val rtn =   prodImgKrn (avail, imgArgs, krnArgs, #4 e1)      val rtn =   prodImgKrn (avail, imgArgs, krnArgs, #4 e1)
     val _ =print "\n done"  
136      in      in
137          rtn          rtn
138      end      end
139    
   
140    end    end

Legend:
Removed from v.3784  
changed lines
  Added in v.3790

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