I am attempting to get my web browser to gracefully handle and recover from a “GPU connection lost” error. I have been trying various implementations similar to the following, but have not yet landed on something that works.
const device = tf.backend().device;
device.lost.then(async (info) => {
console.error(`WebGPU device was lost: ${info.message}`, info);
await device.destroy();
await tf.disposeVariables();
tf = null;
await import(`https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@4.17.0/dist/tf.min.js?random=${Math.random()}`);
await tf.setBackend("webgpu");
const device = tf.backend().device;
}
Issue is, no matter what I do, the device that is returned appears to not be connected and immediately is “lost”. I suspect the browser cache may be preventing me from re-initializing tfjs module. Is this the right approach? Is there some undocumented way to reconnect an existing tfjs instance to the GPU? I am hoping somebody out there might be able to point me in the right direction.
I am using tensoflow.js with the webGPU backend on the Chrome browser