Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Error when specifying max work group size

Hi everyone,

I just find out that whenever I try to add max_work_group_size(X, Y, Z) attribute to a kernel I get the following error:

"error: attribute takes one argument"

Not even the example supplied by the programming guide compiles:

"aoc -v -c sum.claoc: Environment checks are completed successfully.

aoc: Selected target board de5net_a7

aoc: Running OpenCL parser....

c:/Users/RT/Desktop/sum.cl:1:16: error: attribute takes one argument

__attribute__((max_work_group_size(64,1,1)))

^

1 error generated.

Error: OpenCL parser FAILED.

Refer to sum/sum.log for details."

Where the ^ pointer points at letter 'm' of "max_work_group_size".

This is the source code from the example by the way:

"__attribute__((max_work_group_size(64,1,1)))

__kernel void sum (__global const float * restrict a,

__global const float * restrict b,

__global float * restrict answer)

{

size_t gid = get_global_id(0);

answer[gid] = a[gid] + b[gid];

}"

This happens on both Linux and windows version 15 of AOCL, but "reqd_work_group_size(X, Y, Z)" works just fine.

I don't know if this is a bug of the compiler or am I missing something?

Thanks in advance!

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    the syntax of the attribute should be __attribute__((max_work_group_size(SIZE)),so just one argument as the compiler error suggested.

    Cheers,

    Sergio
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks Sergio! I discovered this sometime ago but I forgot to update the thread...

    Cheers,

    Ryan