cl.setKernelArg(kernel, idx, 'local', size) gives invalid argument error.
It seems argument 2 ('local') is treated as local memory size. The patch may be as follows:
diff --git a/src/kernel.cpp b/src/kernel.cpp
index 5f4cf2e..69550a6
--- a/src/kernel.cpp
+++ b/src/kernel.cpp
@@ -294,10 +294,10 @@ NAN_METHOD(SetKernelArg) {
if (local_arg) {
// expect a size type
- if (!info[2]->IsNumber())
+ if (!info[3]->IsNumber())
THROW_ERR(CL_INVALID_ARG_VALUE);
// local buffers are intialized with their size (data = NULL)
- size_t local_size = info[2]->ToInteger()->Value();
+ size_t local_size = info[3]->ToInteger()->Value();
err = ::clSetKernelArg(k->getRaw(), arg_idx, local_size, NULL);
} else if ('*' == type_name[type_name.length() - 1] || type_name == "cl_mem"){
// type must be a buffer (CLMem object)
cl.setKernelArg(kernel, idx, 'local', size) gives invalid argument error. It seems argument 2 ('local') is treated as local memory size. The patch may be as follows: