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

SCM Repository

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

Annotation of /branches/vis12/src/compiler/cl-target/cl-target.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3291 - (view) (download)

1 : jhr 1671 (* cl-target.sml
2 :     *
3 : jhr 3291 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 : jhr 1671 * All rights reserved.
7 :     *)
8 :    
9 :     structure CLTarget : TARGET =
10 :     struct
11 :    
12 :     structure IL = TreeIL
13 :     structure V = IL.Var
14 :     structure Ty = IL.Ty
15 :     structure CL = CLang
16 : jhr 3098 structure CN = CNames
17 :     structure ON = OCLNames
18 : jhr 2102 structure ToC = TreeToC
19 : jhr 1671 structure ToCL = TreeToCL
20 :     structure HF = CLHeaderFrag
21 :     structure SF = CLSchedFrag
22 : jhr 3098 structure RN = OldRuntimeNames
23 : jhr 1671
24 :     (* revmap f l == List.rev(List.map f l) *)
25 :     fun revmap f = let
26 :     fun rmap ([], l) = l
27 :     | rmap (x::r, l) = rmap (r, f x :: l)
28 :     in
29 :     fn l => rmap (l, [])
30 :     end
31 :    
32 :     (* common arithmetic *)
33 :     fun #+# (a, b) = CL.mkBinOp(a, CL.#+, b)
34 :     fun #*# (a, b) = CL.mkBinOp(a, CL.#*, b)
35 :     infix 5 #+#
36 :     infix 6 #*#
37 :    
38 :     (* translate TreeIL types to shadow types *)
39 :     fun shadowTy ty = (case ty
40 :     of Ty.BoolTy => CL.T_Named "cl_uint"
41 :     | Ty.IntTy => CL.T_Named(RN.shadowIntTy ())
42 :     | Ty.TensorTy[] => CL.T_Named(RN.shadowRealTy ())
43 :     | Ty.TensorTy[n] => CL.T_Named(RN.shadowVecTy n)
44 :     | Ty.TensorTy[n, m] => CL.T_Named(RN.shadowMatTy(n,m))
45 : jhr 1793 | Ty.ImageTy info => CL.T_Named(RN.shadowImageTy(ImageInfo.dim info))
46 : jhr 1671 | _ => raise Fail(concat["TreeToC.trType(", Ty.toString ty, ")"])
47 :     (* end case *))
48 :    
49 :     (* FIXME: add comments that more clearly explain the difference between convertToShadow and
50 :     * convertStrandToShadow
51 :     *)
52 :     (* translate TreeIL types to shadow types *)
53 :     fun convertToShadow (ty, name) = (case ty
54 :     of Ty.IntTy => CL.mkAssign(
55 :     CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name),
56 :     CL.mkIndirect(CL.mkVar RN.globalsVarName, name))
57 :     | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [
58 :     CL.mkUnOp(CL.%&, CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name)),
59 :     CL.mkIndirect(CL.mkVar RN.globalsVarName, name)
60 :     ])
61 : jhr 1793 | Ty.ImageTy info => CL.mkCall(RN.shadowImageFunc(ImageInfo.dim info), [
62 : jhr 1671 CL.mkVar "context",
63 :     CL.mkUnOp(CL.%&, CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name)),
64 :     CL.mkIndirect(CL.mkVar RN.globalsVarName, name)
65 :     ])
66 :     | Ty.TensorTy[n, m] => CL.mkCall(RN.convertToShadowMat(m,n), [
67 :     CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name),
68 :     CL.mkIndirect(CL.mkVar RN.globalsVarName, name)
69 :     ])
70 :     | _ => CL.mkAssign(
71 :     CL.mkSelect(CL.mkVar RN.shadowGlaobalsName,name),
72 :     CL.mkIndirect(CL.mkVar RN.globalsVarName, name))
73 :     (* end case *))
74 :    
75 :     (* generate code to convert strand TreeIL types to shadow types *)
76 :     fun convertStrandToShadow (ty, name, selfIn, selfOut) = (case ty
77 :     of Ty.IntTy => CL.mkAssign(
78 :     CL.mkIndirect(CL.mkVar selfIn, name),
79 :     CL.mkIndirect(CL.mkVar selfOut, name))
80 :     | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [
81 :     CL.mkUnOp(CL.%&, CL.mkIndirect(CL.mkVar selfIn, name)),
82 :     CL.mkIndirect(CL.mkVar selfOut, name)
83 :     ])
84 :     | Ty.TensorTy[n, m] => CL.mkCall(RN.convertToShadowMat(m,n), [
85 :     CL.mkUnOp(CL.%&, CL.mkIndirect(CL.mkVar selfIn, name)),
86 :     CL.mkIndirect(CL.mkVar selfOut, name)
87 :     ])
88 :     | _ => CL.mkAssign(
89 :     CL.mkIndirect(CL.mkVar selfIn, name),
90 :     CL.mkIndirect(CL.mkVar selfOut, name))
91 :     (* end case *))
92 :    
93 :     (* helper functions for specifying parameters in various address spaces *)
94 : jhr 1853 fun clParam spc (ty, x) = CL.PARAM([spc], ty, x)
95 :     val globalParam = clParam "__global"
96 :     val constantParam = clParam "__constant"
97 :     val localParam = clParam "__local"
98 :     val privateParam = clParam "__private"
99 : jhr 1671
100 :     (* OpenCL global pointer type *)
101 :     fun globalPtr ty = CL.T_Qual("__global", CL.T_Ptr ty)
102 :    
103 :     (* lvalue/rvalue state variable *)
104 :     fun lvalueSV name = CL.mkIndirect(CL.mkVar "selfOut", name)
105 :     fun rvalueSV name = CL.mkIndirect(CL.mkVar "selfIn", name)
106 :    
107 :     type var = CL.typed_var
108 :     type exp = CL.exp
109 :     type stm = CL.stm
110 :    
111 :     (* OpenCL specific types *)
112 :     val clIntTy = CL.T_Named "cl_int"
113 :     val clProgramTy = CL.T_Named "cl_program"
114 :     val clKernelTy = CL.T_Named "cl_kernel"
115 :     val clCmdQueueTy = CL.T_Named "cl_command_queue"
116 :     val clContextTy = CL.T_Named "cl_context"
117 :     val clDeviceIdTy = CL.T_Named "cl_device_id"
118 :     val clPlatformIdTy = CL.T_Named "cl_platform_id"
119 :     val clMemoryTy = CL.T_Named "cl_mem"
120 :     val globPtrTy = CL.T_Ptr(CL.T_Named RN.globalsTy)
121 :     (* FIXME: what are these for? *)
122 :     datatype shadow_env = STRAND_SHADOW | GLOBAL_SHADOW
123 :    
124 :     (* variable or field that is mirrored between host and GPU *)
125 :     type mirror_var = {
126 :     (* FIXME: perhaps it would be cleaner to just track the TreeIL type of the variable? *)
127 :     hostTy : CL.ty, (* variable type on Host (i.e., C type) *)
128 :     shadowTy : CL.ty, (* host-side shadow type of GPU type *)
129 :     gpuTy : CL.ty, (* variable's type on GPU (i.e., OpenCL type) *)
130 :     hToS: stm, (* the statement that converts the variable to its *)
131 :     (* shadow representation *)
132 :     var : CL.var (* variable name *)
133 :     }
134 :    
135 :     datatype strand = Strand of {
136 :     name : string,
137 :     tyName : string,
138 :     state : mirror_var list,
139 : jhr 2815 output : (Ty.ty * CL.var), (* the strand's output variable (only one for now) *)
140 : jhr 1671 code : CL.decl list ref,
141 :     init_code: CL.decl ref
142 :     }
143 :    
144 :     datatype program = Prog of {
145 : jhr 2815 props : Properties.props,
146 : jhr 1671 globals : mirror_var list ref,
147 :     topDecls : CL.decl list ref,
148 :     strands : strand AtomTable.hash_table,
149 :     initially : CL.decl ref,
150 :     numDims: int ref, (* number of dimensions in initially iteration *)
151 :     imgGlobals: (string * int) list ref,
152 :     prFn: CL.decl ref,
153 :     outFn: CL.decl ref
154 :     }
155 :    
156 :     datatype env = ENV of {
157 :     info : env_info,
158 :     vMap : var V.Map.map,
159 :     scope : scope
160 :     }
161 :    
162 :     and env_info = INFO of {
163 :     prog : program
164 :     }
165 :    
166 :     and scope
167 :     = NoScope
168 :     | GlobalScope
169 :     | InitiallyScope
170 : jhr 2815 | StrandScope (* strand initialization *)
171 :     | MethodScope of StrandUtil.method_name (* method body; vars are state variables *)
172 : jhr 1671
173 :     (* the supprted widths of vectors of reals on the target. *)
174 :     (* FIXME: for OpenCL 1.1, 3 is also valid *)
175 :     fun vectorWidths () = [2, 4, 8, 16]
176 :    
177 :     (* we do not support printing on the OpenCL target *)
178 :     val supportsPrinting = false
179 :    
180 :     (* tests for whether various expression forms can appear inline *)
181 :     fun inlineCons n = (n < 2) (* vectors are inline, but not matrices *)
182 :     val inlineMatrixExp = false (* can matrix-valued expressions appear inline? *)
183 :    
184 :     (* TreeIL to target translations *)
185 :     structure Tr =
186 :     struct
187 :     fun fragment (ENV{info, vMap, scope}, blk) = let
188 :     val (vMap, stms) = (case scope
189 :     of GlobalScope => ToC.trFragment (vMap, blk)
190 :     | InitiallyScope => ToC.trFragment (vMap, blk)
191 :     | _ => ToCL.trFragment (vMap, blk)
192 :     (* end case *))
193 :     in
194 :     (ENV{info=info, vMap=vMap, scope=scope}, stms)
195 :     end
196 :     fun block (ENV{vMap, scope, ...}, blk) = (case scope
197 : jhr 2815 of StrandScope => ToC.trBlock (vMap, blk)
198 :     | MethodScope name => ToCL.trBlock (vMap, blk)
199 :     | InitiallyScope => ToCL.trBlock (vMap, blk)
200 :     | _ => ToC.trBlock (vMap, blk)
201 :     (* end case *))
202 : jhr 1671 fun exp (ENV{vMap, ...}, e) = ToCL.trExp(vMap, e)
203 :     end
204 :    
205 :     (* variables *)
206 :     structure Var =
207 :     struct
208 :     fun mirror (ty, name, shadowEnv) = {
209 :     hostTy = ToC.trType ty,
210 :     shadowTy = shadowTy ty,
211 :     gpuTy = ToCL.trType ty,
212 :     hToS = case shadowEnv
213 : jhr 2815 of GLOBAL_SHADOW => convertToShadow (ty, name)
214 :     | STRAND_SHADOW => convertStrandToShadow(ty, name, "selfIn", "selfOut")
215 :     (* end case *),
216 : jhr 1671 var = name
217 :     }
218 :     fun name (ToCL.V(_, name)) = name
219 : jhr 2796 fun global (Prog{globals, imgGlobals, ...}, gv) = let
220 : jhr 2815 val ty = IL.GlobalVar.ty gv
221 :     val name = IL.GlobalVar.name gv
222 : jhr 1671 val x = mirror (ty, name, GLOBAL_SHADOW)
223 : jhr 1793 fun isImgGlobal (Ty.ImageTy info, name) =
224 :     imgGlobals := (name, ImageInfo.dim info) :: !imgGlobals
225 : jhr 1671 | isImgGlobal _ = ()
226 :     in
227 :     globals := x :: !globals;
228 :     isImgGlobal (ty, name);
229 :     ToCL.V(#gpuTy x, name)
230 :     end
231 :     fun param x = ToCL.V(ToCL.trType(V.ty x), V.name x)
232 :     end
233 :    
234 :     (* environments *)
235 :     structure Env =
236 :     struct
237 :     (* create a new environment *)
238 :     fun new prog = ENV{
239 :     info=INFO{prog = prog},
240 :     vMap = V.Map.empty,
241 :     scope = NoScope
242 :     }
243 :     (* bind a TreeIL varaiable to a target variable *)
244 :     fun bind (ENV{info, vMap, scope}, x, x') = ENV{
245 :     info = info,
246 :     vMap = V.Map.insert(vMap, x, x'),
247 :     scope = scope
248 :     }
249 : jhr 2102 (* define the current translation context *)
250 : jhr 2815 fun setScope (scope, glob, selfIn, selfOut) (ENV{info, vMap, ...}) = ENV{
251 :     info = info,
252 :     vMap = List.foldl
253 :     (fn ((x, x'), vm) => V.Map.insert(vm, x, x'))
254 :     vMap [
255 :     (PseudoVars.global, CL.V(CL.voidTy, glob)),
256 :     (PseudoVars.selfIn, CL.V(CL.voidTy, selfIn)),
257 :     (PseudoVars.selfOut, CL.V(CL.voidTy, selfOut))
258 :     ],
259 :     scope = scope
260 :     }
261 : jhr 2102 (* define the current translation context *)
262 :     val scopeGlobal = setScope (GlobalScope, RN.globalsVarName, "_bogus_", "_bogus_")
263 :     val scopeInitially =
264 : jhr 2815 setScope (InitiallyScope, RN.globalsVarName, "_bogus_", "_bogus_")
265 : jhr 2102 val scopeStrand = setScope (StrandScope, RN.globalsVarName, "selfIn", "selfOut")
266 :     fun scopeMethod (env, name) =
267 : jhr 2815 setScope (MethodScope name, RN.globalsVarName, "selfIn", "selfOut") env
268 : jhr 1671 end
269 :    
270 : jhr 1853 (* strands *)
271 :     structure Strand =
272 :     struct
273 :    
274 :     fun define (Prog{strands, ...}, strandId, state) = let
275 :     val name = Atom.toString strandId
276 :     (* the output state variable *)
277 :     val outputVar = (case List.filter IL.StateVar.isOutput state
278 :     of [] => raise Fail("no output specified for strand " ^ name)
279 :     | [x] => (IL.StateVar.ty x, IL.StateVar.name x)
280 :     | _ => raise Fail("multiple outputs in " ^ name)
281 :     (* end case *))
282 :     (* the state variables *)
283 :     val state = let
284 :     fun cvt x = Var.mirror (IL.StateVar.ty x, IL.StateVar.name x, STRAND_SHADOW)
285 :     in
286 :     List.map cvt state
287 :     end
288 :     val strand = Strand{
289 :     name = name,
290 :     tyName = RN.strandTy name,
291 :     state = state,
292 :     output = outputVar,
293 :     code = ref [],
294 :     init_code = ref (CL.D_Comment(["no init code"]))
295 :     }
296 :     in
297 :     AtomTable.insert strands (strandId, strand);
298 :     strand
299 :     end
300 :    
301 :     (* return the strand with the given name *)
302 :     fun lookup (Prog{strands, ...}, strandId) = AtomTable.lookup strands strandId
303 :    
304 :     (* register the strand-state initialization code. The variables are the strand
305 :     * parameters.
306 :     *)
307 :     fun init (Strand{name, tyName, code, init_code, ...}, params, init) = let
308 :     val fName = RN.strandInit name
309 :     val params =
310 :     clParam "" (CL.T_Ptr(CL.T_Named tyName), "selfOut") ::
311 :     List.map (fn (ToCL.V(ty, x)) => CL.PARAM([], ty, x)) params
312 :     val initFn = CL.D_Func([], CL.voidTy, fName, params, init)
313 :     in
314 :     init_code := initFn
315 :     end
316 :    
317 :     (* register a strand method *)
318 :     fun method (Strand{name, tyName, code,...}, methName, body) = let
319 :     val params = [
320 :     globalParam (CL.T_Ptr(CL.T_Named tyName), "selfIn"),
321 :     globalParam (CL.T_Ptr(CL.T_Named tyName), "selfOut"),
322 :     globalParam (CL.T_Ptr(CL.T_Named (RN.globalsTy)), RN.globalsVarName),
323 :     clParam "" (CL.T_Named(RN.imageDataType), RN.globalImageDataName)
324 :     ]
325 :     val (fName,resTy) = (case methName
326 :     of StrandUtil.Update => (RN.strandUpdate,CL.T_Named "StrandStatus_t")
327 :     | StrandUtil.Stabilize => (name ^ StrandUtil.nameToString methName, CL.voidTy)
328 :     (* end case *))
329 :     val methFn = CL.D_Func([], resTy, fName, params, body)
330 :     in
331 :     code := methFn :: !code
332 :     end
333 :    
334 :     end (* Strand *)
335 :    
336 : jhr 1671 (* programs *)
337 :     structure Program =
338 :     struct
339 : jhr 2076 fun new (tgt : TargetUtil.target_desc, props) = (
340 : jhr 2708 CNames.initTargetSpec tgt;
341 : jhr 1671 Prog{
342 : jhr 2082 props = Properties.mkProps (tgt, props),
343 : jhr 1671 globals = ref [],
344 :     topDecls = ref [],
345 :     strands = AtomTable.mkTable (16, Fail "strand table"),
346 :     initially = ref(CL.D_Comment["missing initially"]),
347 :     numDims = ref 0,
348 :     imgGlobals = ref[],
349 :     prFn = ref(CL.D_Comment(["No Print Function"])),
350 :     outFn = ref(CL.D_Comment(["No Output Function"]))
351 :     })
352 :    
353 :     (* register the code that is used to register command-line options for input variables *)
354 : jhr 1803 fun inputs (Prog{topDecls, ...}, env, blk) = let
355 : jhr 1671 val inputsFn = CL.D_Func(
356 :     [], CL.voidTy, RN.registerOpts,
357 :     [CL.PARAM([], CL.T_Ptr(CL.T_Named RN.optionsTy), "opts")],
358 : jhr 1803 Tr.block (env, blk))
359 : jhr 1671 in
360 :     topDecls := inputsFn :: !topDecls
361 :     end
362 :    
363 :     (* register the global initialization part of a program *)
364 : jhr 3098 fun init (Prog{props, topDecls, ...}, init) = let
365 : jhr 1671 val globalsDecl = CL.mkAssign(CL.mkVar RN.globalsVarName,
366 :     CL.mkApply("malloc", [CL.mkSizeof(CL.T_Named RN.globalsTy)]))
367 :     val initFn = CL.D_Func(
368 :     [], CL.voidTy, RN.initGlobals, [],
369 :     CL.mkBlock[
370 :     globalsDecl,
371 :     CL.mkCall(RN.initGlobalsHelper, [CL.mkVar RN.globalsVarName])
372 :     ])
373 :     val initHelperFn = CL.D_Func(
374 :     [], CL.voidTy, RN.initGlobalsHelper,
375 :     [CL.PARAM([], globPtrTy, RN.globalsVarName)],
376 :     init)
377 :     val shutdownFn = CL.D_Func(
378 :     [], CL.voidTy, RN.shutdown,
379 : jhr 3098 [CL.PARAM([], CN.worldPtrTy props, "wrld")],
380 : jhr 1671 CL.S_Block[])
381 :     in
382 :     topDecls := shutdownFn :: initFn :: initHelperFn :: !topDecls
383 :     end
384 : nseltzer 1870 (* register the global destruction part of a program *)
385 : jhr 2815 fun free (_, _, []) = ()
386 :     | free (Prog{props, topDecls, ...}, env, globals) = let
387 : jhr 3098 val worldTy = CN.worldPtrTy props
388 : jhr 2811 fun freeGlob (x, stms) = stms (* FIXME *)
389 :     val body = CL.mkBlock(List.foldr freeGlob [CL.mkReturn(SOME(CL.mkVar "false"))] globals)
390 : nseltzer 1870 val freeFn = CL.D_Func(
391 : jhr 3098 ["static"], CL.boolTy, CN.freeGlobals,
392 : nseltzer 1870 [CL.PARAM([], worldTy, "wrld")],
393 : jhr 2811 body)
394 : nseltzer 1870 in
395 :     topDecls := freeFn :: !topDecls
396 :     end
397 : jhr 1671
398 :     (* create and register the initially function for a program *)
399 :     fun initially {
400 : jhr 2082 prog = Prog{props, strands, initially, numDims, ...},
401 : jhr 1671 iterPrefix : stm list,
402 :     iters : (var * exp * exp) list,
403 :     createPrefix : stm list,
404 :     strand : Atom.atom,
405 :     args : exp list
406 :     } = let
407 :     val name = Atom.toString strand
408 :     val nDims = List.length iters
409 : jhr 3098 val worldTy = CN.worldPtrTy props
410 : jhr 1671 fun mapi f xs = let
411 :     fun mapf (_, []) = []
412 :     | mapf (i, x::xs) = f(i, x) :: mapf(i+1, xs)
413 :     in
414 :     mapf (0, xs)
415 :     end
416 :     val baseInit = mapi (fn (i, (_, e, _)) => (i, CL.I_Exp e)) iters
417 :     val sizeInit = mapi
418 :     (fn (i, (CL.V(ty, _), lo, hi)) =>
419 :     (i, CL.I_Exp(CL.mkBinOp(hi, CL.#-, lo) #+# CL.mkIntTy(1, ty)))
420 :     ) iters
421 :     (* code to allocate the world and initial strands *)
422 :     val wrld = "wrld"
423 :     val allocCode = [
424 :     CL.mkComment["allocate initial block of strands"],
425 :     CL.mkDecl(CL.T_Array(CL.int32, SOME nDims), "base", SOME(CL.I_Array baseInit)),
426 :     CL.mkDecl(CL.T_Array(CL.uint32, SOME nDims), "size", SOME(CL.I_Array sizeInit)),
427 :     CL.mkDecl(worldTy, wrld,
428 : jhr 3098 SOME(CL.I_Exp(CL.mkApply(CN.allocInitially, [
429 : jhr 1671 CL.mkVar "ProgramName",
430 : jhr 3098 CL.mkUnOp(CL.%&, CL.mkVar(CN.strandDesc name)),
431 : jhr 2786 CL.mkBool(#isArray props),
432 : jhr 1671 CL.mkIntTy(IntInf.fromInt nDims, CL.int32),
433 :     CL.mkVar "base",
434 :     CL.mkVar "size"
435 :     ]))))
436 :     ]
437 :     (* create the loop nest for the initially iterations *)
438 :     val indexVar = "ix"
439 : jhr 3098 val strandTy = ON.strandPtrTy name
440 : jhr 1671 fun mkLoopNest [] = CL.mkBlock(createPrefix @ [
441 :     CL.mkDecl(strandTy, "sp",
442 :     SOME(CL.I_Exp(
443 :     CL.mkCast(strandTy,
444 : jhr 3098 CL.mkApply(RN.inState, [CL.mkVar "wrld", CL.mkVar indexVar]))))),
445 :     CL.mkCall(RN.strandInit name, CL.mkVar "sp" :: args),
446 : jhr 1671 CL.mkAssign(CL.mkVar indexVar, CL.mkVar indexVar #+# CL.mkIntTy(1, CL.uint32))
447 :     ])
448 :     | mkLoopNest ((CL.V(ty, param), lo, hi)::iters) = let
449 :     val body = mkLoopNest iters
450 :     in
451 :     CL.mkFor(
452 :     [(ty, param, lo)],
453 :     CL.mkBinOp(CL.mkVar param, CL.#<=, hi),
454 :     [CL.mkPostOp(CL.mkVar param, CL.^++)],
455 :     body)
456 :     end
457 :     val iterCode = [
458 :     CL.mkComment["initially"],
459 :     CL.mkDecl(CL.uint32, indexVar, SOME(CL.I_Exp(CL.mkIntTy(0, CL.uint32)))),
460 :     mkLoopNest iters
461 :     ]
462 :     val body = CL.mkBlock(
463 :     iterPrefix @
464 :     allocCode @
465 :     iterCode @
466 :     [CL.mkReturn(SOME(CL.mkVar "wrld"))])
467 : jhr 3098 val initFn = CL.D_Func([], worldTy, CN.initially props, [], body)
468 : jhr 1671 in
469 :     numDims := nDims;
470 :     initially := initFn
471 :     end
472 :    
473 :    
474 :     (***** OUTPUT *****)
475 :    
476 :     fun genStrandPrint (Strand{name, tyName, state, output, code, ...}) = let
477 :     (* the print function *)
478 :     val prFnName = concat[name, "Print"]
479 :     val prFn = let
480 :     val params = [
481 :     CL.PARAM([], CL.T_Ptr(CL.T_Named "FILE"), "outS"),
482 :     CL.PARAM([], CL.T_Ptr(CL.T_Named(RN.strandShadowTy tyName)), "self")
483 :     ]
484 :     val (ty, x) = output
485 :     val outState = CL.mkIndirect(CL.mkVar "self", x)
486 :     val prArgs = (case ty
487 : jhr 3098 of Ty.IntTy => [CL.mkStr(!CN.gIntFormat ^ "\n"), outState]
488 : jhr 1671 | Ty.SeqTy(Ty.IntTy, d) => let
489 : jhr 2815 fun sel i = CL.mkApply(
490 :     "VSUB",
491 :     [outState, CL.mkInt(IntInf.fromInt i)])
492 : jhr 1671 val fmt = CL.mkStr(
493 : jhr 3098 String.concatWith " " (List.tabulate(d, fn _ => !CN.gIntFormat))
494 : jhr 1671 ^ "\n")
495 :     val args = List.tabulate (d, sel)
496 :     in
497 :     fmt :: args
498 :     end
499 :     | Ty.TensorTy[] => [CL.mkStr "%f\n", outState]
500 :     | Ty.TensorTy[d] => let
501 : jhr 2815 fun sel i = CL.mkApply(
502 :     "VSUB",
503 :     [outState, CL.mkInt(IntInf.fromInt i)])
504 : jhr 1671 val fmt = CL.mkStr(
505 :     String.concatWith " " (List.tabulate(d, fn _ => "%f"))
506 :     ^ "\n")
507 :     val args = List.tabulate (d, sel)
508 :     in
509 :     fmt :: args
510 :     end
511 :     | _ => raise Fail("genStrand: unsupported output type " ^ Ty.toString ty)
512 :     (* end case *))
513 :     in
514 :     CL.D_Func(["static"], CL.voidTy, prFnName, params,
515 :     CL.mkCall("fprintf", CL.mkVar "outS" :: prArgs))
516 :     end
517 :     in
518 :     prFn
519 :     end
520 :    
521 : jhr 2634 fun genStrandTyDef (targetTy, Strand{state,...}, tyName) = (case state
522 : jhr 2815 of [] => CL.D_Comment(["No Strand Defintiion Included"])
523 :     | _ => CL.D_StructDef(
524 :     NONE,
525 :     revmap (fn x => (targetTy x, #var x)) state,
526 :     SOME tyName)
527 :     (* end case *))
528 : jhr 1671
529 :     (* generates the globals buffers and arguments function *)
530 :     fun genConvertShadowTypes (Strand{name, tyName, state,...}) = let
531 : jhr 1705 (* Declare opencl setup objects *)
532 : jhr 1671 val errVar = "err"
533 :     val params = [
534 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut"),
535 :     CL.PARAM([], CL.T_Ptr(CL.T_Named(RN.strandShadowTy tyName)), "selfIn")
536 :     ]
537 :     val body = List.map (fn (x:mirror_var) => #hToS x) state
538 :     in
539 :     CL.D_Func([], CL.voidTy, RN.strandConvertName name, params, CL.mkBlock body)
540 :     end
541 :    
542 :     (* generates the opencl buffers for the image data *)
543 :     fun getGlobalDataBuffers (globals, imgGlobals, contextVar, errVar) = let
544 :     val globalBuffErr = "error creating OpenCL global buffer\n"
545 :     fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.mkVar errVar, CL.#!=, CL.mkVar "CL_SUCCESS"),
546 :     CL.mkBlock([CL.mkCall("fprintf",[CL.mkVar "stderr", CL.mkStr msg]),
547 :     CL.mkCall("exit",[CL.mkInt 1])]))
548 :     val shadowTypeDecl =
549 : jhr 2815 CL.mkDecl(CL.T_Named(RN.shadowGlobalsTy), RN.shadowGlaobalsName, NONE)
550 : jhr 1671 val globalToShadowStms = List.map (fn (x:mirror_var) => #hToS x) globals
551 :     val globalBufferDecl = CL.mkDecl(clMemoryTy,concat[RN.globalsVarName,"_cl"],NONE)
552 :     val globalBuffer = CL.mkAssign(CL.mkVar(concat[RN.globalsVarName,"_cl"]),
553 :     CL.mkApply("clCreateBuffer", [
554 :     CL.mkVar contextVar,
555 :     CL.mkBinOp(CL.mkVar "CL_MEM_READ_ONLY", CL.#|, CL.mkVar "CL_MEM_COPY_HOST_PTR"),
556 :     CL.mkSizeof(CL.T_Named RN.shadowGlobalsTy),
557 :     CL.mkUnOp(CL.%&,CL.mkVar RN.shadowGlaobalsName),
558 :     CL.mkUnOp(CL.%&,CL.mkVar errVar)
559 :     ]))
560 :     fun genDataBuffers ([],_,_,_) = []
561 :     | genDataBuffers ((var,nDims)::globals, contextVar, errVar,errFn) = let
562 :     val hostVar = CL.mkIndirect(CL.mkVar RN.globalsVarName, var)
563 :     val size = CL.mkIndirect(hostVar, "dataSzb")
564 :     in
565 :     CL.mkDecl(clMemoryTy, RN.addBufferSuffixData var ,NONE) ::
566 :     CL.mkAssign(CL.mkVar(RN.addBufferSuffixData var),
567 :     CL.mkApply("clCreateBuffer", [
568 :     CL.mkVar contextVar,
569 :     CL.mkVar "CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR",
570 :     size,
571 :     CL.mkIndirect(hostVar, "data"),
572 :     CL.mkUnOp(CL.%&,CL.mkVar errVar)
573 :     ])) ::
574 :     errFn(concat["error in creating ",RN.addBufferSuffixData var, " global buffer\n"]) ::
575 :     genDataBuffers(globals,contextVar,errVar,errFn)
576 :     end
577 :     in
578 :     [shadowTypeDecl] @ globalToShadowStms
579 :     @ [globalBufferDecl, globalBuffer,errorFn(globalBuffErr)]
580 :     @ genDataBuffers(imgGlobals,contextVar,errVar,errorFn)
581 :     end
582 :    
583 :     (* generates the kernel arguments for the image data *)
584 :     fun genGlobalArguments (globals, count, kernelVar, errVar) = let
585 :     val globalArgErr = "error creating OpenCL global argument\n"
586 :     fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.mkVar errVar, CL.#!=, CL.mkVar "CL_SUCCESS"),
587 :     CL.mkBlock([CL.mkCall("fprintf",[CL.mkVar "stderr", CL.mkStr msg]),
588 :     CL.mkCall("exit",[CL.mkInt 1])]))
589 :     val globalArgument = CL.mkExpStm(CL.mkAssignOp(CL.mkVar errVar,CL.&=,
590 :     CL.mkApply("clSetKernelArg",
591 :     [CL.mkVar kernelVar,
592 :     CL.mkPostOp(CL.mkVar count, CL.^++),
593 :     CL.mkApply("sizeof",[CL.mkVar "cl_mem"]),
594 :     CL.mkUnOp(CL.%&,CL.mkVar(concat[RN.globalsVarName,"_cl"]))])))
595 :     fun genDataArguments ([],_,_,_,_) = []
596 :     | genDataArguments ((var,nDims)::globals,count,kernelVar,errVar,errFn) =
597 :     CL.mkExpStm(CL.mkAssignOp(CL.mkVar errVar,CL.$=,
598 :     CL.mkApply("clSetKernelArg",
599 :     [CL.mkVar kernelVar,
600 :     CL.mkPostOp(CL.mkVar count, CL.^++),
601 :     CL.mkApply("sizeof",[CL.mkVar "cl_mem"]),
602 :     CL.mkUnOp(CL.%&,CL.mkVar(RN.addBufferSuffixData var))]))) ::
603 :     errFn(concat["error in creating ",RN.addBufferSuffixData var, " argument\n"]) ::
604 :     genDataArguments (globals,count,kernelVar,errVar,errFn)
605 :     in
606 :     globalArgument :: errorFn globalArgErr ::
607 :     genDataArguments(globals, count, kernelVar, errVar,errorFn)
608 :     end
609 :    
610 :     (* generates the globals buffers and arguments function *)
611 :     fun genGlobalBuffersArgs (globals,imgGlobals) = let
612 :     (* Delcare opencl setup objects *)
613 :     val errVar = "err"
614 :     val params = [
615 :     CL.PARAM([],CL.T_Named("cl_context"), "context"),
616 :     CL.PARAM([],CL.T_Named("cl_kernel"), "kernel"),
617 :     CL.PARAM([],CL.T_Named("cl_command_queue"), "cmdQ"),
618 :     CL.PARAM([],CL.T_Named("int"), "argStart")
619 :     ]
620 :     val body = (case globals
621 : jhr 2815 of [] => [CL.mkReturn(NONE)]
622 :     | _ => let
623 :     val clGlobalBuffers =
624 :     getGlobalDataBuffers(globals, !imgGlobals, "context", errVar)
625 :     val clGlobalArguments =
626 :     genGlobalArguments(!imgGlobals, "argStart", "kernel", errVar)
627 : jhr 1671 in
628 :     (* Body: put all the statments together *)
629 : jhr 2815 CL.mkDecl(clIntTy, errVar, SOME(CL.I_Exp(CL.mkInt 0)))
630 :     :: clGlobalBuffers @ clGlobalArguments
631 : jhr 1671 end
632 : jhr 2815 (*end of case*))
633 : jhr 1671 in
634 :     CL.D_Func([],CL.voidTy,RN.globalsSetupName,params,CL.mkBlock(body))
635 :     end
636 :    
637 :     (* generate the global image meta-data and data parameters *)
638 :     fun genKeneralGlobalParams ((name,tyname)::[],line) =
639 : jhr 2815 concat[line, "__global void *", RN.addBufferSuffixData name]
640 : jhr 1671 | genKeneralGlobalParams ([],line) = line
641 :     | genKeneralGlobalParams ((name,tyname)::rest, line) =
642 : jhr 2815 genKeneralGlobalParams(rest, concat[line, "__global void *", RN.addBufferSuffixData name, ",\n"])
643 : jhr 1671
644 : jhr 2815 fun genUpdateMethod (Strand{name, tyName, state,...}, globals, imgGlobals) = let
645 :     val imageDataStms = List.map
646 :     (fn (x,_) => concat[
647 :     RN.globalImageDataName, ".", RN.imageDataName x, " = ",
648 :     RN.addBufferSuffixData x, ";","\n"
649 :     ])
650 :     (!imgGlobals)
651 :     fun select ([], a, _) = a
652 :     | select (_, _, b) = b
653 :     val placeHolders = [
654 :     (RN.place_holders, tyName),
655 :     (RN.p_addDatPtr, select (!imgGlobals, "", ",")),
656 :     (RN.p_addGlobals, select (!globals, "", ",")),
657 :     (RN.p_globals, select (!globals, "", "__global Diderot_Globals_t *diderotGlobals")),
658 :     (RN.p_globalVar, select (!globals, "0", RN.globalsVarName)),
659 :     (RN.p_dataVar, select (!globals, "0", RN.globalImageDataName)),
660 :     (RN.p_dataPtr, genKeneralGlobalParams (!imgGlobals, "")),
661 :     (RN.p_dataAssign, select (!imgGlobals, "",
662 :     String.concat("Diderot_data_ptr_t diderotDataPtrs;\n" :: imageDataStms)))
663 :     ]
664 :     in
665 :     CL.verbatimDcl [CLUpdateFrag.text] placeHolders
666 :     end
667 : jhr 1671
668 : jhr 2815 fun genStrandCopy(Strand{tyName,name,state,...}) = let
669 :     val params = [
670 :     CL.PARAM(["__global"], CL.T_Ptr(CL.T_Named tyName), "selfIn"),
671 :     CL.PARAM(["__global"], CL.T_Ptr(CL.T_Named tyName), "selfOut")
672 :     ]
673 :     val assignStms = List.rev(
674 :     List.map
675 :     (fn x => CL.mkAssign(lvalueSV(#var x), rvalueSV(#var x)))
676 :     state)
677 :     in
678 :     CL.D_Func([""], CL.voidTy, RN.strandCopy, params,CL.mkBlock(assignStms))
679 :     end
680 : jhr 1671
681 :     (* generate a global structure type definition from the list of globals *)
682 :     fun genGlobalStruct (_, [], _) = CL.D_Comment(["No Global Definition"])
683 : jhr 2815 | genGlobalStruct (targetTy, globals, tyName) = let
684 : jhr 1671 val globs = List.map (fn (x : mirror_var) => (targetTy x, #var x)) globals
685 :     in
686 : jhr 2815 CL.D_StructDef(NONE, globs, SOME tyName)
687 : jhr 1671 end
688 :    
689 :     (* generate a global structure type definition from the image data of the image globals *)
690 :     fun genImageDataStruct ([], _) = CL.D_Comment(["No Image Data Ptrs Definition"])
691 : jhr 2815 | genImageDataStruct (imgGlobals, tyName) = let
692 : jhr 1671 val globs = List.map
693 : jhr 2815 (fn (x, _) => (globalPtr CL.voidTy, RN.imageDataName x))
694 :     imgGlobals
695 : jhr 1671 in
696 : jhr 2815 CL.D_StructDef(NONE, globs, SOME tyName)
697 : jhr 1671 end
698 :    
699 :     fun genGlobals (declFn, targetTy, globals) = let
700 :     fun doVar (x : mirror_var) = declFn (CL.D_Var([], targetTy x, #var x, NONE))
701 :     in
702 :     List.app doVar globals
703 :     end
704 :    
705 :     fun genOutputFun(Strand{name, output,tyName, state, code,...}) = let
706 : jhr 2815 (* the output function *)
707 : jhr 1671 val outFnName = concat[name, "_Output"]
708 :     val outFun = let
709 :     val params = [
710 :     CL.PARAM([], CL.T_Ptr CL.voidTy, "outS"),
711 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "self")
712 :     ]
713 :     (* the type and access expression for the strand's output variable *)
714 :     val (outTy, outState) = (#1 output, CL.mkIndirect(CL.mkVar "self", #2 output))
715 :     val outState = CL.mkUnOp(CL.%&, outState)
716 :     in
717 :     CL.D_Func(["static"], CL.voidTy, outFnName, params,
718 :     CL.mkCall("memcpy", [CL.mkVar "outS", outState, CL.mkSizeof(shadowTy outTy)] ))
719 :     end
720 :     in
721 :     outFun
722 :     end
723 :    
724 :     fun genStrandDesc (outFn,Strand{name, output,tyName, state, code,...}) = let
725 :     (* the output function *)
726 :     val outFnName = concat[name, "_Output"]
727 :     (* the strand's descriptor object *)
728 :     val descI = let
729 :     fun fnPtr (ty, f) = CL.I_Exp(CL.mkCast(CL.T_Named ty, CL.mkVar f))
730 :     val (outTy, _) = output
731 :     in
732 :     CL.I_Struct[
733 :     ("name", CL.I_Exp(CL.mkStr name)),
734 :     ("stateSzb", CL.I_Exp(CL.mkSizeof(CL.T_Named(RN.strandTy name)))),
735 :     ("shadowStrandSzb", CL.I_Exp(CL.mkSizeof(CL.T_Named(RN.strandShadowTy (RN.strandTy name))))),
736 :     (* FIXME: we may need to add a shadowOutputSzb field too for OpenCL *)
737 :     ("outputSzb", CL.I_Exp(CL.mkSizeof(shadowTy outTy))),
738 : jhr 1789 (* DEPRECATED
739 : jhr 1671 ("nrrdType", CL.I_Exp(CL.mkInt (NrrdTypes.toNrrdType outTy))),
740 : jhr 2815 ("nrrdSzb", CL.I_Exp(CL.mkInt (NrrdTypes.toNrrdSize outTy))),
741 : jhr 1789 *)
742 : jhr 1671 ("update", fnPtr("update_method_t", "0")),
743 :     ("strandCopy", fnPtr("convert_method_t", RN.strandConvertName name)),
744 :     ("print", fnPtr("print_method_t", RN.strandPrintName name)),
745 :     ("output", fnPtr("output_method_t", outFnName)) (* FIXME *)
746 :     ]
747 :     end
748 : jhr 3098 val desc = CL.D_Var([], CN.strandDescTy, CN.strandDesc name, SOME descI)
749 : jhr 1671 in
750 :     desc
751 :     end
752 :    
753 :     (* generate the table of strand descriptors *)
754 :     fun genStrandTable (declFn, strands) = let
755 :     val nStrands = length strands
756 : jhr 3098 fun genInit (Strand{name, ...}) = CL.I_Exp(CL.mkUnOp(CL.%&, CL.mkVar(CN.strandDesc name)))
757 : jhr 1671 fun genInits (_, []) = []
758 :     | genInits (i, s::ss) = (i, genInit s) :: genInits(i+1, ss)
759 :     in
760 : jhr 3098 declFn (CL.D_Var([], CL.int32, RN.numStrands,
761 : jhr 1671 SOME(CL.I_Exp(CL.mkIntTy(IntInf.fromInt nStrands, CL.int32)))));
762 :     declFn (CL.D_Var([],
763 : jhr 3098 CL.T_Array(CL.T_Ptr(CN.strandDescTy), SOME nStrands),
764 :     CN.strands,
765 : jhr 1671 SOME(CL.I_Array(genInits (0, strands)))))
766 :     end
767 :    
768 :     fun genSrc (baseName, prog) = let
769 :     val Prog{
770 : jhr 2815 props,
771 :     globals, topDecls, strands, initially,
772 :     imgGlobals, numDims,outFn, ...
773 :     } = prog
774 : jhr 1671 val clFileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "cl"}
775 :     val cFileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "c"}
776 :     val clOutS = TextIO.openOut clFileName
777 :     val cOutS = TextIO.openOut cFileName
778 :     val clppStrm = PrintAsCL.new clOutS
779 :     val cppStrm = PrintAsC.new cOutS
780 :     fun cppDecl dcl = PrintAsC.output(cppStrm, dcl)
781 :     fun clppDecl dcl = PrintAsCL.output(clppStrm, dcl)
782 :     val strands = AtomTable.listItems strands
783 :     val [strand as Strand{name, tyName, code, init_code, ...}] = strands
784 :     in
785 :     (* Generate the OpenCL file *)
786 :     (* Retrieve the header information *)
787 : jhr 2116 clppDecl (CL.verbatimDcl [HF.text] [
788 : jhr 2815 ("OUTFILE", clFileName),
789 :     ("SRCFILE", OS.Path.joinBaseExt{base=baseName, ext=SOME "diderot"}),
790 : jhr 3223 ("DIDEROTC_CMD", #diderotc props),
791 :     ("DIDEROTC_ARGV", String.concatWith " " (#argv props)),
792 :     ("DIDEROTC_VERSION", #version props),
793 : jhr 2815 ("DIDEROT_FLOAT_PRECISION", Properties.floatPrecisionDef props),
794 :     ("DIDEROT_INT_PRECISION", Properties.intPrecisionDef props)
795 :     ]);
796 :     (* if there are no globals, then define a dummy type *)
797 :     if List.null(!globals)
798 :     then clppDecl (CL.D_Verbatim["typedef void ", RN.globalsTy, ";\n"])
799 :     else ();
800 :     (* if there are no images, then define a dummy type *)
801 :     if List.null(!imgGlobals)
802 :     then clppDecl (CL.D_Verbatim["typedef void * ", RN.imageDataType, ";\n"])
803 :     else ();
804 :     (* Retrieve the scheduler kernels and functions *)
805 : jhr 1671 clppDecl (CL.D_Verbatim[SF.text]);
806 : jhr 2815 clppDecl (CL.D_Verbatim[CLEigen2x2Frag.text]);
807 :     clppDecl (CL.D_Verbatim[CLEigen3x3Frag.text]);
808 : jhr 1671 clppDecl (genGlobalStruct (#gpuTy, !globals, RN.globalsTy));
809 :     clppDecl (genImageDataStruct(!imgGlobals, RN.imageDataType));
810 :     clppDecl (genStrandTyDef(#gpuTy, strand, tyName));
811 :     List.app clppDecl (!code);
812 : jhr 2815 clppDecl (genStrandCopy strand);
813 : jhr 1671 clppDecl (genUpdateMethod(strand, globals, imgGlobals));
814 :     (* Generate the Host C file *)
815 :     cppDecl (CL.D_Verbatim[
816 : jhr 2815 concat["#define " ^ Properties.floatPrecisionDef props, "\n"],
817 :     concat["#define " ^ Properties.intPrecisionDef props, "\n"],
818 :     concat["#define " ^ Properties.targetDef props, "\n"],
819 :     "#include \"Diderot/diderot.h\"\n"
820 :     ]);
821 :     case !globals
822 :     of [] => cppDecl (CL.D_Verbatim[concat["typedef void ", RN.globalsTy, ";\n"] ])
823 :     | _ => ()
824 :     (* end case *);
825 : jhr 1671 cppDecl (CL.D_Var(["static"], CL.charPtr, "ProgramName",
826 : jhr 2082 SOME(CL.I_Exp(CL.mkStr(#srcFile props)))));
827 : jhr 1671 cppDecl (genGlobalStruct (#hostTy, !globals, RN.globalsTy));
828 :     cppDecl (genGlobalStruct (#shadowTy, !globals, RN.shadowGlobalsTy));
829 :     (* FIXME: does this really need to be a global? *)
830 :     cppDecl (CL.D_Var(["static"], globPtrTy, RN.globalsVarName, NONE));
831 :     cppDecl (genStrandTyDef (#hostTy, strand, tyName));
832 :     cppDecl (genStrandTyDef (#shadowTy, strand, RN.strandShadowTy tyName));
833 :     cppDecl (genConvertShadowTypes strand);
834 :     cppDecl (!init_code);
835 :     cppDecl (genStrandPrint strand);
836 :     cppDecl (genOutputFun strand);
837 :     List.app cppDecl (List.rev (!topDecls));
838 :     cppDecl (genGlobalBuffersArgs (!globals,imgGlobals));
839 :     List.app (fn strand => cppDecl (genStrandDesc (outFn,strand))) strands;
840 :     genStrandTable (cppDecl, strands);
841 :     cppDecl (!initially);
842 :     PrintAsC.close cppStrm;
843 :     PrintAsCL.close clppStrm;
844 :     TextIO.closeOut cOutS;
845 :     TextIO.closeOut clOutS
846 :     end
847 :    
848 :     (* output the code to the filesystem. The string is the basename of the source file *)
849 : jhr 2082 fun generate (prog as Prog{props, ...}) = let
850 : jhr 2815 val {outDir, outBase, exec, double, parallel, debug, ...} = props
851 : jhr 1671 fun condCons (true, x, xs) = x::xs
852 :     | condCons (false, _, xs) = xs
853 :     (* generate the C compiler flags *)
854 : jhr 2435 val cflags = ["-I" ^ Paths.diderotInclude(), "-I" ^ Paths.teemInclude()]
855 : jhr 1843 val cflags = condCons (#cl Paths.cflags <> "", #cl Paths.cflags, cflags)
856 : jhr 1671 val cflags = condCons (parallel, #pthread Paths.cflags, cflags)
857 :     val cflags = if debug
858 :     then #debug Paths.cflags :: cflags
859 :     else #ndebug Paths.cflags :: cflags
860 :     val cflags = #base Paths.cflags :: cflags
861 :     (* generate the loader flags *)
862 :     val extraLibs = condCons (parallel, #pthread Paths.extraLibs, [])
863 : jhr 2430 val extraLibs = Paths.teemLinkFlags() @ #base Paths.extraLibs :: extraLibs
864 : jhr 1671 val extraLibs = #cl Paths.extraLibs :: extraLibs
865 : jhr 2082 val rtLib = Properties.runtimeName props
866 : jhr 1671 val ldOpts = rtLib :: extraLibs
867 : jhr 2815 val basename = OS.Path.joinDirFile{dir=outDir, file=outBase}
868 : jhr 1671 in
869 :     genSrc (basename, prog);
870 :     RunCC.compile (basename, cflags);
871 : jhr 1714 RunCC.linkExec (basename, ldOpts)
872 : jhr 1671 end
873 :    
874 :     end (* Program *)
875 :    
876 :     end
877 :    
878 :     structure CLBackEnd = CodeGenFn(CLTarget)

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