#6 OpenCL Kernel Syntax

closed-fixed
nobody
Other/Misc (7)
5
2012-02-13
2010-12-03
Anonymous
No

The OpenCL kernel functions are consistently terminated with semi-colons

e.g.

__kernel void vec_mul(
__global const float * matrix,
__global const float * vector,
__global float * result,
unsigned int matrix_row_length, //keep transpose operation in mind!
unsigned int vector_length,
unsigned int result_length)
{
for (unsigned int row = get_global_id(0); row < result_length; row += get_global_size(0))
{
float dot_prod = 0.0f;
for (unsigned int col = 0; col < vector_length; ++col)
dot_prod += matrix[row*matrix_row_length+col] * vector[col];
result[row] = dot_prod;
}
};

from vec_mul.cl

The trailing semi-colon is not syntactically valid in OpenCL, and is rejected by (strict) compilers. Removing the semi colon has no effect on the semantics.

Discussion

  • Karl Rupp

    Karl Rupp - 2010-12-15

    Thanks for pointing that out, this will be fixed in the upcoming version 1.1.0. :-)

     
  • Karl Rupp

    Karl Rupp - 2010-12-23
    • status: open --> closed
     
  • Karl Rupp

    Karl Rupp - 2012-02-13
    • status: closed --> closed-fixed