سؤال

This is regarding compile time argument in openCL. I have an array of constants of fixed size, and I am passing it as compile-time argument, as follows:

 -DCOEFF=0.1f,0.2f,0.5f,0.2f,0.1f

And in the Kernel, I am reading it as,

__kernel void Smoothing(__global const float *in, __global float *out)
{
    float chnWeight[] = {COEFF};

}

This way, using intel-SDK, I am getting a considerable amount of performance benefit, compared to passing the Coefficients as another argument to the kernel.

The problem is in AMD, this is not getting compiled. I am getting the following error :

0.2f:
Catastrophic error: cannot open source file "0.2f"

1 catastrophic error detected in the compilation of "0.2f".
Compilation terminated.

I understand that in AMD (comma) is also taken as a separating character for the compile time arguments, and this is causing the error.

Any help to solve this problem will be appreciated. Thanks in advance.

هل كانت مفيدة؟

المحلول

This problem was introduced into AMD OpenCL sometime between versions 937.2 and 1268.1. Here is a work-around:

Replace, -DCOEFF=0.1f,0.2f,0.5f,0.2f,0.1f with -D COEFF=0.1f,0.2f,0.5f,0.2f,0.1f

نصائح أخرى

Try quoting the string to -DCOEFF="0.1f,0.2f,0.5f,0.2f,0.1f"

It looks that the compiler is looking for the file "0.2f" and that is the second element, so after the first element and comma the compiler has already stopped interpreting the input as part of the COEFF define.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top