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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/include/Diderot/cl-types.h
ViewVC logotype

Diff of /branches/pure-cfg/src/include/Diderot/cl-types.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/pure-cfg/src/include/Diderot/opencl_types.h revision 1271, Mon Jun 6 02:45:57 2011 UTC branches/pure-cfg/src/include/Diderot/cl-types.h revision 1272, Mon Jun 6 09:19:11 2011 UTC
# Line 1  Line 1 
1  /*! \file opencl_types.h  /*! \file cl-types.h
2   *   *
3   * \author Lamont Samuels   * \author Lamont Samuels
4   */   */
# Line 7  Line 7 
7   * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)   * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
8   * All rights reserved.   * All rights reserved.
9   */   */
10   #ifndef _DIDEROT_OPENCL_TYPES_H  
11   #define _DIDEROT_OPENCL_TYPES_H  #ifndef _DIDEROT_CL_TYPES_H_
12    #define _DIDEROT_CL_TYPES_H_
13    
14  typedef enum {  typedef enum {
15      DIDEROT_ACTIVE = 0,         //!< a currently running strand      DIDEROT_ACTIVE = 0,         //!< a currently running strand
# Line 19  Line 20 
20      DIDEROT_STABLE              //!< a stable strand      DIDEROT_STABLE              //!< a stable strand
21  } StrandStatus_t;  } StrandStatus_t;
22    
23  typedef enum { DIDEROT_OK = 0, DIDEROT_FAIL = -1 } Status_t;  /* OpenCL version 1.00 does not support 3-element vectors */
24    #if __OPENCL_VERSION__ < 110
25  /* OpenCL vector types */  typedef int4 int3;
26  typedef float2  vec2f_t;  typedef float4 float3;
27  typedef float4  vec4f_t;  #endif
 typedef float8  vec8f_t;  
 typedef int2    vec2i_t;  
 typedef int4    vec4i_t;  
 typedef int8    vec8i_t;  
 typedef long2   vec2l_t;  
 typedef long4   vec4l_t;  
 typedef long8   vec8l_t;  
   
 typedef char int8_t;  
 typedef uchar uint8_t;  
 typedef short int16_t;  
 typedef ushort uint16_t;  
 typedef uint uint32_t;  
 typedef int  int32_t;  
 typedef long int64_t;  
 typedef ulong uint64_t;  
   
 typedef union { float r[2]; vec2f_t v; } union2f_t;  
 typedef union { float r[4]; vec4f_t v; } union4f_t;  
 typedef union { float r[8]; vec8f_t v; } union8f_t;  
   
 typedef union { int32_t i[2]; vec2i_t v; } union2i_t;  
 typedef union { int32_t i[4]; vec4i_t v; } union4i_t;  
 typedef union { int32_t i[8]; vec8i_t v; } union8i_t;  
   
 typedef union { int64_t r[2]; vec2l_t v; } union2l_t;  
 typedef union { int64_t r[4]; vec4l_t v; } union4l_t;  
 typedef union { int64_t r[8]; vec8l_t v; } union8l_t;  
   
 /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */  
 typedef vec4f_t vec3f_t;  
 typedef union4f_t union3f_t;  
 typedef vec4i_t vec3i_t;  
 typedef union4i_t union3i_t;  
 typedef vec4l_t vec3l_t;  
 typedef union4l_t union3l_t;  
   
28    
29  typedef int32_t Diderot_int_t;  #if defined(DIDEROT_SINGLE_PRECISION)
30    typedef int Diderot_int_t;
31  typedef float Diderot_real_t;  typedef float Diderot_real_t;
32  typedef vec2f_t Diderot_vec2_t;  typedef float2 Diderot_vec2_t;
33  typedef vec3f_t Diderot_vec3_t;  typedef float3 Diderot_vec3_t;
34  typedef vec4f_t Diderot_vec4_t;  typedef float4 Diderot_vec4_t;
35  typedef union2f_t Diderot_union2_t;  #else
36  typedef union3f_t Diderot_union3_t;  # error double precision not yet supported
37  typedef union4f_t Diderot_union4_t;  #endif
38  typedef union2f_t Diderot_Mat2x2_t[2];  // represented as row vectors  
39  typedef union3f_t Diderot_Mat3x3_t[3];  // represented as row vectors  typedef Diderot_vec2_t Diderot_Mat2x2_t[2];     // represented as row vectors
40  typedef union4f_t Diderot_Mat4x4_t[4];  // represented as row vectors  typedef Diderot_vec3_t Diderot_Mat3x3_t[3];     // represented as row vectors
41    typedef Diderot_vec4_t Diderot_Mat4x4_t[4];     // represented as row vectors
42    
43    
44  typedef struct {                        // wrapper for 1D image data  typedef struct {                        // wrapper for 1D image data
45      uint32_t            dim;            // dimension (== 1)      uint                dim;            // dimension (== 1)
46      uint32_t            size[1];      uint                size[1];
47      void                *data;      void                *data;
48      Diderot_real_t      s;              // scaling from world-space to image-space      Diderot_real_t      s;              // scaling from world-space to image-space
49      Diderot_real_t      t;              // translation from world-space to image-space      Diderot_real_t      t;              // translation from world-space to image-space
50  } Diderot_image1D_t;  } Diderot_image1D_t;
51    
52  typedef struct {                        // wrapper for 2D image data  typedef struct {                        // wrapper for 2D image data
53      uint32_t            dim;            // dimension (== 2)      uint                dim;            // dimension (== 2)
54      uint32_t            size[2];        // sizes (fast to slow)      uint                size[2];        // sizes (fast to slow)
55      void                *data;      void                *data;
56      Diderot_Mat2x2_t    w2i;            // affine tranform from world space to index space.  This is the      Diderot_Mat2x2_t    w2i;            // affine tranform from world space to index space.  This is the
57      // inverse of the index to world-space transform that is loaded from      // inverse of the index to world-space transform that is loaded from
# Line 95  Line 61 
61  } Diderot_image2D_t;  } Diderot_image2D_t;
62    
63  typedef struct {                        // wrapper for 3D image data  typedef struct {                        // wrapper for 3D image data
64      uint32_t            dim;            // dimension (== 3)      uint                dim;            // dimension (== 3)
65      uint32_t            size[3];        // sizes (fast to slow)      uint                size[3];        // sizes (fast to slow)
66      void                *data;      void                *data;
67      Diderot_Mat3x3_t    w2i;            // affine tranform from world space to index space.  This is the      Diderot_Mat3x3_t    w2i;            // affine tranform from world space to index space.  This is the
68      // inverse of the index to world-space transform that is loaded from      // inverse of the index to world-space transform that is loaded from
# Line 105  Line 71 
71      Diderot_Mat3x3_t    w2iT;           // transpose w3i      Diderot_Mat3x3_t    w2iT;           // transpose w3i
72  } Diderot_image3D_t;  } Diderot_image3D_t;
73    
74    #endif /* !_DIDEROT_CL_TYPES_H_ */
   
 #endif /* !_DIDEROT_OPENCL_TYPES_H_ */  
75    

Legend:
Removed from v.1271  
changed lines
  Added in v.1272

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