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

SCM Repository

[diderot] Diff of /trunk/src/compiler/c-util/c-names.sml
ViewVC logotype

Diff of /trunk/src/compiler/c-util/c-names.sml

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

revision 1923, Sat Jun 23 12:02:18 2012 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 57  Line 57 
57    
58      fun vecTy n = concat["vec", Int.toString n, !gRealSuffix, "_t"]      fun vecTy n = concat["vec", Int.toString n, !gRealSuffix, "_t"]
59      fun ivecTy n = concat["vec", Int.toString n, !gIntSuffix, "_t"]      fun ivecTy n = concat["vec", Int.toString n, !gIntSuffix, "_t"]
60        fun unionTy n = concat["union", Int.toString n, !gRealSuffix, "_t"]
61        fun iunionTy n = concat["union", Int.toString n, !gIntSuffix, "_t"]
62      fun imageTy n = concat["Diderot_image", Int.toString n, "D_t"]      fun imageTy n = concat["Diderot_image", Int.toString n, "D_t"]
63      fun matTy (n, m) = concat["Diderot_Mat", Int.toString n, "x", Int.toString m, "_t"]      fun matTy (n, m) = concat["Diderot_Mat", Int.toString n, "x", Int.toString m, "_t"]
64        fun ten3Ty (n, m, l) = concat["Diderot_Ten", Int.toString n, "x", Int.toString m, "x", Int.toString l, "_t"]
65    
66        val dynSeqTy = "Diderot_DynSeq_t"
67    
68    (* scalar math functions *)    (* scalar math functions *)
69      fun max () = "max"      fun max () = "max"
# Line 71  Line 76 
76    
77    (* vector math functions *)    (* vector math functions *)
78      val mkVec = addVecSuffix "vec"      val mkVec = addVecSuffix "vec"
79        val mkIVec = addVecSuffix "ivec"
80      val scale = addVecSuffix "scale"      val scale = addVecSuffix "scale"
81      val truncToInt = addVecSuffix "truncToInt"      val truncToInt = addVecSuffix "truncToInt"
82      val dot = addVecSuffix "dot"      val dot = addVecSuffix "dot"
# Line 84  Line 90 
90      fun zeroMat (n, m) = concat["zero", Int.toString n, "x", Int.toString m]      fun zeroMat (n, m) = concat["zero", Int.toString n, "x", Int.toString m]
91      fun identityMat n = concat["identity", Int.toString n, "x", Int.toString n]      fun identityMat n = concat["identity", Int.toString n, "x", Int.toString n]
92      fun trace n = concat["trace", Int.toString n, "x", Int.toString n]      fun trace n = concat["trace", Int.toString n, "x", Int.toString n]
93      fun norm (n, m) = concat["norm", Int.toString n, "x", Int.toString m]      fun normMat (n, m) = concat["norm", Int.toString n, "x", Int.toString m]
94      fun copyMat (n, m) = concat["copy", Int.toString n, "x", Int.toString m]      fun copyMat (n, m) = concat["copy", Int.toString n, "x", Int.toString m]
95      fun scaleMat (n, m) = concat["scale", Int.toString n, "x", Int.toString m]      fun scaleMat (n, m) = concat["scale", Int.toString n, "x", Int.toString m]
96      fun addMat (n, m) = concat["add", Int.toString n, "x", Int.toString m]      fun addMat (n, m) = concat["add", Int.toString n, "x", Int.toString m]
# Line 92  Line 98 
98      fun mulVecMat (m, n) = F.format "mulVec%dMat%dx%d" [F.INT m, F.INT m, F.INT n]      fun mulVecMat (m, n) = F.format "mulVec%dMat%dx%d" [F.INT m, F.INT m, F.INT n]
99      fun mulMatVec (m, n) = F.format "mulMat%dx%dVec%d" [F.INT n, F.INT m, F.INT n]      fun mulMatVec (m, n) = F.format "mulMat%dx%dVec%d" [F.INT n, F.INT m, F.INT n]
100      fun mulMatMat (m, n, p) = F.format "mulMat%dx%dMat%dx%d" [F.INT m, F.INT n, F.INT n, F.INT p]      fun mulMatMat (m, n, p) = F.format "mulMat%dx%dMat%dx%d" [F.INT m, F.INT n, F.INT n, F.INT p]
101        fun transposeMat (n, m) = concat["transpose", Int.toString n, "x", Int.toString m]
102    
103      (* 3rd-order tensor operations *)
104        fun copyTen3 (n, m, l) = F.format "copyTen%dx%dx%d" [F.INT n, F.INT m, F.INT l]
105        fun normTen3 (n, m, p) = concat["normTen", Int.toString n, "x", Int.toString m, "x", Int.toString p]
106        fun mulVecTen3 (m, n, p) = F.format "mulVec%dTen%dx%dx%d" [F.INT m, F.INT m, F.INT n, F.INT p]
107        fun mulTen3Vec (m, n, p) = F.format "mulTen%dx%dx%dVec%d" [F.INT m, F.INT n, F.INT p, F.INT p]
108    
109      (* colon-product operators *)
110        local
111          fun chkDim (d1 : int, d2 : int, d1', d2') =
112                if (d1 = d1') andalso (d2 = d2')
113                  then ()
114                  else raise Fail "mismatched dimensions for \":\" operator"
115        fun fmtName (fmt, l) = F.format fmt (List.map F.INT l)
116        in
117        fun colonMul ([d1, d2], [d1', d2']) = (
118              chkDim (d1, d2, d1', d2');
119              fmtName ("colonProdMat%dx%dMat%dx%d", [d1, d2, d1', d2']))
120          | colonMul ([d1, d2], [d1', d2', d3']) = (
121              chkDim (d1, d2, d1', d2');
122              fmtName ("colonProdMat%dx%dTen%dx%dx%d", [d1, d2, d1', d2', d3']))
123          | colonMul ([d1, d2, d3], [d2', d3']) = (
124              chkDim (d2, d3, d2', d3');
125              fmtName ("colonProdTen%dx%dx%dMat%dx%d", [d1, d2, d3, d2', d3']))
126          | colonMul ([d1, d2, d3], [d2', d3', d4']) = (
127              chkDim (d2, d3, d2', d3');
128              fmtName ("colonProdTen%dx%dx%dTen%dx%dx%d", [d1, d2, d3, d2', d3', d4']))
129          | colonMul _ = raise Fail "unsupported type for \":\" operator"
130        end
131    
132    (* Status_t symbols *)    (* Status_t symbols *)
133      val kActive = "DIDEROT_ACTIVE"      val kActive = "DIDEROT_ACTIVE"
# Line 103  Line 139 
139            val suffix = (case ty            val suffix = (case ty
140                   of Ty.TensorTy[d] => [Int.toString d]                   of Ty.TensorTy[d] => [Int.toString d]
141                    | Ty.TensorTy[m,n] => [Int.toString n, "x", Int.toString n]                    | Ty.TensorTy[m,n] => [Int.toString n, "x", Int.toString n]
142                      | Ty.TensorTy[m,n,p] => [Int.toString n, "x", Int.toString n, "x", Int.toString p]
143                  (* end case *))                  (* end case *))
144            in            in
145              concat("ToWorldSpace" :: suffix)              concat("ToWorldSpace" :: suffix)

Legend:
Removed from v.1923  
changed lines
  Added in v.2356

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