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

SCM Repository

[diderot] Diff of /trunk/src/compiler/high-to-mid/probe.sml
ViewVC logotype

Diff of /trunk/src/compiler/high-to-mid/probe.sml

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

revision 1392, Mon Jun 27 02:53:44 2011 UTC revision 1393, Mon Jun 27 02:58:00 2011 UTC
# Line 60  Line 60 
60                  in                  in
61                    mkVar (0, l, [])                    mkVar (0, l, [])
62                  end                  end
 val _ = Log.msg(concat["probeElem: ", Partials.partialToString pdOp, " in ", Int.toString(List.length convCoeffs), "D space\n"])  
63          (* for each dimension in space, we evaluate the kernel at the coordinates for that axis.          (* for each dimension in space, we evaluate the kernel at the coordinates for that axis.
64           * the coefficients are           * the coefficients are
65           *      h_{s-i} (f - i) for 1-s <= i <= s           *      h_{s-i} (f - i) for 1-s <= i <= s
# Line 137  Line 136 
136                  in                  in
137                    IT.create (dim-1, 2*s, fn _ => (), f, g, ([], []))                    IT.create (dim-1, 2*s, fn _ => (), f, g, ([], []))
138                  end                  end
 val _ = let  
 val indentWid = ref 2  
 fun inc () = (indentWid := !indentWid + 2)  
 fun dec () = (indentWid := !indentWid - 2)  
 fun indent () = Log.msg(CharVector.tabulate(!indentWid, fn _ => #" "))  
 fun nd () = (indent(); Log.msg "ND\n");  
 fun lf {offsets, vox} = (  
       indent(); Log.msg "LF{offsets = ["; Log.msg(String.concatWith "," (List.map Int.toString offsets));  
       Log.msg "], vox = "; Log.msg(DstV.toString vox); Log.msg "}\n")  
 fun pr (Shape.ND(attr, kids)) = (nd attr; inc(); List.app pr kids; dec())  
   | pr (Shape.LF attr) = lf attr  
 in  
   Log.msg "voxIter:\n";  
   pr voxIter  
 end  
139            val loadCode = let            val loadCode = let
140                  fun genCode ({offsets, vox}, code) = let                  fun genCode ({offsets, vox}, code) = let
141                        fun computeIndices (_, []) = ([], [])                        fun computeIndices (_, []) = ([], [])
# Line 240  Line 224 
224          (* generate the shape of the differentiation tensor with variables representing          (* generate the shape of the differentiation tensor with variables representing
225           * the elements           * the elements
226           *)           *)
227            val diffIter = let            fun diffIter () = let
228                  val partial = Partials.partial dim                  val partial = Partials.partial dim
229                  fun f (i, (_::dd, axes)) = (dd, Partials.axis i :: axes)                  fun f (i, (_::dd, axes)) = (dd, Partials.axis i :: axes)
230                  fun labelNd (_::dd, _) = DstTy.tensorTy dd                  fun labelNd (_::dd, _) = DstTy.tensorTy dd
# Line 254  Line 238 
238                  in                  in
239                    IT.create (k, dim, labelNd, f, labelLf, (List.tabulate(k, fn _ => dim), []))                    IT.create (k, dim, labelNd, f, labelLf, (List.tabulate(k, fn _ => dim), []))
240                  end                  end
 val _ = let  
 val indentWid = ref 2  
 fun inc () = (indentWid := !indentWid + 2)  
 fun dec () = (indentWid := !indentWid - 2)  
 fun indent () = Log.msg(CharVector.tabulate(!indentWid, fn _ => #" "))  
 fun nd ty = (indent(); Log.msg(concat["ND(", DstTy.toString ty, ")\n"]))  
 fun lf (x, partial) = (  
       indent(); Log.msg(concat["LF(", DstV.toString x, ", ", Partials.partialToString partial, ")\n"]))  
 fun pr (Shape.ND(attr, kids)) = (nd attr; inc(); List.app pr kids; dec())  
   | pr (Shape.LF attr) = lf attr  
 in  
   Log.msg "diffIter:\n";  
   pr diffIter  
 end  
241            val vars = {h=h, n=n, f=f, img=img}            val vars = {h=h, n=n, f=f, img=img}
242            in            in
243              case ImageInfo.voxelShape v              case ImageInfo.voxelShape v
244               of [] => toImgSpaceCode @ doVoxelSample (result, v, k, s, diffIter, vars, 0)               of [] => toImgSpaceCode @ doVoxelSample (result, v, k, s, diffIter(), vars, 0)
245                | [d] => let                | [d] => let
246                      val sampleTy = DstTy.TensorTy(List.tabulate(k, fn _ => d))
247                    fun doSamples (offset, xs, code) = if (offset < 0)                    fun doSamples (offset, xs, code) = if (offset < 0)
248                          then code @ [cons(result, xs)]                          then code @ [cons(result, xs)]
249                          else let                          else let
250                            val res = DstV.new ("probe" ^ Int.toString offset, DstTy.realTy)                            val res = DstV.new ("probe" ^ Int.toString offset, sampleTy)
251                            val code = doVoxelSample (res, v, k, s, diffIter, vars, offset) @ code                            val code = doVoxelSample (res, v, k, s, diffIter(), vars, offset) @ code
252                            in                            in
253                              doSamples (offset-1, res::xs, code)                              doSamples (offset-1, res::xs, code)
254                            end                            end

Legend:
Removed from v.1392  
changed lines
  Added in v.1393

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