Description
Hi guys!
I am studying to use Tensorflow.js to run DNN in the Web browser with WebGPU feature.
Example #1
So, I first use the MobileNet
example (Source) of Tensorflow.js as an initial point. However, the example does not use the WebGPU backend of Tensorflow.js. So I modified the first few lines of index.js
to use the WebGPU backend, as shown below:
import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-backend-webgpu'
import { IMAGENET_CLASSES } from './imagenet_classes';
tf.setBackend('webgpu');
Then, following the npm install
and npm run watch
, the example indeed runs and could perform the DNN inference.
However, when I watch the terminal output of Chrome, I see a warning that says
This device doesn't support timestamp-query extension. Start Chrome browser with flag --disable-dawn-features=disallow_unsafe_apis then try again. Or zero will shown for the kernel time when profiling mode is enabled. Using performance.now is not workable for webgpu since it doesn't support synchronously to read data from GPU.
Example #2
Another example I tried is the performance benchmark between WebGPU and WebGL backend of Tensorflow.js in the official repo of Tensorflow.js. source
I use python3 -m http.server
to run a HTTP server in the perf
folder, and run the benchmark.
However, the generated result shows that Tensorflow.js cannot get the execution time when running benchmarks on WebGPU. Moreover, the support timestamp-query extension
warning is also appeared in the terminal of the browser.
Execution environment of my experiments
I am using MacBook Pro M1 Max (with built-in GPU) + Google Chrome Canary (106.0.5205.0)
Efforts I have tried
To make the timestamp-query extension
work, following the instructions in the warning, I tried
./Google Chrome Canary --args --disable-dawn-features=disallow_unsafe_apis
However, this trick does not take any efforts.
So please you guys give me a hint that I can enable this feature?