Using Structs

Intel® SDK for OpenCL™ Applications standalone version supports user-defined structs. To use structs for kernel analysis, you need to define them:

  1. Go to Analyze > Struct Management.
  2. Choose data type and enter fill name.
  3. Click Add to add a new field.
  4. Click OK to save the created field.

After defining the struct, you can select is as type when creating a buffer variable:

A CSV file for a struct buffer should have the following format:

For example:

typedef struct Point {
    int x;
    int y;
    float value;
}

For a buffer of size 4, the CSV file contains:

0,1,3.56
1,1,33.7
1,0,12.58
0,0,4.85
.

Zero and random values are available as with regular-type buffers.

You can edit a struct. In such case any buffer using the struct reinitializes with the new data.

You can delete a struct as long as other structures or buffer variables do not use it.

When working with uniform variables, fill the values in the pop-up dialog for every field to insert values for the struct. For example:

Note

You must define structs with the same names as used in the code to enable the Kernel Builder to assign a variable to the argument.

See Also

Creating Variables
Editing Variables