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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/cl-target/cl-ty-translate.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/cl-target/cl-ty-translate.sml

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

revision 3124, Tue Mar 24 09:59:45 2015 UTC revision 3125, Tue Mar 24 11:30:03 2015 UTC
# Line 33  Line 33 
33      val toOutputType : TreeIL.Ty.ty -> (CLang.ty * int)      val toOutputType : TreeIL.Ty.ty -> (CLang.ty * int)
34    
35    (* generate code to copy values from their internal Diderot representation to their    (* generate code to copy values from their internal Diderot representation to their
36     * output buffer representation.     * output buffer representation.  We assume that the dst expression has type T_Ptr(ty).
37     *)     *)
38      val copyToOutput : {ty : TreeIL.Ty.ty, dst : CLang.exp, src : CLang.exp} -> CLang.stm list      val copyToOutput : {ty : TreeIL.Ty.ty, dst : CLang.exp, src : CLang.exp} -> CLang.stm list
39    
# Line 97  Line 97 
97     * output buffer representation.     * output buffer representation.
98     *)     *)
99      fun copyToOutput {ty, dst, src} = (case ty      fun copyToOutput {ty, dst, src} = (case ty
100             of Ty.BoolTy => [CL.mkAssign(dst, src)]             of Ty.BoolTy => [CL.mkAssign(CL.mkUnOp(CL.%*, dst), src)]
101              | Ty.StringTy => [CL.mkAssign(dst, src)]              | Ty.StringTy => raise Fail "OpenCL does not support strings"
102              | Ty.IntTy => [CL.mkAssign(dst, src)]              | Ty.IntTy => [CL.mkAssign(CL.mkUnOp(CL.%*, dst), src)]
103              | Ty.TensorTy[] => [CL.mkAssign(dst, src)]              | Ty.TensorTy[] => [CL.mkAssign(CL.mkUnOp(CL.%*, dst), src)]
104              | Ty.TensorTy[n] =>              | Ty.TensorTy[n] =>
105                  List.tabulate (n,                  List.tabulate (n,
106                    fn i => CL.mkAssign(subscript(dst, i), CL.mkSelect(src, "s" ^ Int.toString i)))                    fn i => CL.mkAssign(subscript(dst, i), CL.mkSelect(src, "s" ^ Int.toString i)))

Legend:
Removed from v.3124  
changed lines
  Added in v.3125

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