Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHmm i think it was just with the -O3 optimization flag. Prob just a bug then. Heres some examples that work
__kernel void producer (__global int * in_buf, int N)
{
for (int index=0; index < N; index++)
{
write_channel_altera( c0, in_buf );
}
}
__kernel void consumer (__global int * ret_buf, int N)
{
for(int index=0; index < N; index++)
{
ret_buf = read_channel_altera( c0 );
}
} This is what i meant by static ... #pragma OPENCL EXTENSION cl_altera_channels : enable
channel int c0;
# define N 256
__attribute__((reqd_work_group_size(N,1,1)))
__kernel void producer (__global int * in_buf)
{
int gid = get_global_id(0);
write_channel_altera( c0, in_buf );
}
__kernel void consumer (__global int * ret_buf)
{
for(int index=0; index < N; index++)
{
ret_buf = read_channel_altera( c0 );
}
}
This is what i was trying to do. Didn't try it without -O3 before but i guess this is solved then :D #pragma OPENCL EXTENSION cl_altera_channels : enable
channel int c0;
__attribute__((max_work_group_size(256)))
__kernel void producer (__global int * in_buf)
{
int gid = get_global_id(0);
write_channel_altera( c0, in_buf );
}
__kernel void consumer (__global int * ret_buf, int N)
{
for(int index=0; index < N; index++)
{
ret_buf = read_channel_altera( c0 );
}
}
edit: This is not exactly my code n cbf compiling so idk which of these is faster, i had 16 channels in parallel in mine