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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1488 - (download) (as text) (annotate)
Fri Sep 9 08:21:07 2011 UTC (9 years, 9 months ago) by lamonts
File size: 4286 byte(s)
Updating files with the new persistent scheduler 
/*! \file cl-types.h
 * \author Lamont Samuels

 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.


typedef enum {
    DIDEROT_ACTIVE = 0,         //!< a currently running strand
    DIDEROT_NEW = 1,            //!< a newly created, but not yet active, strand
    DIDEROT_DIE,                //!< a dead strand
    DIDEROT_STABILIZE,          //!< a strand that will be stable at the end of
                                //!< the current step
    DIDEROT_STABLE              //!< a stable strand
} StrandStatus_t;

/* we need these union types to support subscripting vectors */
typedef union { float r[2]; float2 v; } union2f_t;
typedef union { float r[4]; float4 v; } union4f_t;
typedef union { float r[8]; float8 v; } union8f_t;
typedef union { float r[16]; float16 v; } union16f_t;

typedef union { int i[2]; int2 v; } union2i_t;
typedef union { int i[4]; int4 v; } union4i_t;
typedef union { int i[8]; int8 v; } union8i_t;
typedef union { int i[16]; int16 v; } union16i_t;

//typedef union { double r[2]; double2 v; } union2d_t;
//typedef union { double r[4]; double4 v; } union4d_t;
//typedef union { double r[8]; double8 v; } union8d_t;
//typedef union { double r[16]; double16 v; } union16d_t;

typedef union { long r[2]; long2 v; } union2l_t;
typedef union { long r[4]; long4 v; } union4l_t;
typedef union { long r[8]; long8 v; } union8l_t;
typedef union { long r[16]; long16 v; } union16l_t;

/* OpenCL version 1.00 does not support 3-element vectors, but later versions do.
 * We use DIDEROT_CL_VERSION, instead of __OPENCL_VERSION__, because some OpenCL
 * compilers are buggy in the way that they define the latter symbol.
// NOTE: Apple has float3 defined internally, which causes the OpenCL
// compiler to complain
#ifdef float3
#  undef int3
#  undef float3
typedef int4 int3;
typedef float4 float3;
typedef union4f_t union3f_t;
typedef union4i_t union3i_t;
#define VEC3(a, b, c)   (float3)(a, b, c, 0)
typedef union { float r[3]; float3 v; } union3f_t;
typedef union { int i[3]; int3 v; } union3i_t;
#define VEC3(a, b, c)   (float3)(a, b, c)

typedef int Diderot_int_t;
typedef float Diderot_real_t;
typedef float2 Diderot_vec2_t;
typedef float3 Diderot_vec3_t;
typedef float4 Diderot_vec4_t;
# error double precision not yet supported

typedef Diderot_vec2_t Diderot_Mat2x2_t[2];     // represented as row vectors
typedef Diderot_vec3_t Diderot_Mat3x3_t[3];     // represented as row vectors
typedef Diderot_vec4_t Diderot_Mat4x4_t[4];     // represented as row vectors

// GPU-side image types.  Note that these should have the same organization as
// the Shadow_image[123]D_t types defined in shadow-types.h

typedef struct {                       
    uint                size[1];
    Diderot_real_t      s;              // scaling from world-space to image-space
    Diderot_real_t      t;              // translation from world-space to image-space
} Diderot_image1D_t;

typedef struct {                     
    uint                size[2];        // sizes (fast to slow)
    Diderot_Mat2x2_t    w2i;            // affine tranform from world space to index space.  This is the
                                        // inverse of the index to world-space transform that is loaded from
                                        // the Nrrd file.
    Diderot_vec2_t      tVec;           // translation part of world to index transform
    Diderot_Mat2x2_t    w2iT;           // transpose w3i
} Diderot_image2D_t;

typedef struct {                     
    uint                size[3];        // sizes (fast to slow)
    Diderot_Mat3x3_t    w2i;            // affine tranform from world space to index space.  This is the
                                        // inverse of the index to world-space transform that is loaded from
                                        // the Nrrd file.
    Diderot_vec3_t      tVec;           // translation part of world to index transform
    Diderot_Mat3x3_t    w2iT;           // transpose w3i
} Diderot_image3D_t;

#endif /* !_DIDEROT_CL_TYPES_H_ */

ViewVC Help
Powered by ViewVC 1.0.0