Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The undetected support of timestamp-query extension when using WebGPU backend #6691

Closed
liborui opened this issue Jul 28, 2022 · 4 comments
Closed

Comments

@liborui
Copy link

liborui commented Jul 28, 2022

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 12.4
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow.js installed from (npm or script link): npm

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?

Provide the exact sequence of commands / steps that you executed before running into the problem

Any other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

@qjia7
Copy link
Contributor

qjia7 commented Jul 29, 2022

@liborui WebGPU should work with ./Google Chrome Canary --enable-unsafe-webgpu. The warning message This device doesn't support timestamp-query extension. ... is only related with profiling mode. We shouldn't print it if tf.profile is not called. #6689 will resolve it.
To run webgpu, you may need to setup a https server instead of http server. Otherwise navigator.gpu will be null if the url is like http://ip-address:port/xxxx. Or use http://localhost:port/xxx in your local machine.
Currently, on MacOS, profile is not well supported. So you may can't see the individual op execution time using gpu timestamp query API in benchmarks. But the avg model execution time using 'peformance.now' is still correct.

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please @mention us if this needs more attention.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants