Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/opencl/cl-sizes_sml.in
ViewVC logotype

View of /trunk/sml3d/src/opencl/cl-sizes_sml.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1200 - (download) (annotate)
Sun Jul 17 13:54:56 2011 UTC (6 years, 3 months ago) by jhr
File size: 7100 byte(s)
  Working on OpenCL configuration
(* cl-sizes.sml
 *
 * COPYRIGHT (c) 2011 The SML3d Project (http://sml3d.cs.uchicago.edu)
 * All rights reserved.
 *
 * @configure_input@
 *
 * For each cl_* type, the corresponding struct contains information
 * about its size, alignment, etc.
 *
 *    type t
 *    val name : string
 *    val size : arity -> {szb : CSize.t, algn : CSize.t}
 *    val get : CPtr.t * CPtrDiff.t -> t
 *    val set : CPtr.t * CPtrDiff.t * t -> unit
 *
 * TODO:
 *      cl_half
 *)

structure CL_Char = Int@BITSOF_CL_CHAR@
structure CL_UChar = Int@BITSOF_CL_CHAR@
structure CL_Short = Int@BITSOF_CL_SHORT@
structure CL_UShort = Int@BITSOF_CL_SHORT@
structure CL_Int = Int@BITSOF_CL_INT@
structure CL_UInt = Int@BITSOF_CL_INT@
structure CL_Long = Int@BITSOF_CL_LONG@
structure CL_ULong = Int@BITSOF_CL_LONG@
structure CL_Float = Real32
structure CL_Double = Real64

structure CLSizes =
  struct
    datatype arity = SCALAR | VEC2 | VEC3 | VEC4 | VEC8 | VEC16
    structure Char =
      struct
        type t = CL_Char.int
        val name = "char"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_CHAR@, algn = 0w@ALIGNOF_CL_CHAR@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_CHAR2@, algn = 0w@ALIGNOF_CL_CHAR2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_CHAR3@, algn = 0w@ALIGNOF_CL_CHAR3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_CHAR4@, algn = 0w@ALIGNOF_CL_CHAR4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_CHAR8@, algn = 0w@ALIGNOF_CL_CHAR8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_CHAR16@, algn = 0w@ALIGNOF_CL_CHAR16@}
        val get = CPtr.getInt@BITSOF_CL_CHAR@
        val set = CPtr.setInt@BITSOF_CL_CHAR@
      end
    structure UChar =
      struct
        type t = CL_UChar.int
        val name = "uchar"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_CHAR@, algn = 0w@ALIGNOF_CL_CHAR@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_CHAR2@, algn = 0w@ALIGNOF_CL_CHAR2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_CHAR3@, algn = 0w@ALIGNOF_CL_CHAR3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_CHAR4@, algn = 0w@ALIGNOF_CL_CHAR4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_CHAR8@, algn = 0w@ALIGNOF_CL_CHAR8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_CHAR16@, algn = 0w@ALIGNOF_CL_CHAR16@}
        val get = CPtr.getInt@BITSOF_CL_CHAR@
        val set = CPtr.setInt@BITSOF_CL_CHAR@
      end
    structure Short =
      struct
        type t = CL_Short.int
        val name = "short"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_SHORT@, algn = 0w@ALIGNOF_CL_SHORT@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_SHORT2@, algn = 0w@ALIGNOF_CL_SHORT2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_SHORT3@, algn = 0w@ALIGNOF_CL_SHORT3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_SHORT4@, algn = 0w@ALIGNOF_CL_SHORT4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_SHORT8@, algn = 0w@ALIGNOF_CL_SHORT8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_SHORT16@, algn = 0w@ALIGNOF_CL_SHORT16@}
        val get = CPtr.getInt@BITSOF_CL_SHORT@
        val set = CPtr.setInt@BITSOF_CL_SHORT@
      end
    structure UShort =
      struct
        type t = CL_UShort.int
        val name = "ushort"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_SHORT@, algn = 0w@ALIGNOF_CL_SHORT@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_SHORT2@, algn = 0w@ALIGNOF_CL_SHORT2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_SHORT3@, algn = 0w@ALIGNOF_CL_SHORT3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_SHORT4@, algn = 0w@ALIGNOF_CL_SHORT4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_SHORT8@, algn = 0w@ALIGNOF_CL_SHORT8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_SHORT16@, algn = 0w@ALIGNOF_CL_SHORT16@}
        val get = CPtr.getInt@BITSOF_CL_SHORT@
        val set = CPtr.setInt@BITSOF_CL_SHORT@
      end
    structure Int =
      struct
        type t = CL_Int.int
        val name = "int"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_INT@, algn = 0w@ALIGNOF_CL_INT@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_INT2@, algn = 0w@ALIGNOF_CL_INT2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_INT3@, algn = 0w@ALIGNOF_CL_INT3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_INT4@, algn = 0w@ALIGNOF_CL_INT4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_INT8@, algn = 0w@ALIGNOF_CL_INT8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_INT16@, algn = 0w@ALIGNOF_CL_INT16@}
        val get = CPtr.getInt@BITSOF_CL_INT@
        val set = CPtr.setInt@BITSOF_CL_INT@
      end
    structure UInt =
      struct
        type t = CL_UInt.word
        val name = "uint"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_INT@, algn = 0w@ALIGNOF_CL_INT@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_INT2@, algn = 0w@ALIGNOF_CL_INT2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_INT3@, algn = 0w@ALIGNOF_CL_INT3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_INT4@, algn = 0w@ALIGNOF_CL_INT4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_INT8@, algn = 0w@ALIGNOF_CL_INT8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_INT16@, algn = 0w@ALIGNOF_CL_INT16@}
        val get = CPtr.getWord@BITSOF_CL_INT@
        val set = CPtr.setWord@BITSOF_CL_INT@
      end
    structure Long =
      struct
        type t = CL_Long.int
        val name = "long"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_LONG@, algn = 0w@ALIGNOF_CL_LONG@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_LONG2@, algn = 0w@ALIGNOF_CL_LONG2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_LONG3@, algn = 0w@ALIGNOF_CL_LONG3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_LONG4@, algn = 0w@ALIGNOF_CL_LONG4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_LONG8@, algn = 0w@ALIGNOF_CL_LONG8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_LONG16@, algn = 0w@ALIGNOF_CL_LONG16@}
        val get = CPtr.getInt@BITSOF_CL_LONG@
        val set = CPtr.setInt@BITSOF_CL_LONG@
      end
    structure ULong =
      struct
        type t = CL_ULong.int
        val name = "ulong"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_LONG@, algn = 0w@ALIGNOF_CL_LONG@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_LONG2@, algn = 0w@ALIGNOF_CL_LONG2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_LONG3@, algn = 0w@ALIGNOF_CL_LONG3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_LONG4@, algn = 0w@ALIGNOF_CL_LONG4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_LONG8@, algn = 0w@ALIGNOF_CL_LONG8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_LONG16@, algn = 0w@ALIGNOF_CL_LONG16@}
        val get = CPtr.getInt@BITSOF_CL_LONG@
        val set = CPtr.setInt@BITSOF_CL_LONG@
      end
    structure Float =
      struct
        type t = CL_Float.real
        val name = "float"
        fun size SCALAR = {szb = 0w@SIZEOF_CL_FLOAT@, algn = 0w@ALIGNOF_CL_FLOAT@}
          | size VEC2 = {szb = 0w@SIZEOF_CL_FLOAT2@, algn = 0w@ALIGNOF_CL_FLOAT2@}
          | size VEC3 = {szb = 0w@SIZEOF_CL_FLOAT3@, algn = 0w@ALIGNOF_CL_FLOAT3@}
          | size VEC4 = {szb = 0w@SIZEOF_CL_FLOAT4@, algn = 0w@ALIGNOF_CL_FLOAT4@}
          | size VEC8 = {szb = 0w@SIZEOF_CL_FLOAT8@, algn = 0w@ALIGNOF_CL_FLOAT8@}
          | size VEC16 = {szb = 0w@SIZEOF_CL_FLOAT16@, algn = 0w@ALIGNOF_CL_FLOAT16@}
        val get = CPtr.getRea@BITSOF_CL_FLOAT@
        val set = CPtr.setReal@BITSOF_CL_FLOAT@
      end
  end

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