Error CL_INVALID_KERNEL_NAME when I use cl_khr_fp64 in a kernel

I have an error in an OpenCL kernel, when I try to use the cl_khr_fp64 extension, the kernel compiles and the build log is empty, but when I call clCreateKernel, I have CL_INVALID_KERNEL_NAME error.

The source that fails:

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

__kernel void simple( __global char *x, __global char *y ){
int id = get_global_id(0);
y[id]=2*x[id];
}

This source compiles right:

__kernel void simple( __global char *x, __global char *y ){
int id = get_global_id(0);
y[id]=2*x[id];
}

I'm using OpenCL 1.0 with a Tesla C1060 that have cl_khr_fp64 in CL_DEVICE_EXTENSIONS, driver 280.13 and CL_PLATFORM_VERSION=OpenCL 1.1 CUDA 4.0.1

The problem was that before call to clCreateProgramWithSource, we remove the newlines from source. E.g: the source:

"__kernel void f( __global char *x ){\nint id = get_global_id(0);\nx[id]=2;\n}"

Becomes:

"__kernel void simple( __global char *x, __global char *y ){"
"int id = get_global_id(0);"
"x[id]=2;}"

It causes no problem until we add the preproccessor directive.

It's the OpenCL preprocessor which actually wants newlines to be there. So, it should be written as:

"__kernel void simple( __global char *x, __global char *y ){\n"
"int id = get_global_id(0);\n"
"x[id]=2;}\n"

OpenCL Invalid Kernel Name - kernel - android, My kernel code is this: char kernel[1024] = "#pragma OPENCL EXTENSION is empty, but clCreateKernel returns CL_INVALID_KERNEL_NAME. EXTENSION cl_khr_fp64: enable \n\ \ kernel void diff(global double* u, \ int N, able to use your macro like so: #define CUDA_LAUNCH(kernel_name, gridsize, blocksize, . If you run vector_add opencl example design on A10 PAC card . Errors occur as following: [root@localhost vector_add]# ./bin/host Initializing OpenCL Platform: Intel(R) FPGA SDK for OpenCL(TM) Using 1 device(s) pac_a10 : PAC Arria 10 Platform (pac_a10_f100000) Using AOCX: vector_add.aocx Context callback: Specified kernel was not built for any devices ERROR: CL_INVALID_KERNEL_NAME Location

This is one of the very things that has been bugging me. The problem I think is the previously compiled code is cached somewhere and being reused. So your new changes give weird errors.

To fix it (NOT a "real solution" but it works for me) try changing your program name (and kernel name, maybe) e.g. if program is a.out then next time you compile make it a2.out and see if it is fixed. I hope this helps.

if you find a better solution please let us know.

