SCM Repository
View of /branches/lamont/src/compiler/c-util/runtime-names.sml
Parent Directory
|
Revision Log
Revision 2201 -
(download)
(annotate)
Sun Feb 24 16:02:12 2013 UTC (8 years ago) by lamonts
File size: 4868 byte(s)
Sun Feb 24 16:02:12 2013 UTC (8 years ago) by lamonts
File size: 4868 byte(s)
Refactored the spatail implementation slightly
(* runtime-names.sml * * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu) * All rights reserved. * * These are names that are used in the common parts of the runtime system. *) structure RuntimeNames = struct local structure Ty = TreeIL.Ty fun qualifyName name (tgt : TargetUtil.target_desc) = #namespace tgt ^ name fun qualifyName' fixed (tgt : TargetUtil.target_desc, name) = concat[#namespace tgt, fixed, "_", name] in (* generated types *) val worldTy = qualifyName "World_t" val globalsTy = qualifyName "Globals_t" val inputsTy = qualifyName "Inputs_t" (* type of struct used to hold command-line *) (* inputs. *) val definedInpTy = qualifyName "DefinedInputs_t" (* type of struct used to hold command-line *) (* inputs. *) (* generate names for input and output variables *) val inputDesc = qualifyName' "InVarDesc" val inputGet = qualifyName' "InVarGet" val inputSet = qualifyName' "InVarSet" val inputSetByName = qualifyName' "InVarSetByName" val outputGet = qualifyName' "OutputGet" val snapshotGet = qualifyName' "Snapshot" (* names of generated types, functions, and globals *) val initGlobals = "InitGlobals" (* function for initializing program globals *) val freeGlobals = "FreeGlobals" (* function for freeing program globals *) val initDefaults = "InitDefaults" (* function for initializing input defaults *) val registerOpts = "RegisterGlobalOpts" (* function for registering command-line options *) val initInputs = "InitInputs" (* function for initializing global inputs *) val initDefined = qualifyName "InitDefined" (* function for initializing input-defined flags *) val checkDefined = qualifyName "ChkDefined" (* function for initializing input-defined flags *) val shutdown = qualifyName "Shutdown" (* function that gets called at the end *) val initially = qualifyName "Initially" (* function for creating initial strands *) val reduction = qualifyName "Reduction" (* function for processing global reductions *) fun strandInit strand = strand ^ "_InitState" fun strandTy strand = concat["Strand_", strand, "_t"] fun strandDesc strand = concat["Strand_", strand] val numStrands = "Diderot_NumStrands" val strands = "Diderot_Strands" (* Diderot runtime system hooks *) val statusTy = "Status_t" fun setImage dim = concat["Diderot_SetImage", Int.toString dim, "D"] fun loadImage dim = concat["Diderot_LoadImage", Int.toString dim, "D"] fun freeImage dim = concat["Diderot_FreeImage", Int.toString dim, "D"] fun loadDynSeq ty = (case ty of Ty.BoolTy => "Diderot_DynSeqLoadBool" | Ty.IntTy => "Diderot_DynSeqLoadInt" | Ty.TensorTy _ => "Diderot_DynSeqLoadReal" | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty) (* end case *)) fun loadDynSeqFromFile ty = (case ty of Ty.BoolTy => "Diderot_DynSeqLoadBoolFromFile" | Ty.IntTy => "Diderot_DynSeqLoadIntFromFile" | Ty.TensorTy _ => "Diderot_DynSeqLoadRealFromFile" | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty) (* end case *)) val strandDescTy = "Strand_t" val worldTy = qualifyName "World_t" val globalTy = qualifyName "Globals_t" val optionsTy = "Diderot_Options_t" val allocInitially = "AllocInitially" val inState = "Diderot_InState" (* Grid & Queries names *) val sphereQuery = "spherical_query" val gridCxtName = "gridCtx" val strandsName = "strands" val gridContextTy = "GridContext" val gridDimName = "qGridDim" val gridCellName = "qCellDim" val queryPoolTy = "QueryPool_t" val queryPoolName = "queryPool" val queryAllocFun = "Diderot_QueryAllocPool" fun gridAllocFun d = concat["Diderot_GridAllocGrid", Int.toString d, "D"] fun gridBuildFun d = concat["Diderot_GridBuild", Int.toString d, "D"] (* Math utility functions *) val evecs2x2 = "Diderot_evecs2x2" val evecs3x3 = "Diderot_evecs3x3" val evals2x2 = "Diderot_evals2x2" val evals3x3 = "Diderot_evals3x3" (* functions for defining program inputs; note that sequences and images come from * nrrd files, which are specified by their filenames. *) fun input ty = (case ty of Ty.StringTy => "Diderot_OptAddString" | Ty.BoolTy => "Diderot_OptAddBool" | Ty.IntTy => "Diderot_OptAddInt" | Ty.TensorTy[] => "Diderot_OptAddReal" | Ty.TensorTy[2] => "Diderot_OptAddReal2" | Ty.TensorTy[3] => "Diderot_OptAddReal3" | Ty.TensorTy[4] => "Diderot_OptAddReal4" | Ty.DynSeqTy _ => "Diderot_OptAddString" | Ty.ImageTy _ => "Diderot_OptAddString" | ty => raise Fail("unsupported input type " ^ Ty.toString ty) (* end case *)) end (* local *) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |