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

SCM Repository

[diderot] Annotation of /branches/lamont/src/compiler/c-util/runtime-names.sml
ViewVC logotype

Annotation of /branches/lamont/src/compiler/c-util/runtime-names.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2201 - (view) (download)

1 : jhr 1115 (* runtime-names.sml
2 :     *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 : jhr 1373 *
6 :     * These are names that are used in the common parts of the runtime system.
7 : jhr 1115 *)
8 :    
9 :     structure RuntimeNames =
10 :     struct
11 :    
12 :     local
13 :     structure Ty = TreeIL.Ty
14 : jhr 1718 fun qualifyName name (tgt : TargetUtil.target_desc) = #namespace tgt ^ name
15 : jhr 1815 fun qualifyName' fixed (tgt : TargetUtil.target_desc, name) =
16 :     concat[#namespace tgt, fixed, "_", name]
17 : jhr 1115 in
18 :    
19 : jhr 1815 (* generated types *)
20 :     val worldTy = qualifyName "World_t"
21 :     val globalsTy = qualifyName "Globals_t"
22 : jhr 2041 val inputsTy = qualifyName "Inputs_t" (* type of struct used to hold command-line *)
23 :     (* inputs. *)
24 : jhr 2048 val definedInpTy = qualifyName "DefinedInputs_t"
25 :     (* type of struct used to hold command-line *)
26 :     (* inputs. *)
27 : jhr 1815
28 :     (* generate names for input and output variables *)
29 :     val inputDesc = qualifyName' "InVarDesc"
30 :     val inputGet = qualifyName' "InVarGet"
31 :     val inputSet = qualifyName' "InVarSet"
32 :     val inputSetByName = qualifyName' "InVarSetByName"
33 :     val outputGet = qualifyName' "OutputGet"
34 : jhr 1912 val snapshotGet = qualifyName' "Snapshot"
35 : jhr 1815
36 : jhr 1373 (* names of generated types, functions, and globals *)
37 : jhr 1718 val initGlobals = "InitGlobals" (* function for initializing program globals *)
38 : nseltzer 1870 val freeGlobals = "FreeGlobals" (* function for freeing program globals *)
39 : jhr 1727 val initDefaults = "InitDefaults" (* function for initializing input defaults *)
40 :     val registerOpts = "RegisterGlobalOpts" (* function for registering command-line options *)
41 : jhr 2041 val initInputs = "InitInputs" (* function for initializing global inputs *)
42 : jhr 2049 val initDefined = qualifyName "InitDefined" (* function for initializing input-defined flags *)
43 :     val checkDefined = qualifyName "ChkDefined" (* function for initializing input-defined flags *)
44 : jhr 1718 val shutdown = qualifyName "Shutdown" (* function that gets called at the end *)
45 :     val initially = qualifyName "Initially" (* function for creating initial strands *)
46 : lamonts 2101 val reduction = qualifyName "Reduction" (* function for processing global reductions *)
47 : jhr 1115 fun strandInit strand = strand ^ "_InitState"
48 :     fun strandTy strand = concat["Strand_", strand, "_t"]
49 :     fun strandDesc strand = concat["Strand_", strand]
50 :     val numStrands = "Diderot_NumStrands"
51 :     val strands = "Diderot_Strands"
52 :    
53 :     (* Diderot runtime system hooks *)
54 :     val statusTy = "Status_t"
55 : jhr 1807 fun setImage dim = concat["Diderot_SetImage", Int.toString dim, "D"]
56 : jhr 1115 fun loadImage dim = concat["Diderot_LoadImage", Int.toString dim, "D"]
57 : nseltzer 1870 fun freeImage dim = concat["Diderot_FreeImage", Int.toString dim, "D"]
58 : jhr 1999 fun loadDynSeq ty = (case ty
59 :     of Ty.BoolTy => "Diderot_DynSeqLoadBool"
60 :     | Ty.IntTy => "Diderot_DynSeqLoadInt"
61 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadReal"
62 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
63 :     (* end case *))
64 : jhr 2029 fun loadDynSeqFromFile ty = (case ty
65 :     of Ty.BoolTy => "Diderot_DynSeqLoadBoolFromFile"
66 :     | Ty.IntTy => "Diderot_DynSeqLoadIntFromFile"
67 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadRealFromFile"
68 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
69 :     (* end case *))
70 : jhr 1115 val strandDescTy = "Strand_t"
71 : jhr 1718 val worldTy = qualifyName "World_t"
72 : jhr 1806 val globalTy = qualifyName "Globals_t"
73 : jhr 1301 val optionsTy = "Diderot_Options_t"
74 : jhr 1718 val allocInitially = "AllocInitially"
75 : jhr 1115 val inState = "Diderot_InState"
76 :    
77 : lamonts 2160
78 :     (* Grid & Queries names *)
79 :     val sphereQuery = "spherical_query"
80 :     val gridCxtName = "gridCtx"
81 :     val strandsName = "strands"
82 :     val gridContextTy = "GridContext"
83 :     val gridDimName = "qGridDim"
84 :     val gridCellName = "qCellDim"
85 : lamonts 2191 val queryPoolTy = "QueryPool_t"
86 :     val queryPoolName = "queryPool"
87 :     val queryAllocFun = "Diderot_QueryAllocPool"
88 : lamonts 2201 fun gridAllocFun d = concat["Diderot_GridAllocGrid", Int.toString d, "D"]
89 :     fun gridBuildFun d = concat["Diderot_GridBuild", Int.toString d, "D"]
90 : lamonts 2083
91 : lamonts 2160
92 : jhr 1640 (* Math utility functions *)
93 :     val evecs2x2 = "Diderot_evecs2x2"
94 :     val evecs3x3 = "Diderot_evecs3x3"
95 :     val evals2x2 = "Diderot_evals2x2"
96 :     val evals3x3 = "Diderot_evals3x3"
97 :    
98 : jhr 2041 (* functions for defining program inputs; note that sequences and images come from
99 :     * nrrd files, which are specified by their filenames.
100 :     *)
101 : jhr 1115 fun input ty = (case ty
102 : jhr 1373 of Ty.StringTy => "Diderot_OptAddString"
103 :     | Ty.BoolTy => "Diderot_OptAddBool"
104 : jhr 1640 | Ty.IntTy => "Diderot_OptAddInt"
105 : jhr 1373 | Ty.TensorTy[] => "Diderot_OptAddReal"
106 :     | Ty.TensorTy[2] => "Diderot_OptAddReal2"
107 :     | Ty.TensorTy[3] => "Diderot_OptAddReal3"
108 :     | Ty.TensorTy[4] => "Diderot_OptAddReal4"
109 : jhr 2041 | Ty.DynSeqTy _ => "Diderot_OptAddString"
110 :     | Ty.ImageTy _ => "Diderot_OptAddString"
111 : jhr 2030 | ty => raise Fail("unsupported input type " ^ Ty.toString ty)
112 : jhr 1115 (* end case *))
113 :    
114 :     end (* local *)
115 :     end

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