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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml
ViewVC logotype

Annotation of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1408 - (view) (download)

1 : jhr 1315 (* cl-target.sml
2 : lamonts 1244 *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure CLTarget : TARGET =
8 :     struct
9 :    
10 :     structure IL = TreeIL
11 :     structure V = IL.Var
12 :     structure Ty = IL.Ty
13 :     structure CL = CLang
14 :     structure RN = RuntimeNames
15 : jhr 1273 structure ToCL = TreeToCL
16 : lamonts 1305 structure N = CNames
17 : lamonts 1244
18 : jhr 1358 (* translate TreeIL types to shadow types *)
19 :     fun shadowTy ty = (case ty
20 : jhr 1363 of Ty.BoolTy => CL.T_Named "cl_bool"
21 : jhr 1358 | Ty.StringTy => raise Fail "unexpected string type"
22 :     | Ty.IVecTy 1 => CL.T_Named(RN.shadowIntTy ())
23 :     | Ty.IVecTy n => raise Fail "unexpected int vector type"
24 :     | Ty.TensorTy[] => CL.T_Named(RN.shadowRealTy ())
25 :     | Ty.TensorTy[n] => CL.T_Named(RN.shadowVecTy n)
26 :     | Ty.TensorTy[n, m] => CL.T_Named(RN.shadowMatTy(n,m))
27 :     | Ty.ImageTy(ImageInfo.ImgInfo{dim, ...}) => CL.T_Named(RN.shadowImageTy dim)
28 :     | _ => raise Fail(concat["TreeToC.trType(", Ty.toString ty, ")"])
29 :     (* end case *))
30 : lamonts 1408
31 :     (* translate TreeIL types to shadow types *)
32 :     fun convertToShadow (ty,name) = (case ty
33 :     of Ty.IVecTy 1 => CL.mkAssign(CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),name),
34 :     CL.mkIndirect(CL.mkVar(RN.globalsVarName), name))
35 :     | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n,[
36 :     CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),name),
37 :     CL.mkIndirect(CL.mkVar(RN.globalsVarName), name)])
38 :     | Ty.ImageTy(ImageInfo.ImgInfo{dim, ...}) => CL.mkCall(RN.shadowImageFunc dim, [
39 :     CL.mkVar "context",
40 :     CL.mkUnOp(CL.%&,CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),name)),
41 :     CL.mkIndirect(CL.mkVar(RN.globalsVarName),name)
42 :     ])
43 :     | Ty.TensorTy[n, m] => CL.mkCall(RN.convertToShadowMat(m,n),[
44 :     CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),name),
45 :     CL.mkIndirect(CL.mkVar(RN.globalsVarName), name)])
46 :     | _ => CL.mkAssign(CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),name),
47 :     CL.mkIndirect(CL.mkVar(RN.globalsVarName), name))
48 :     (*end case *))
49 : jhr 1358
50 : jhr 1343 (* helper functions for specifying parameters in various address spaces *)
51 :     fun clParam (spc, ty, x) = CL.PARAM([spc], ty, x)
52 :     fun globalParam (ty, x) = CL.PARAM(["__global"], ty, x)
53 :     fun constantParam (ty, x) = CL.PARAM(["__constant"], ty, x)
54 :     fun localParam (ty, x) = CL.PARAM(["__local"], ty, x)
55 :     fun privateParam (ty, x) = CL.PARAM(["__private"], ty, x)
56 :    
57 : jhr 1315 (* C variable translation *)
58 :     structure TrCVar =
59 : lamonts 1305 struct
60 :     type env = CL.typed_var TreeIL.Var.Map.map
61 :     fun lookup (env, x) = (case V.Map.find (env, x)
62 :     of SOME(CL.V(_, x')) => x'
63 : jhr 1315 | NONE => raise Fail(concat["TrCVar.lookup(_, ", V.name x, ")"])
64 : lamonts 1305 (* end case *))
65 :     (* translate a variable that occurs in an l-value context (i.e., as the target of an assignment) *)
66 :     fun lvalueVar (env, x) = (case V.kind x
67 : jhr 1315 of IL.VK_Global => CL.mkIndirect(CL.mkVar RN.globalsVarName, lookup(env, x))
68 : lamonts 1305 | IL.VK_State strand => CL.mkIndirect(CL.mkVar "selfOut", lookup(env, x))
69 :     | IL.VK_Local => CL.mkVar(lookup(env, x))
70 :     (* end case *))
71 :     (* translate a variable that occurs in an r-value context *)
72 :     fun rvalueVar (env, x) = (case V.kind x
73 : jhr 1315 of IL.VK_Global => CL.mkIndirect(CL.mkVar RN.globalsVarName, lookup(env, x))
74 : lamonts 1305 | IL.VK_State strand => CL.mkIndirect(CL.mkVar "selfIn", lookup(env, x))
75 :     | IL.VK_Local => CL.mkVar(lookup(env, x))
76 :     (* end case *))
77 : jhr 1285 end
78 :    
79 :     structure ToC = TreeToCFn (TrCVar)
80 :    
81 :     type var = CL.typed_var
82 : lamonts 1244 type exp = CL.exp
83 :     type stm = CL.stm
84 :    
85 : jhr 1313 (* OpenCL specific types *)
86 :     val clIntTy = CL.T_Named "cl_int"
87 : jhr 1279 val clProgramTy = CL.T_Named "cl_program"
88 :     val clKernelTy = CL.T_Named "cl_kernel"
89 :     val clCmdQueueTy = CL.T_Named "cl_command_queue"
90 :     val clContextTy = CL.T_Named "cl_context"
91 :     val clDeviceIdTy = CL.T_Named "cl_device_id"
92 :     val clPlatformIdTy = CL.T_Named "cl_platform_id"
93 :     val clMemoryTy = CL.T_Named "cl_mem"
94 : jhr 1313 val globPtrTy = CL.T_Ptr(CL.T_Named RN.globalsTy)
95 : jhr 1279
96 : jhr 1307 (* variable or field that is mirrored between host and GPU *)
97 :     type mirror_var = {
98 :     hostTy : CL.ty, (* variable type on Host (i.e., C type) *)
99 : jhr 1358 shadowTy : CL.ty, (* host-side shadow type of GPU type *)
100 : jhr 1307 gpuTy : CL.ty, (* variable's type on GPU (i.e., OpenCL type) *)
101 : lamonts 1408 hToS: stm, (*the statement that converts the variable to its shadow representation *)
102 : jhr 1307 var : CL.var (* variable name *)
103 :     }
104 :    
105 : lamonts 1244 datatype strand = Strand of {
106 : jhr 1261 name : string,
107 :     tyName : string,
108 : jhr 1307 state : mirror_var list ref,
109 : jhr 1358 output : (Ty.ty * CL.var) option ref, (* the strand's output variable (only one for now) *)
110 : lamonts 1271 code : CL.decl list ref,
111 : jhr 1273 init_code: CL.decl ref
112 : lamonts 1244 }
113 :    
114 :     datatype program = Prog of {
115 : jhr 1307 name : string, (* stem of source file *)
116 : jhr 1261 double : bool, (* true for double-precision support *)
117 :     parallel : bool, (* true for multithreaded (or multi-GPU) target *)
118 :     debug : bool, (* true for debug support in executable *)
119 : jhr 1307 globals : mirror_var list ref,
120 : jhr 1261 topDecls : CL.decl list ref,
121 :     strands : strand AtomTable.hash_table,
122 : lamonts 1305 initially : CL.decl ref,
123 : jhr 1333 numDims: int ref, (* number of dimensions in initially iteration *)
124 : jhr 1273 imgGlobals: (string * int) list ref,
125 :     prFn: CL.decl ref
126 :     }
127 : lamonts 1244
128 :     datatype env = ENV of {
129 : jhr 1261 info : env_info,
130 :     vMap : var V.Map.map,
131 :     scope : scope
132 : lamonts 1244 }
133 :    
134 :     and env_info = INFO of {
135 : jhr 1261 prog : program
136 : lamonts 1244 }
137 :    
138 :     and scope
139 :     = NoScope
140 :     | GlobalScope
141 :     | InitiallyScope
142 : jhr 1261 | StrandScope of TreeIL.var list (* strand initialization *)
143 :     | MethodScope of TreeIL.var list (* method body; vars are state variables *)
144 : lamonts 1244
145 : jhr 1273 (* the supprted widths of vectors of reals on the target. *)
146 :     (* FIXME: for OpenCL 1.1, 3 is also valid *)
147 :     fun vectorWidths () = [2, 4, 8, 16]
148 : lamonts 1244
149 :     (* tests for whether various expression forms can appear inline *)
150 : jhr 1261 fun inlineCons n = (n < 2) (* vectors are inline, but not matrices *)
151 :     val inlineMatrixExp = false (* can matrix-valued expressions appear inline? *)
152 : lamonts 1244
153 :     (* TreeIL to target translations *)
154 :     structure Tr =
155 :     struct
156 : jhr 1261 fun fragment (ENV{info, vMap, scope}, blk) = let
157 : jhr 1308 val (vMap, stms) = (case scope
158 : jhr 1326 of GlobalScope => ToC.trFragment (vMap, blk)
159 : jhr 1321 (* NOTE: if we move strand initialization to the GPU, then we'll have to change the following code! *)
160 : jhr 1326 | InitiallyScope => ToC.trFragment (vMap, blk)
161 :     | _ => ToCL.trFragment (vMap, blk)
162 :     (* end case *))
163 : jhr 1261 in
164 :     (ENV{info=info, vMap=vMap, scope=scope}, stms)
165 :     end
166 : jhr 1315 fun block (ENV{vMap, scope, ...}, blk) = let
167 : jhr 1326 fun saveState cxt stateVars trAssign (env, args, stm) = (
168 :     ListPair.foldrEq
169 :     (fn (x, e, stms) => trAssign(env, x, e)@stms)
170 :     [stm]
171 :     (stateVars, args)
172 :     ) handle ListPair.UnequalLengths => (
173 :     print(concat["saveState ", cxt, ": length mismatch; ", Int.toString(List.length args), " args\n"]);
174 :     raise Fail(concat["saveState ", cxt, ": length mismatch"]))
175 :     in
176 :     case scope
177 : jhr 1315 (* NOTE: if we move strand initialization to the GPU, then we'll have to change the following code! *)
178 : jhr 1326 of StrandScope stateVars =>
179 : jhr 1353 ToCL.trBlock (vMap, saveState "StrandScope" stateVars ToCL.trAssign, blk)
180 : jhr 1326 | MethodScope stateVars =>
181 :     ToCL.trBlock (vMap, saveState "MethodScope" stateVars ToCL.trAssign, blk)
182 :     | InitiallyScope => ToCL.trBlock (vMap, fn (_, _, stm) => [stm], blk)
183 :     | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)
184 :     (* end case *)
185 :     end
186 : jhr 1273 fun exp (ENV{vMap, ...}, e) = ToCL.trExp(vMap, e)
187 : lamonts 1244 end
188 :    
189 :     (* variables *)
190 :     structure Var =
191 :     struct
192 : jhr 1358 fun mirror (ty, name) = {
193 :     hostTy = ToC.trType ty,
194 :     shadowTy = shadowTy ty,
195 :     gpuTy = ToCL.trType ty,
196 : lamonts 1408 hToS = convertToShadow(ty,name),
197 : jhr 1358 var = name
198 :     }
199 : jhr 1273 fun name (ToCL.V(_, name)) = name
200 : jhr 1307 fun global (Prog{globals, imgGlobals, ...}, name, ty) = let
201 : jhr 1358 val x = mirror (ty, name)
202 : jhr 1307 fun isImgGlobal (Ty.ImageTy(ImageInfo.ImgInfo{dim, ...}), name) =
203 :     imgGlobals := (name,dim) :: !imgGlobals
204 :     | isImgGlobal _ = ()
205 : jhr 1261 in
206 : jhr 1307 globals := x :: !globals;
207 :     isImgGlobal (ty, name);
208 :     ToCL.V(#gpuTy x, name)
209 : jhr 1261 end
210 : jhr 1273 fun param x = ToCL.V(ToCL.trType(V.ty x), V.name x)
211 : jhr 1261 fun state (Strand{state, ...}, x) = let
212 : jhr 1307 val ty = V.ty x
213 : jhr 1358 val x' = mirror (ty, V.name x)
214 : jhr 1261 in
215 :     state := x' :: !state;
216 : jhr 1307 ToCL.V(#gpuTy x', #var x')
217 : jhr 1261 end
218 : lamonts 1244 end
219 :    
220 :     (* environments *)
221 :     structure Env =
222 :     struct
223 :     (* create a new environment *)
224 : jhr 1261 fun new prog = ENV{
225 :     info=INFO{prog = prog},
226 :     vMap = V.Map.empty,
227 :     scope = NoScope
228 :     }
229 : lamonts 1244 (* define the current translation context *)
230 : jhr 1261 fun setScope scope (ENV{info, vMap, ...}) = ENV{info=info, vMap=vMap, scope=scope}
231 :     val scopeGlobal = setScope GlobalScope
232 :     val scopeInitially = setScope InitiallyScope
233 :     fun scopeStrand (env, svars) = setScope (StrandScope svars) env
234 :     fun scopeMethod (env, svars) = setScope (MethodScope svars) env
235 : lamonts 1244 (* bind a TreeIL varaiable to a target variable *)
236 : jhr 1261 fun bind (ENV{info, vMap, scope}, x, x') = ENV{
237 :     info = info,
238 :     vMap = V.Map.insert(vMap, x, x'),
239 :     scope = scope
240 :     }
241 : lamonts 1244 end
242 :    
243 :     (* programs *)
244 :     structure Program =
245 :     struct
246 : jhr 1278 fun new {name, double, parallel, debug} = (
247 : jhr 1261 RN.initTargetSpec double;
248 : jhr 1286 CNames.initTargetSpec double;
249 : jhr 1261 Prog{
250 : jhr 1307 name = name,
251 : jhr 1261 double = double, parallel = parallel, debug = debug,
252 : jhr 1331 globals = ref [],
253 : jhr 1261 topDecls = ref [],
254 :     strands = AtomTable.mkTable (16, Fail "strand table"),
255 : jhr 1307 initially = ref(CL.D_Comment["missing initially"]),
256 : jhr 1332 numDims = ref 0,
257 : jhr 1307 imgGlobals = ref[],
258 :     prFn = ref(CL.D_Comment(["No Print Function"]))
259 : jhr 1261 })
260 : jhr 1357
261 : jhr 1261 (* register the code that is used to register command-line options for input variables *)
262 :     fun inputs (Prog{topDecls, ...}, stm) = let
263 :     val inputsFn = CL.D_Func(
264 :     [], CL.voidTy, RN.registerOpts,
265 :     [CL.PARAM([], CL.T_Ptr(CL.T_Named RN.optionsTy), "opts")],
266 :     stm)
267 :     in
268 :     topDecls := inputsFn :: !topDecls
269 :     end
270 :    
271 : jhr 1286 (* register the global initialization part of a program *)
272 : jhr 1307 fun init (Prog{topDecls, ...}, init) = let
273 : jhr 1331 val globalsDecl = CL.mkAssign(CL.E_Var RN.globalsVarName,
274 : jhr 1358 CL.mkApply("malloc", [CL.mkSizeof(CL.T_Named RN.globalsTy)]))
275 : jhr 1331 val initFn = CL.D_Func(
276 : lamonts 1316 [], CL.voidTy, RN.initGlobals, [],
277 : jhr 1358 CL.mkBlock[
278 : lamonts 1398 globalsDecl,
279 :     CL.mkCall(RN.initGlobalsHelper, [CL.mkVar RN.globalsVarName])
280 :     ])
281 : jhr 1357 val initHelperFn = CL.D_Func(
282 : jhr 1358 [], CL.voidTy, RN.initGlobalsHelper,
283 : lamonts 1398 [CL.PARAM([], globPtrTy, RN.globalsVarName)],
284 : jhr 1286 init)
285 : jhr 1307 val shutdownFn = CL.D_Func(
286 :     [], CL.voidTy, RN.shutdown,
287 :     [CL.PARAM([], CL.T_Ptr(CL.T_Named RN.worldTy), "wrld")],
288 :     CL.S_Block[])
289 :     in
290 : jhr 1357 topDecls := shutdownFn :: initFn :: initHelperFn :: !topDecls
291 : jhr 1307 end
292 : jhr 1357
293 : jhr 1333 (* create and register the initially function for a program *)
294 : jhr 1307 fun initially {
295 : jhr 1332 prog = Prog{name=progName, strands, initially, numDims, ...},
296 : jhr 1307 isArray : bool,
297 :     iterPrefix : stm list,
298 :     iters : (var * exp * exp) list,
299 :     createPrefix : stm list,
300 :     strand : Atom.atom,
301 :     args : exp list
302 :     } = let
303 :     val name = Atom.toString strand
304 :     val nDims = List.length iters
305 :     val worldTy = CL.T_Ptr(CL.T_Named N.worldTy)
306 :     fun mapi f xs = let
307 :     fun mapf (_, []) = []
308 :     | mapf (i, x::xs) = f(i, x) :: mapf(i+1, xs)
309 :     in
310 :     mapf (0, xs)
311 :     end
312 :     val baseInit = mapi (fn (i, (_, e, _)) => (i, CL.I_Exp e)) iters
313 :     val sizeInit = mapi
314 :     (fn (i, (CL.V(ty, _), lo, hi)) =>
315 :     (i, CL.I_Exp(CL.mkBinOp(CL.mkBinOp(hi, CL.#-, lo), CL.#+, CL.E_Int(1, ty))))
316 :     ) iters
317 :     (* code to allocate the world and initial strands *)
318 :     val wrld = "wrld"
319 :     val allocCode = [
320 :     CL.mkComment["allocate initial block of strands"],
321 :     CL.mkDecl(CL.T_Array(CL.int32, SOME nDims), "base", SOME(CL.I_Array baseInit)),
322 :     CL.mkDecl(CL.T_Array(CL.uint32, SOME nDims), "size", SOME(CL.I_Array sizeInit)),
323 :     CL.mkDecl(worldTy, wrld,
324 : lamonts 1341 SOME(CL.I_Exp(CL.E_Apply(RN.allocInitially, [
325 : jhr 1307 CL.mkVar "ProgramName",
326 :     CL.mkUnOp(CL.%&, CL.E_Var(N.strandDesc name)),
327 :     CL.E_Bool isArray,
328 :     CL.E_Int(IntInf.fromInt nDims, CL.int32),
329 :     CL.E_Var "base",
330 :     CL.E_Var "size"
331 :     ]))))
332 :     ]
333 : lamonts 1316 (* create the loop nest for the initially iterations
334 : jhr 1307 val indexVar = "ix"
335 :     val strandTy = CL.T_Ptr(CL.T_Named(N.strandTy name))
336 :     fun mkLoopNest [] = CL.mkBlock(createPrefix @ [
337 :     CL.mkDecl(strandTy, "sp",
338 :     SOME(CL.I_Exp(
339 :     CL.E_Cast(strandTy,
340 :     CL.E_Apply(N.inState, [CL.E_Var "wrld", CL.E_Var indexVar]))))),
341 : jhr 1315 CL.mkCall(N.strandInit name,
342 : jhr 1326 CL.E_Var RN.globalsVarName :: CL.E_Var "sp" :: args),
343 : jhr 1307 CL.mkAssign(CL.E_Var indexVar, CL.mkBinOp(CL.E_Var indexVar, CL.#+, CL.E_Int(1, CL.uint32)))
344 :     ])
345 :     | mkLoopNest ((CL.V(ty, param), lo, hi)::iters) = let
346 :     val body = mkLoopNest iters
347 :     in
348 :     CL.mkFor(
349 :     [(ty, param, lo)],
350 :     CL.mkBinOp(CL.E_Var param, CL.#<=, hi),
351 :     [CL.mkPostOp(CL.E_Var param, CL.^++)],
352 :     body)
353 :     end
354 :     val iterCode = [
355 :     CL.mkComment["initially"],
356 :     CL.mkDecl(CL.uint32, indexVar, SOME(CL.I_Exp(CL.E_Int(0, CL.uint32)))),
357 :     mkLoopNest iters
358 : lamonts 1316 ] *)
359 : jhr 1307 val body = CL.mkBlock(
360 :     iterPrefix @
361 :     allocCode @
362 :     [CL.mkReturn(SOME(CL.E_Var "wrld"))])
363 : lamonts 1316 val initFn = CL.D_Func([], worldTy, N.initially, [], body)
364 : jhr 1307 in
365 : jhr 1333 numDims := nDims;
366 : jhr 1307 initially := initFn
367 :     end
368 : jhr 1281
369 : lamonts 1305 (***** OUTPUT *****)
370 : jhr 1307 fun genStrandPrint (Strand{name, tyName, state, output, code,...}) = let
371 : jhr 1326 (* the print function *)
372 : jhr 1382 val prFnName = concat[name, "Print"]
373 : jhr 1307 val prFn = let
374 : jhr 1326 val params = [
375 :     CL.PARAM([], CL.T_Ptr(CL.T_Named "FILE"), "outS"),
376 : jhr 1358 CL.PARAM([], CL.T_Ptr(CL.T_Num(RawTypes.RT_UInt8)),"status"),
377 :     CL.PARAM([], CL.intTy,"numStrands"),
378 : jhr 1326 CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "self")
379 :     ]
380 :     val SOME(ty, x) = !output
381 : jhr 1358 val outState = CL.mkSelect(CL.mkSubscript(CL.mkVar "self", CL.E_Var "i"), x)
382 : jhr 1326 val prArgs = (case ty
383 :     of Ty.IVecTy 1 => [CL.E_Str(!N.gIntFormat ^ "\n"), outState]
384 :     | Ty.IVecTy d => let
385 :     val fmt = CL.mkStr(
386 :     String.concatWith " " (List.tabulate(d, fn _ => !N.gIntFormat))
387 :     ^ "\n")
388 :     val args = List.tabulate (d, fn i => ToC.ivecIndex(outState, d, i))
389 :     in
390 :     fmt :: args
391 :     end
392 :     | Ty.TensorTy[] => [CL.mkStr "%f\n", outState]
393 :     | Ty.TensorTy[d] => let
394 :     val fmt = CL.mkStr(
395 :     String.concatWith " " (List.tabulate(d, fn _ => "%f"))
396 :     ^ "\n")
397 :     val args = List.tabulate (d, fn i => ToC.vecIndex(outState, d, i))
398 :     in
399 :     fmt :: args
400 :     end
401 :     | _ => raise Fail("genStrand: unsupported output type " ^ Ty.toString ty)
402 :     (* end case *))
403 : jhr 1358 val forBody = CL.mkIfThen(
404 :     CL.mkBinOp(CL.mkSubscript(CL.E_Var "status",CL.E_Var "i"), CL.#==, CL.E_Var "DIDEROT_STABILIZE"),
405 :     CL.mkBlock([CL.mkCall("fprintf", CL.mkVar "outS" :: prArgs)]))
406 :     val body = CL.mkFor(
407 : lamonts 1346 [(CL.intTy, "i", CL.mkInt 0)],
408 : lamonts 1347 CL.mkBinOp(CL.E_Var "i", CL.#<, CL.E_Var "numStrands"),
409 : lamonts 1346 [CL.mkPostOp(CL.E_Var "i", CL.^++)],
410 :     forBody)
411 : jhr 1326 in
412 : jhr 1358 CL.D_Func(["static"], CL.voidTy, prFnName, params, body)
413 : jhr 1326 end
414 : jhr 1307 in
415 : jhr 1326 prFn
416 : jhr 1307 end
417 : lamonts 1305
418 : jhr 1307 fun genStrandTyDef (targetTy, Strand{tyName, state,...}) =
419 : jhr 1261 (* the type declaration for the strand's state struct *)
420 :     CL.D_StructDef(
421 : jhr 1307 List.rev (List.map (fn x => (targetTy x, #var x)) (!state)),
422 :     tyName)
423 : jhr 1358
424 : jhr 1307 (* generates the opencl buffers for the image data *)
425 : lamonts 1398 fun getGlobalDataBuffers (globals, imgGlobals, contextVar, errVar) = let
426 : jhr 1344 val globalBuffErr = "error creating OpenCL global buffer"
427 :     fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.E_Var errVar, CL.#!=, CL.E_Var "CL_SUCCESS"),
428 :     CL.mkBlock([CL.mkCall("fprintf",[CL.E_Var "stderr", CL.E_Str msg]),
429 :     CL.mkCall("exit",[CL.mkInt 1])]))
430 : jhr 1405 val shadowTypeDecl =
431 :     CL.mkDecl(CL.T_Named(RN.shadowGlobalsTy), RN.shadowGlaobalsName, NONE)
432 : lamonts 1408 val globalToShadowStms = List.map (fn (x:mirror_var) => #hToS x ) globals
433 : jhr 1358 val globalBufferDecl = CL.mkDecl(clMemoryTy,concat[RN.globalsVarName,"_cl"],NONE)
434 : jhr 1307 val globalBuffer = CL.mkAssign(CL.mkVar(concat[RN.globalsVarName,"_cl"]),
435 :     CL.mkApply("clCreateBuffer", [
436 :     CL.mkVar contextVar,
437 : jhr 1407 CL.mkBinOp(CL.mkVar "CL_MEM_READ_ONLY", CL.#|, CL.mkVar "CL_MEM_COPY_HOST_PTR"),
438 : lamonts 1398 CL.mkSizeof(CL.T_Named RN.shadowGlobalsTy),
439 :     CL.mkUnOp(CL.%&,CL.mkVar RN.shadowGlaobalsName),
440 : jhr 1307 CL.mkUnOp(CL.%&,CL.mkVar errVar)
441 :     ]))
442 : lamonts 1341 fun genDataBuffers ([],_,_,_) = []
443 :     | genDataBuffers ((var,nDims)::globals, contextVar, errVar,errFn) = let
444 : jhr 1326 val hostVar = CL.mkIndirect(CL.mkVar RN.globalsVarName, var)
445 : lamonts 1398 val size = CL.mkIndirect(hostVar, "dataSzb")
446 : jhr 1326 in
447 : lamonts 1398 CL.mkDecl(clMemoryTy, RN.addBufferSuffixData var ,NONE) ::
448 : jhr 1326 CL.mkAssign(CL.mkVar(RN.addBufferSuffixData var),
449 :     CL.mkApply("clCreateBuffer", [
450 :     CL.mkVar contextVar,
451 : lamonts 1398 CL.mkVar "CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR",
452 : jhr 1326 size,
453 :     CL.mkIndirect(hostVar, "data"),
454 :     CL.mkUnOp(CL.%&,CL.mkVar errVar)
455 : jhr 1344 ])) ::
456 : jhr 1358 errFn(concat["error in creating ",RN.addBufferSuffixData var, " global buffer"]) ::
457 :     genDataBuffers(globals,contextVar,errVar,errFn)
458 : jhr 1326 end
459 : jhr 1307 in
460 : lamonts 1408 [shadowTypeDecl] @ globalToShadowStms
461 : lamonts 1398 @ [globalBufferDecl, globalBuffer,errorFn(globalBuffErr)]
462 :     @ genDataBuffers(imgGlobals,contextVar,errVar,errorFn)
463 : jhr 1307 end
464 : lamonts 1264
465 : jhr 1309 (* generates the kernel arguments for the image data *)
466 : jhr 1313 fun genGlobalArguments (globals, count, kernelVar, errVar) = let
467 : jhr 1343 val globalArgErr = "error creating OpenCL global argument"
468 :     fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.E_Var errVar, CL.#!=, CL.E_Var "CL_SUCCESS"),
469 : jhr 1344 CL.mkBlock([CL.mkCall("fprintf",[CL.E_Var "stderr", CL.E_Str msg]),
470 :     CL.mkCall("exit",[CL.mkInt 1])]))
471 : lamonts 1398 val globalArgument = CL.mkExpStm(CL.mkAssignOp(CL.mkVar errVar,CL.&=,
472 : jhr 1326 CL.mkApply("clSetKernelArg",
473 :     [CL.mkVar kernelVar,
474 :     CL.mkPostOp(CL.E_Var count, CL.^++),
475 :     CL.mkApply("sizeof",[CL.mkVar "cl_mem"]),
476 :     CL.mkUnOp(CL.%&,CL.mkVar(concat[RN.globalsVarName,"_cl"]))])))
477 : lamonts 1341 fun genDataArguments ([],_,_,_,_) = []
478 : lamonts 1398 | genDataArguments ((var,nDims)::globals,count,kernelVar,errVar,errFn) =
479 : lamonts 1341 CL.mkExpStm(CL.mkAssignOp(CL.mkVar errVar,CL.$=,
480 : jhr 1326 CL.mkApply("clSetKernelArg",
481 :     [CL.mkVar kernelVar,
482 :     CL.mkPostOp(CL.E_Var count, CL.^++),
483 :     CL.mkApply("sizeof",[CL.mkVar "cl_mem"]),
484 :     CL.mkUnOp(CL.%&,CL.mkVar(RN.addBufferSuffixData var))]))) ::
485 : jhr 1344 errFn(concat["error in creating ",RN.addBufferSuffixData var, " argument"]) ::
486 : lamonts 1341 genDataArguments (globals,count,kernelVar,errVar,errFn)
487 : jhr 1326 in
488 : lamonts 1341 [globalArgument,errorFn(globalArgErr)] @ genDataArguments(globals, count, kernelVar, errVar,errorFn)
489 : jhr 1326 end
490 : lamonts 1264
491 : lamonts 1305 (* generates the globals buffers and arguments function *)
492 : lamonts 1398 fun genGlobalBuffersArgs (globals,imgGlobals) = let
493 : jhr 1273 (* Delcare opencl setup objects *)
494 :     val errVar = "err"
495 :     val imgDataSizeVar = "image_dataSize"
496 : jhr 1315 val params = [
497 : lamonts 1305 CL.PARAM([],CL.T_Named("cl_context"), "context"),
498 : jhr 1307 CL.PARAM([],CL.T_Named("cl_kernel"), "kernel"),
499 : jhr 1344 CL.PARAM([],CL.T_Named("cl_command_queue"), "cmdQ"),
500 : jhr 1307 CL.PARAM([],CL.T_Named("int"), "argStart")
501 : jhr 1273 ]
502 : lamonts 1398 val clGlobalBuffers = getGlobalDataBuffers(globals,!imgGlobals, "context", errVar)
503 : jhr 1313 val clGlobalArguments = genGlobalArguments(!imgGlobals, "argStart", "kernel", errVar)
504 : jhr 1307 (* Body put all the statments together *)
505 : jhr 1314 val body = CL.mkDecl(clIntTy, errVar, SOME(CL.I_Exp(CL.mkInt 0)))
506 : jhr 1326 :: clGlobalBuffers @ clGlobalArguments
507 : jhr 1313 in
508 : jhr 1307 CL.D_Func([],CL.voidTy,RN.globalsSetupName,params,CL.mkBlock(body))
509 :     end
510 : lamonts 1305
511 : jhr 1307 (* generate the data and global parameters *)
512 :     fun genKeneralGlobalParams ((name,tyname)::rest) =
513 : jhr 1343 globalParam (CL.T_Ptr(CL.voidTy), RN.addBufferSuffixData name) ::
514 : jhr 1307 genKeneralGlobalParams rest
515 :     | genKeneralGlobalParams [] = []
516 :    
517 : jhr 1331 (* generate the main kernel function for the .cl file *)
518 : jhr 1307 fun genKernelFun (strand, nDims, globals, imgGlobals) = let
519 :     val Strand{name, tyName, state, output, code,...} = strand
520 :     val fName = RN.kernelFuncName;
521 :     val inState = "strand_in"
522 : lamonts 1341 val outState = "strand_out"
523 : jhr 1345 val tempVar = "tmp"
524 : jhr 1307 val params = [
525 : lamonts 1346 CL.PARAM(["__global"], CL.T_Ptr(CL.T_Named tyName), "selfIn"),
526 :     CL.PARAM(["__global"], CL.T_Ptr(CL.T_Named tyName), "selfOut"),
527 : jhr 1358 CL.PARAM(["__global"], CL.T_Ptr(CL.T_Num(RawTypes.RT_UInt8)), "strandStatus"),
528 : lamonts 1346 CL.PARAM(["__global"], CL.intTy, "width"),
529 : jhr 1358 CL.PARAM(["__global"], globPtrTy, RN.globalsVarName)
530 : jhr 1307 ] @ genKeneralGlobalParams(!imgGlobals)
531 :     val thread_ids = if nDims = 1
532 : jhr 1331 then [
533 :     CL.mkDecl(CL.intTy, "x",
534 :     SOME(CL.I_Exp(CL.mkApply(RN.getGlobalThreadId,[CL.mkInt 0]))))
535 :     ]
536 :     else if nDims = 2
537 :     then [
538 :     CL.mkDecl(CL.intTy, "x",
539 :     SOME(CL.I_Exp(CL.mkApply(RN.getGlobalThreadId,[CL.mkInt 0])))),
540 :     CL.mkDecl(CL.intTy, "y",
541 :     SOME(CL.I_Exp(CL.mkApply(RN.getGlobalThreadId,[CL.mkInt 1]))))
542 :     ]
543 :     else raise Fail "nDims > 2"
544 : jhr 1307 val strandDecl = [
545 : lamonts 1341 CL.mkDecl(CL.T_Ptr(CL.T_Named (concat["__global ",tyName])), inState, NONE),
546 :     CL.mkDecl(CL.T_Ptr(CL.T_Named (concat["__global ",tyName])), outState, NONE),
547 : jhr 1344 CL.mkDecl(CL.T_Ptr(CL.T_Named (concat["__global ",tyName])), tempVar, NONE)
548 : jhr 1331 ]
549 : lamonts 1398 val imageDataDecl = CL.mkDecl(CL.T_Named(RN.imageDataType),RN.globalImageDataName,NONE)
550 :     val imageDataStms = List.map (fn (x,_) =>
551 :     CL.mkAssign(CL.mkSelect(CL.mkVar(RN.globalImageDataName),RN.imageDataName x),
552 :     CL.mkVar(RN.addBufferSuffixData x))) (!imgGlobals)
553 :     val barrierCode = CL.mkIfThen(CL.mkBinOp(CL.E_Var "status",CL.#==,CL.E_Var "DIDEROT_ACTIVE"),
554 :     CL.mkBlock ([CL.mkAssign(CL.E_Var tempVar, CL.E_Var inState),
555 :     CL.mkAssign(CL.E_Var inState, CL.E_Var outState),
556 :     CL.mkAssign(CL.E_Var outState, CL.E_Var tempVar)]))
557 : jhr 1358 val barrierStm = CL.mkCall("barrier",[CL.E_Var "CLK_LOCAL_MEM_FENCE"])
558 : lamonts 1346 val index = if nDims = 1 then
559 :     CL.mkStr "x"
560 :     else
561 : jhr 1358 CL.mkBinOp(
562 : jhr 1332 CL.mkBinOp(CL.mkVar "x", CL.#*, CL.mkVar "width"), CL.#+, CL.mkVar "y")
563 : lamonts 1346
564 :     val strandObjects =
565 :     [ CL.mkAssign(CL.mkVar inState, CL.mkBinOp(CL.mkVar "selfIn",CL.#+,index)),
566 :     CL.mkAssign(CL.mkVar outState, CL.mkBinOp(CL.mkVar "selfOut",CL.#+,index))
567 : jhr 1358 ]
568 : lamonts 1346
569 : jhr 1358 val stabalizeStm = CL.mkAssign(CL.mkSubscript(CL.mkVar "strandStatus",index),
570 :     CL.E_Var "status")
571 : lamonts 1346 val status = CL.mkDecl(CL.intTy, "status", SOME(CL.I_Exp(CL.mkSubscript(CL.mkVar "strandStatus",index))))
572 : jhr 1333 val strandInitStm = CL.mkCall(RN.strandInit name, [
573 : lamonts 1398 CL.mkVar RN.globalsVarName,
574 :     CL.mkVar inState,
575 :     CL.mkVar "x",
576 : jhr 1333 (* FIXME: if nDims = 1, then "y" is not defined! the arguments to this call should really come from
577 :     * the initially code!
578 :     *)
579 : lamonts 1398 CL.mkVar "y"])
580 : jhr 1333 val local_vars = thread_ids
581 : lamonts 1398 @ [imageDataDecl]
582 :     @ imageDataStms
583 : jhr 1333 @ strandDecl
584 :     @ strandObjects
585 :     @ [strandInitStm,status]
586 : lamonts 1351 val while_exp = CL.mkBinOp(CL.mkVar "status",CL.#==, CL.mkVar RN.kActive)
587 : lamonts 1398 val whileBody = CL.mkBlock ([
588 : jhr 1307 CL.mkAssign(CL.mkVar "status",
589 :     CL.mkApply(RN.strandUpdate name,
590 : lamonts 1398 [CL.mkVar inState,
591 :     CL.mkVar outState,
592 :     CL.mkVar RN.globalsVarName,
593 :     CL.mkVar RN.globalImageDataName]))] @ [barrierCode,barrierStm] )
594 : jhr 1307 val whileBlock = [CL.mkWhile(while_exp, whileBody)]
595 : lamonts 1346 val body = CL.mkBlock(local_vars @ whileBlock @ [stabalizeStm])
596 : jhr 1307 in
597 :     CL.D_Func(["__kernel"], CL.voidTy, fName, params, body)
598 :     end
599 : jhr 1358
600 :     (* generate a global structure type definition from the list of globals *)
601 :     fun genGlobalStruct (targetTy, globals, tyName) = let
602 : jhr 1307 val globs = List.map (fn (x : mirror_var) => (targetTy x, #var x)) globals
603 :     in
604 : jhr 1358 CL.D_StructDef(globs, tyName)
605 : jhr 1307 end
606 : lamonts 1398
607 :     (* generate a global structure type definition from the image data of the image globals *)
608 :     fun genImageDataStruct (imgGlobals, tyName) = let
609 :     val globs = List.map (fn (x,_) => (CL.T_Ptr(CL.imageDataTy "__global"),(RN.imageDataName x))) imgGlobals
610 :     in
611 :     CL.D_StructDef(globs, tyName)
612 :     end
613 : lamonts 1341
614 : jhr 1307 fun genGlobals (declFn, targetTy, globals) = let
615 :     fun doVar (x : mirror_var) = declFn (CL.D_Var([], targetTy x, #var x, NONE))
616 :     in
617 :     List.app doVar globals
618 :     end
619 : lamonts 1264
620 : jhr 1326 fun genStrandDesc (Strand{name, output, ...}) = let
621 :     (* the strand's descriptor object *)
622 :     val descI = let
623 :     fun fnPtr (ty, f) = CL.I_Exp(CL.mkCast(CL.T_Named ty, CL.mkVar f))
624 :     val SOME(outTy, _) = !output
625 :     in
626 :     CL.I_Struct[
627 :     ("name", CL.I_Exp(CL.mkStr name)),
628 :     ("stateSzb", CL.I_Exp(CL.mkSizeof(CL.T_Named(N.strandTy name)))),
629 : jhr 1315 (*
630 : jhr 1326 ("outputSzb", CL.I_Exp(CL.mkSizeof(ToC.trTy outTy))),
631 : jhr 1315 *)
632 : jhr 1326 ("update", fnPtr("update_method_t", "0")),
633 : jhr 1382 ("print", fnPtr("print_method_t", name ^ "Print"))
634 : jhr 1326 ]
635 :     end
636 :     val desc = CL.D_Var([], CL.T_Named N.strandDescTy, N.strandDesc name, SOME descI)
637 :     in
638 :     desc
639 :     end
640 : jhr 1315
641 :     (* generate the table of strand descriptors *)
642 : jhr 1326 fun genStrandTable (declFn, strands) = let
643 :     val nStrands = length strands
644 :     fun genInit (Strand{name, ...}) = CL.I_Exp(CL.mkUnOp(CL.%&, CL.E_Var(N.strandDesc name)))
645 :     fun genInits (_, []) = []
646 :     | genInits (i, s::ss) = (i, genInit s) :: genInits(i+1, ss)
647 :     in
648 :     declFn (CL.D_Var([], CL.int32, N.numStrands,
649 :     SOME(CL.I_Exp(CL.E_Int(IntInf.fromInt nStrands, CL.int32)))));
650 :     declFn (CL.D_Var([],
651 :     CL.T_Array(CL.T_Ptr(CL.T_Named N.strandDescTy), SOME nStrands),
652 :     N.strands,
653 :     SOME(CL.I_Array(genInits (0, strands)))))
654 :     end
655 : jhr 1315
656 : jhr 1308 fun genSrc (baseName, prog) = let
657 : jhr 1326 val Prog{name,double, globals, topDecls, strands, initially, imgGlobals, numDims, ...} = prog
658 : jhr 1307 val clFileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "cl"}
659 :     val cFileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "c"}
660 :     val clOutS = TextIO.openOut clFileName
661 :     val cOutS = TextIO.openOut cFileName
662 :     val clppStrm = PrintAsCL.new clOutS
663 :     val cppStrm = PrintAsC.new cOutS
664 : jhr 1321 val progName = name
665 : jhr 1307 fun cppDecl dcl = PrintAsC.output(cppStrm, dcl)
666 :     fun clppDecl dcl = PrintAsCL.output(clppStrm, dcl)
667 :     val strands = AtomTable.listItems strands
668 :     val [strand as Strand{name, tyName, code, init_code, ...}] = strands
669 :     in
670 : jhr 1273 (* Generate the OpenCl file *)
671 :     clppDecl (CL.D_Verbatim([
672 :     if double
673 :     then "#define DIDEROT_DOUBLE_PRECISION"
674 :     else "#define DIDEROT_SINGLE_PRECISION",
675 :     "#define DIDEROT_TARGET_CL",
676 : lamonts 1305 "#include \"Diderot/cl-diderot.h\""
677 : jhr 1273 ]));
678 : jhr 1358 clppDecl (genGlobalStruct (#gpuTy, !globals, RN.globalsTy));
679 : lamonts 1398 clppDecl (genImageDataStruct(!imgGlobals,RN.imageDataType));
680 : jhr 1307 clppDecl (genStrandTyDef(#gpuTy, strand));
681 : jhr 1326 clppDecl (!init_code);
682 : jhr 1273 List.app clppDecl (!code);
683 : lamonts 1328 clppDecl (genKernelFun (strand, !numDims, globals, imgGlobals));
684 :     (* Generate the Host C file *)
685 : jhr 1273 cppDecl (CL.D_Verbatim([
686 :     if double
687 :     then "#define DIDEROT_DOUBLE_PRECISION"
688 :     else "#define DIDEROT_SINGLE_PRECISION",
689 :     "#define DIDEROT_TARGET_CL",
690 :     "#include \"Diderot/diderot.h\""
691 :     ]));
692 : jhr 1326 cppDecl (CL.D_Var(["static"], CL.charPtr, "ProgramName",
693 :     SOME(CL.I_Exp(CL.mkStr progName))));
694 : jhr 1358 cppDecl (genGlobalStruct (#hostTy, !globals, RN.globalsTy));
695 :     cppDecl (genGlobalStruct (#shadowTy, !globals, RN.shadowGlobalsTy));
696 :     (* FIXME: does this really need to be a global? *)
697 :     cppDecl (CL.D_Var(["static"], globPtrTy, RN.globalsVarName, NONE));
698 : jhr 1308 cppDecl (genStrandTyDef (#hostTy, strand));
699 : jhr 1307 cppDecl (genStrandPrint strand);
700 : jhr 1273 List.app cppDecl (List.rev (!topDecls));
701 : lamonts 1398 cppDecl (genGlobalBuffersArgs (!globals,imgGlobals));
702 : jhr 1326 List.app (fn strand => cppDecl (genStrandDesc strand)) strands;
703 :     genStrandTable (cppDecl, strands);
704 : jhr 1307 cppDecl (!initially);
705 :     PrintAsC.close cppStrm;
706 :     PrintAsCL.close clppStrm;
707 :     TextIO.closeOut cOutS;
708 :     TextIO.closeOut clOutS
709 :     end
710 : lamonts 1264
711 : jhr 1358 (* output the code to the filesystem. The string is the basename of the source file *)
712 : jhr 1307 fun generate (basename, prog as Prog{double, parallel, debug, ...}) = let
713 :     fun condCons (true, x, xs) = x::xs
714 :     | condCons (false, _, xs) = xs
715 :     (* generate the C compiler flags *)
716 :     val cflags = ["-I" ^ Paths.diderotInclude, "-I" ^ Paths.teemInclude]
717 :     val cflags = condCons (parallel, #pthread Paths.cflags, cflags)
718 :     val cflags = if debug
719 :     then #debug Paths.cflags :: cflags
720 :     else #ndebug Paths.cflags :: cflags
721 :     val cflags = #base Paths.cflags :: cflags
722 :     (* generate the loader flags *)
723 :     val extraLibs = condCons (parallel, #pthread Paths.extraLibs, [])
724 :     val extraLibs = Paths.teemLinkFlags @ #base Paths.extraLibs :: extraLibs
725 :     val extraLibs = #cl Paths.extraLibs :: extraLibs
726 :     val rtLib = TargetUtil.runtimeName {
727 :     target = TargetUtil.TARGET_CL,
728 :     parallel = parallel, double = double, debug = debug
729 :     }
730 :     val ldOpts = rtLib :: extraLibs
731 :     in
732 : lamonts 1341 genSrc (basename, prog);
733 : jhr 1307 RunCC.compile (basename, cflags);
734 :     RunCC.link (basename, ldOpts)
735 : jhr 1273 end
736 : lamonts 1244
737 : jhr 1273 end
738 : lamonts 1264
739 : lamonts 1244 (* strands *)
740 :     structure Strand =
741 :     struct
742 : jhr 1261 fun define (Prog{strands, ...}, strandId) = let
743 :     val name = Atom.toString strandId
744 :     val strand = Strand{
745 :     name = name,
746 :     tyName = RN.strandTy name,
747 :     state = ref [],
748 :     output = ref NONE,
749 : lamonts 1271 code = ref [],
750 : jhr 1273 init_code = ref (CL.D_Comment(["no init code"]))
751 : jhr 1261 }
752 :     in
753 :     AtomTable.insert strands (strandId, strand);
754 :     strand
755 :     end
756 : lamonts 1244
757 :     (* return the strand with the given name *)
758 : jhr 1261 fun lookup (Prog{strands, ...}, strandId) = AtomTable.lookup strands strandId
759 : lamonts 1244
760 :     (* register the strand-state initialization code. The variables are the strand
761 :     * parameters.
762 :     *)
763 : jhr 1308 fun init (Strand{name, tyName, code, init_code, ...}, params, init) = let
764 : jhr 1261 val fName = RN.strandInit name
765 :     val params =
766 : jhr 1343 globalParam (globPtrTy, RN.globalsVarName) ::
767 :     globalParam (CL.T_Ptr(CL.T_Named tyName), "selfOut") ::
768 : jhr 1273 List.map (fn (ToCL.V(ty, x)) => CL.PARAM([], ty, x)) params
769 : jhr 1261 val initFn = CL.D_Func([], CL.voidTy, fName, params, init)
770 :     in
771 : jhr 1273 init_code := initFn
772 : jhr 1261 end
773 : jhr 1358
774 : lamonts 1244 (* register a strand method *)
775 : lamonts 1271 fun method (Strand{name, tyName, code,...}, methName, body) = let
776 : jhr 1358 val fName = concat[name, "_", methName]
777 : jhr 1261 val params = [
778 : jhr 1343 globalParam (CL.T_Ptr(CL.T_Named tyName), "selfIn"),
779 :     globalParam (CL.T_Ptr(CL.T_Named tyName), "selfOut"),
780 : lamonts 1398 globalParam (CL.T_Ptr(CL.T_Named (RN.globalsTy)), RN.globalsVarName),
781 :     CL.PARAM([],CL.T_Named(RN.imageDataType),RN.globalImageDataName)
782 : jhr 1261 ]
783 :     val methFn = CL.D_Func([], CL.int32, fName, params, body)
784 :     in
785 : jhr 1273 code := methFn :: !code
786 : jhr 1261 end
787 :    
788 : jhr 1273 fun output (Strand{output, ...}, ty, ToCL.V(_, x)) = output := SOME(ty, x)
789 : lamonts 1244
790 :     end
791 :    
792 :     end
793 :    
794 :     structure CLBackEnd = CodeGenFn(CLTarget)

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