cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

neebanv
Journeyman III

Error in compile-time arguments with AMD

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.

I am using OpenCL 1.2 AMD-APP (1311.2)

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

0 Likes
1 Solution
neebanv
Journeyman III

Found the answer :

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

View solution in original post

0 Likes
3 Replies
himanshu_gautam
Grandmaster

Have you tried back-slashing your commas....?

btw..Cool idea..

If backslashing does not work,

You can also try

"-DC1=0.1f -DC2=0.2f -DC3=0.5f -DC4=0.2f -DC5=0.1f"

And in the code...

float chnWeight[] =  {C1, C2, C3, C4, C5}

Best,

Bruhaspati

0 Likes
neebanv
Journeyman III

Found the answer :

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

0 Likes

Hi

Thanks for your confirmation.. Keep doing more experiments.


0 Likes