Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Other Data Types

The other data types supported by OpenCL C are described in Table 4.6.

Table 4.6. Other Built-In Data Types

Type

Description

image2d_t

A 2D image type.

image3d_t

A 3D image type.

sampler_t

An image sampler type.

event_t

An event type. These are used by built-in functions that perform async copies from global to local memory and vice versa. Each async copy operation returns an event and takes an event to wait for that identifies a previous async copy operation.

There are a few restrictions on the use of image and sampler types:

  • The image and samplers types are defined only if the device supports images.
  • Image and sampler types cannot be declared as arrays. Here are a couple of examples that show these illegal use cases:
    kernel void
    foo(image2d_t imgA[10]) // error. images cannot be declared
                            //        as arrays
    {
        image2d_t imgB[4];  // error. images cannot be declared
                            //        as arrays
        ...
    }
    
    
    kernel void
    foo(sampler_t smpA[10]) // error. samplers cannot be declared
                            //        as arrays
    {
        sampler_t smpB[4];  // error. samplers cannot be declared
                            //        as arrays
        ...
    }
  • The image2d_t, image3d_t, and sampler_t data types cannot be declared in a struct.
  • Variables cannot be declared to be pointers of image2d_t, image3d_t, and sampler_t data types.
  • + Share This
  • 🔖 Save To Your Account