The case causes like this:
our thread hold the ref of the batch buffer, but have called
cl_driver_delete to delete the bufmgr. So when we release
the buffer object next time, the bufmgr's function pointer
is invalid and cause the crash.
We now release the batch buffer before every time call the
cl_set_thread_batch_buf.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Tested-by: "Yang, Rong R" <rong.r.yang@intel.com>
assert(ctx->buffers == NULL);
assert(ctx->drv);
cl_free(ctx->prop_user);
+ cl_set_thread_batch_buf(NULL);
cl_driver_delete(ctx->drv);
ctx->magic = CL_MAGIC_DEAD_HEADER; /* For safety */
cl_free(ctx);
#include "cl_driver.h"
#include "cl_device_data.h"
#include "cl_khr_icd.h"
+#include "cl_thread.h"
#include "CL/cl.h"
#include <assert.h>
cl_get_gt_device(void)
{
cl_device_id ret = NULL;
+ cl_set_thread_batch_buf(NULL);
const int device_id = cl_driver_get_device_id();
#define DECL_INFO_STRING(STRUCT, FIELD, STRING) \