Recovering from TDR in OpenCL


I’m trying to write some autotuning code that will run multiple variations of a kernel on a user’s machine to figure out which is fastest. I’m having a problem where a slow variation triggers a TDR. Given the “recovery” in the name I would think it should be possible for my program to carry on and run other variations, but after the TDR all my kernels fail. I have tried throwing away all the CL resources (buffers, command queues, context etc) and allocating new ones, but it doesn’t seem to help.

Is there any way to recover without killing and restarting the program? I’m aware that TDR can be disabled by messing with the registry, but that’s not necessarily something end-users will want to do.