OpenCL FreeDataSpace thrown exception


#1

Hi there,

I compiled my own model with opencl as backend.
The model can inference normally, but it will throw an exception during opencl free stage.

The exception is an access violation reading occurred in the following function:
OpenCLWorkspace::FreeDataSpace
OPENCL_CALL(clReleaseMemObject(mptr));
(Exception thrown at 0x00007FFFD62A669F (ntdll.dll))

Is anyone can suggest how to debug and solve this problem?


#2

Update the current status:

I can pin down the suspected mptr is allocated in workspace_pool.cc: line41
e.data = device->AllocDataSpace(ctx, nbytes, kTempAllocaAlignment, type);

I check the error code of allocation is sucess, but somehow in the program end, when workspace need to release at workspace_pool.cc: line99 (void Release(TVMContext ctx, DeviceAPI* device))

It just thrown access violation exception when releasing the suspected mptr.

I also check the mptr is only released once.

My hardware is Nvidia GTX 1060.

Any idea?

update2:

The allocation is called by a fused kernel:
fuse__contrib_conv2d_winograd_without_weight_transform_broadcast_mul_broadcast_add_relu_1()
in my compiled dynamic library.