Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16618 Discussions

Structs vs. Arrays in OpenCL

Altera_Forum
Honored Contributor II
1,200 Views

Hi Everyone, 

 

I'm new to OpenCL and trying to learn from the official Altera OpenCL design examples. Here is one question that might be naive, but I just could not find an answer (tried to search for a similar thread too): 

 

In the FFT(1D) design example (https://www.altera.com/support/support-resources/design-examples/design-software/opencl/fft-1d.html), a struct of 8 float2 members is defined in fft_8.cl: 

 

typedef struct { 

float2 i0; 

float2 i1; 

float2 i2; 

float2 i3; 

float2 i4; 

float2 i5; 

float2 i6; 

float2 i7; 

} float2x8; 

 

So what is the point of using the struct (which forces related code to be "hardcoded"), instead of using an array float2[8] here? Does it increase the efficiency of compilation / execution? It would be great if the source of that info could be provided as well. 

 

Thanks a lot in advance, and have a great weekend! 

 

-Tian
0 Kudos
0 Replies
Reply