Facing problem in error -46 (CL_INVALID_KERNEL_NAME , When I am running my code it is returning the error:-46 which means the clCreateKernel () is not invoking and i checked the kernel name in my� Hi Lightnix, This may be a little too late but I had the exact same problem as you. I however have found a workaround for fixing this. In your kernel method instead of passing it a char pointer make it so that it takes a uint pointer, this is effectively the same as a char. so your method signature should look like this "void hello(__global uint* out)", the char array holding hello world can

I also came cross such bug a few days ago and I just work it out. So I'm here sharing my solution although it's quite wired and I still don't know why.

static inline void CreateOCLKernels()
{
    std::cout << "ocl lowlevelengine: Creating ocl kernels ...\n";
    filterSubsample_ocl_kernel = clCreateKernel(program, "filterSubsampleUChar4Kernel", &clError);
    checkErr(clError, "clCreateKernel0");
    filterSubsampleWithHoles_float4_ocl_kernel = clCreateKernel(program, "filterSubsampleWithHolesFloat4Kernel", &clError);
    checkErr(clError, "clCreateKernel1");
    filterSubsampleWithHoles_float_ocl_kernel = clCreateKernel(program, "filterSubsampleWithHolesFloatKernel", &clError);
    checkErr(clError, "clCreateKernel2");
    gradientX_ocl_kernel = clCreateKernel(program, "gradientXKernel", &clError);
    checkErr(clError, "clCreateKernel3");
    gradientY_ocl_kernel = clCreateKernel(program, "gradientYKernel", &clError);
    checkErr(clError, "clCreateKernel4");
    //type-dependent ocl memset kernels
    memset_ocl_kernel_Vector4s = clCreateKernel(program, "memsetKernelVector4s", &clError);
    checkErr(clError, "clCreateKernel5");
}

This is my original code which is a static function called by a constructor of some class. The constructor can be called without any question. However, each time the above function is called, I would received the bug "invalid kernel name" resulting from opencl cannot find the kernel "filterSubsampleUChar4Kernel". I've tried a lot but none of them worked. But today, very occasionally, I try to change the function name and I succeed. What I do is nothing more than change "filterSubsampleUChar4Kernel" to "filterSubsampleKernel". I also tried to change other names, eg. "filterSubsampleKernel_test", "filterSubsample1Kernel". But they didn't work. It's quite wired, isn't it?

当我在内核中使用cl_KHR_fp64时出错CL_INVALID_KERNEL_NAME, Error CL_INVALID_KERNEL_NAME when I use cl_khr_fp64 in a kernel # pragma OPENCL EXTENSION cl_khr_fp64 : enable __kernel void� To do so in the kernel code, one would normally add a line "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" Now is there a way to a) tell CUDAfy to enable double precision on OpenCL hardware or b) load an existing CUDA C code instead of translating the C# code? Im using 4770K. Intel HD 4600. asrock z87 extreme

I guess you write OpenCL code using string. such as

std::string code =
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable"
"__kernel void simple( __global char *x, __global char *y )"
"{"
"int id = get_global_id(0);"
"y[id]=2*x[id];"
"}"

just add "\n" at the end of #pragma line

std::string code =
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
"__kernel void simple( __global char *x, __global char *y )"
"{"
"int id = get_global_id(0);"
"y[id]=2*x[id];"
"}"

カーネルでcl_khr_fp64を使用するとエラー , Error CL_INVALID_KERNEL_NAME when I use cl_khr_fp64 in a kernel # pragma OPENCL EXTENSION cl_khr_fp64 : enable __kernel void� All those functions use the mean kernel, which fails to build because cl_khr_fp64 is not enabled. In https://github.com/arrayfire/arrayfire/blob/v3.5/src/backend/opencl/kernel/mean.hpp#L176 is a check that enables it if the input type is double.

Black Duck / Ohloh similar tool, I use ".bind (this)" in my timeout function, and that is what causes me the problem. When I extend a function object with ".bind" in my script, it works like a charm. Hi, I am trying to use CLBlast on Intel CPU, and met with the following error: CLBlast: OpenCL error: clBuildProgram: -11 OpenCL compiler error/warning: Compilation started 39:79:27: error: use of type 'double' requires cl_khr_fp64 exten

OpenCL extension 'cl_khr_fp64' is unsupported � Issue #24 � fangq , Building kernel with option: -cl-mad-enable -DMCX_USE_NATIVE Kernel build log: :161:26: error: OpenCL extension 'cl_khr_fp64' is tenfeisun2018, you can use clinfo to check whether your device support cl_khr_fp64. C:\Users\Salabar\AppData\Local\Temp\OCL4044T2.cl:44:41: error: kernel parameter cannot be declared as a pointer to the __private address space __kernel void Futures(sfutures *_futures, ^ error: Clang front-end compilation failed! Frontend phase failed compilation. Error: Compiling CL to IR. Add “global” before pointers in kernel functions.

Segfault on clBuildProgram for simple CPU Kernel, I am using the intel opencl-1.2-6.4.0.24 runtime on an Intel(R) that occurs during compilation of a kernel, i.e. in clBuildProgram(). 009, //simple error checking, not strictly necessary: 053, case -46: return " CL_INVALID_KERNEL_NAME" ; 04, #pragma OPENCL EXTENSION cl_khr_fp64: enable� This black screen issue is common when using OpenCL. You have to wait for all kernels to compile the first time it render (this may take about 1 minute). Good to know that the reported issue has been fixed.

Comments
  • Just to clarify - you know that your compilation succeeds in the first case because you are checking the error code set by clBuildProgram, correct?
  • Compilation steps returns CL_SUCCESS, but I also check the build log
  • Are you saying that if you simply remove the cl_khr_fp64 line, clCreateKernel returns CL_SUCCESS?
  • I think Zhen is saying that compilation succeeds in both cases, but when he calls clCreateKernel(..., "simple", ...) in the first case, he gets CL_INVALID_KERNEL_NAME. The second case succeeds. Zhen, is this your situation?
  • thats the case @James. Both examples compiles, but with cl_khr_fp64 I get CL_INVALID_KERNEL_NAME on clCreateKernel.