File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ JS_METHOD(createProgramWithBinary) { NAPI_ENV;
3939 void *host_ptr = nullptr ;
4040 size_t len = 0 ;
4141 getPtrAndLen (js_binaries.Get (i).As <Napi::Object>(), &host_ptr, &len);
42-
4342 cl_binary_lengths.push_back (len);
4443 cl_binaries_str.push_back (static_cast <const unsigned char *>(host_ptr));
4544 }
@@ -439,7 +438,7 @@ JS_METHOD(getProgramInfo) { NAPI_ENV;
439438 }
440439 RET_VALUE (arr);
441440 }
442- // DRIVER ISSUE : segfault if program has not been compiled
441+
443442 case CL_PROGRAM_BINARIES: {
444443 cl_uint nsizes;
445444 CHECK_ERR (clGetProgramInfo (
@@ -459,17 +458,28 @@ JS_METHOD(getProgramInfo) { NAPI_ENV;
459458 nullptr
460459 ));
461460
461+ size_t n_size_total = 0 ;
462462 unsigned char ** bn = new unsigned char * [nsizes];
463463 for (size_t i = 0 ; i < nsizes; i++) {
464+ n_size_total += sizes[i];
464465 bn[i] = new unsigned char [sizes[i]];
465466 }
466467
468+ size_t n_ret_size = 0 ;
467469 CHECK_ERR (clGetProgramInfo (
468470 prog,
469471 CL_PROGRAM_BINARIES,
470- sizeof (unsigned char *) *nsizes,
472+ n_size_total,
473+ nullptr ,
474+ &n_ret_size
475+ ));
476+
477+ CHECK_ERR (clGetProgramInfo (
478+ prog,
479+ CL_PROGRAM_BINARIES,
480+ n_ret_size,
471481 bn,
472- sizes. get ()
482+ nullptr
473483 ));
474484
475485 Napi::Array arr = Napi::Array::New (env);
You can’t perform that action at this time.
0 commit comments