Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16556 Discussions

Obtaining CL_INVALID_KERNEL error when setting cl_float4 as a kernel argument

Altera_Forum
Honored Contributor II
2,336 Views

Hello, 

 

I have got a question about the function 'clSetKernelArg()' and the error code 'CL_INVALID_KERNEL'. 

 

My problem: 

My kernel function takes nine parameters. 

When I try to set the kernel arguments via the function 'clSetKernelArg()' everything works fine until I want to set a cl_float4. I then get a 'CL_INVALID_KERNEL' error. 

 

Is cl_float4 not supported by FPGA? 

When I run the same code on CPU or GPU everything works fine. 

 

Any hints will be apprecciated. 

 

Tobias
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
1,334 Views

Is the "CL_INVALID_KERNEL" error generated by clSetKernelArg() or clEnqueueNDRangeKernel()? CL_INVALID_KERNEL points to an invalid kernel object, I highly doubt your problem has anything to do with using cl_float4. Are you correctly creating your program from a pre-compiled binary using clCreateProgramWithBinary (instead of clCreateProgramWithSource), and then creating your kernel from that program using clCreateKernel()?

0 Kudos
Altera_Forum
Honored Contributor II
1,334 Views

Hi HRZ, 

 

thank you for your answer. 

 

The 'CL_INVALID_KERNEL' error is generated by clSetKernelArg(). After each call of this function the returned cl_int value is checked for errors. There is none for the first eight parameters, but for the ninth (cl_float4).  

If the order of setting kernel arguments is changed, it is again successful until the cl_float4 argument.  

 

The program is obtained from a pre-compiled binary by using clCreateProgramWithBinary() in combination with clBuildProgram(). Afterwards the kernel is created with clCreateKernel().
0 Kudos
Altera_Forum
Honored Contributor II
1,334 Views

It's a small thing, but check the index value you set in each call of clSetKernelArg. If you accidentally use the same index (from a copy/paste), you will have an issue. cl_float4 should work fine.

0 Kudos
Altera_Forum
Honored Contributor II
1,334 Views

Can you post the host code starting from clCreateProgramWithBinary() until clEnqueueNDRangeKernel()? Please either attach the file to your post, or copy paste it between the "code" tag so that indentation is preserved.

0 Kudos
Altera_Forum
Honored Contributor II
1,334 Views

Actually, it was not the cl_float4 value. After I reduced the number of arguments to 8 it worked out.

0 Kudos
Reply