Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 12/19/2022
Document Table of Contents

5.9.3. Specifying the Alignment of a Struct

You may instruct the Intel® FPGA SDK for OpenCL™ Offline Compiler to set a specific alignment of a struct data structure.
To specify the struct alignment, insert the aligned(N) attribute prior to the kernel source code for a struct data structure.
For example:

struct __attribute__((aligned(2))) Context
   float param1;
   float param2;
   int param3;
   uint param4;
__kernel void algorithm(__global float * A, 
                        __global struct Context * restrict c)
   if ( c->param3 )
      // Dereference through a pointer and so on
For more information, refer to the Align a Struct with or without Padding section of the Intel® FPGA SDK for OpenCL™ Best Practices Guide.

Did you find the information on this page useful?

Characters remaining:

Feedback Message