diff --git a/sunnypilot/modeld/SConscript b/sunnypilot/modeld/SConscript index 90fb80975..1a54fe1e3 100644 --- a/sunnypilot/modeld/SConscript +++ b/sunnypilot/modeld/SConscript @@ -14,6 +14,7 @@ common_src = [ ] thneed_src_common = [ + "thneed/clutil_legacy.cc", "thneed/thneed_common.cc", "thneed/serialize.cc", ] diff --git a/sunnypilot/modeld/thneed/clutil_legacy.cc b/sunnypilot/modeld/thneed/clutil_legacy.cc index 42a4c1467..3bf931643 100644 --- a/sunnypilot/modeld/thneed/clutil_legacy.cc +++ b/sunnypilot/modeld/thneed/clutil_legacy.cc @@ -8,6 +8,17 @@ #include "common/swaglog.h" #include "sunnypilot/modeld/thneed/clutil_legacy.h" +void cl_print_build_errors(cl_program program, cl_device_id device) { + cl_build_status status; + clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, sizeof(status), &status, NULL); + size_t log_size; + clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size); + std::string log(log_size, '\0'); + clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, log_size, &log[0], NULL); + + LOGE("build failed; status=%d, log: %s", status, log.c_str()); +} + cl_program cl_program_from_binary(cl_context ctx, cl_device_id device_id, const uint8_t* binary, size_t length, const char* args) { cl_program prg = CL_CHECK_ERR(clCreateProgramWithBinary(ctx, 1, &device_id, &length, &binary, NULL, &err)); if (int err = clBuildProgram(prg, 1, &device_id, args, NULL, NULL); err != 0) {