Intent to Ship: WebGPU: ServiceWorker and SharedWorker support

420 views
Skip to first unread message

François Beaufort

unread,
Mar 11, 2024, 4:07:17 PMMar 11
to blink-dev

Contact emails

fbea...@google.com

Explainer

None

Specification

https://gpuweb.github.io/gpuweb/#navigator-gpu

Summary

Functionality added to the WebGPU spec after its first shipment in a browser. ServiceWorker and SharedWorker support is added to WebGPU, aligning with existing WebGL capabilities.


Blink component

Blink>WebGPU

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

ServiceWorker and SharedWorker support have not yet been implemented in any browser, but have been approved by the GPU for the Web Community Group, with representatives from Chrome, Firefox, and Safari. See minutes at https://docs.google.com/document/d/15w7nsvqWwITA5yvCrsO3SEIEuZziXzj7YsrHN4Jd2uM/edit#heading=h.jbe7pg8ebd43


Gecko: No signal (https://github.com/mozilla/standards-positions/issues/971)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/294#issuecomment-1877411933)

Web developers: Positive (https://github.com/gpuweb/gpuweb/issues/4197)

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

No
All platforms will eventually have support. Will immediately be available on Android, ChromeOS, Mac, and Windows, since those platforms already support WebGPU. Linux is planned to have WebGPU support in the future, so this feature will become available when WebGPU does.


Is this feature fully tested by web-platform-tests?

Yes

WebGPU/WGSL have a conformance test suite (https://github.com/gpuweb/cts) that is regularly pulled into Chromium and part of the testing of Dawn/Tint in Chromium. PRs: https://github.com/gpuweb/cts/pull/3419 - https://github.com/gpuweb/cts/pull/3345


Flag name on chrome://flags

None

Finch feature name

WebGPUExperimentalFeatures

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1521763

Estimated milestones

Shipping on desktop124
Shipping on Android124


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/4875951026733056

Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPpwU5%2BewUL-PTEQ_ZQgdtViKU2fSVXeDNab2oEy6RsGqkgcGQ%40mail.gmail.com

This intent message was generated by Chrome Platform Status.

Mike Taylor

unread,
Mar 12, 2024, 1:59:05 PMMar 12
to François Beaufort, blink-dev

On 3/11/24 4:06 PM, 'François Beaufort' via blink-dev wrote:

Contact emails

fbea...@google.com

Explainer

None
Could you write a few sentences why this is a useful addition?


Specification

https://gpuweb.github.io/gpuweb/#navigator-gpu

Summary

Functionality added to the WebGPU spec after its first shipment in a browser. ServiceWorker and SharedWorker support is added to WebGPU, aligning with existing WebGL capabilities.


Blink component

Blink>WebGPU

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

ServiceWorker and SharedWorker support have not yet been implemented in any browser, but have been approved by the GPU for the Web Community Group, with representatives from Chrome, Firefox, and Safari. See minutes at https://docs.google.com/document/d/15w7nsvqWwITA5yvCrsO3SEIEuZziXzj7YsrHN4Jd2uM/edit#heading=h.jbe7pg8ebd43


Gecko: No signal (https://github.com/mozilla/standards-positions/issues/971)
Not officially a positive signal, but looking positive based on the comments.
This is kind of an "N/A to positive", given it's WebGPU.


Web developers: Positive (https://github.com/gpuweb/gpuweb/issues/4197)

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

No
All platforms will eventually have support. Will immediately be available on Android, ChromeOS, Mac, and Windows, since those platforms already support WebGPU. Linux is planned to have WebGPU support in the future, so this feature will become available when WebGPU does.
What about WebView? Do we ship support for WebGPU there?


Is this feature fully tested by web-platform-tests?

Yes

WebGPU/WGSL have a conformance test suite (https://github.com/gpuweb/cts) that is regularly pulled into Chromium and part of the testing of Dawn/Tint in Chromium. PRs: https://github.com/gpuweb/cts/pull/3419 - https://github.com/gpuweb/cts/pull/3345


Flag name on chrome://flags

None

Finch feature name

WebGPUExperimentalFeatures

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1521763

Estimated milestones

Shipping on desktop 124
Shipping on Android 124


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/4875951026733056

Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPpwU5%2BewUL-PTEQ_ZQgdtViKU2fSVXeDNab2oEy6RsGqkgcGQ%40mail.gmail.com

This intent message was generated by Chrome Platform Status.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPpwU5Lo3k-Gynt4M%2BwgV3yfg%2BFvM1npij%2BGTNZLW-VZHojXYA%40mail.gmail.com.

François Beaufort

unread,
Mar 12, 2024, 3:10:26 PMMar 12
to Mike Taylor, blink-dev
On Tue, Mar 12, 2024 at 6:58 PM Mike Taylor <mike...@chromium.org> wrote:

On 3/11/24 4:06 PM, 'François Beaufort' via blink-dev wrote:

Contact emails

fbea...@google.com

Explainer

None
Could you write a few sentences why this is a useful addition?
 
Service Workers enable offline capabilities and background processing for WebGPU. This means graphics-intensive web applications or Chrome Extensions can cache resources and perform computations even when the user isn't actively interacting with the page.
Shared Workers allow multiple tabs or extension contexts to coordinate and share WebGPU resources. This leads to smoother performance and more efficient use of the user's graphics hardware.

Specification

https://gpuweb.github.io/gpuweb/#navigator-gpu

Summary

Functionality added to the WebGPU spec after its first shipment in a browser. ServiceWorker and SharedWorker support is added to WebGPU, aligning with existing WebGL capabilities.


Blink component

Blink>WebGPU

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

ServiceWorker and SharedWorker support have not yet been implemented in any browser, but have been approved by the GPU for the Web Community Group, with representatives from Chrome, Firefox, and Safari. See minutes at https://docs.google.com/document/d/15w7nsvqWwITA5yvCrsO3SEIEuZziXzj7YsrHN4Jd2uM/edit#heading=h.jbe7pg8ebd43


Gecko: No signal (https://github.com/mozilla/standards-positions/issues/971)
Not officially a positive signal, but looking positive based on the comments.

Indeed. 
This is kind of an "N/A to positive", given it's WebGPU.

Agree ;) 

Web developers: Positive (https://github.com/gpuweb/gpuweb/issues/4197)

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

No
All platforms will eventually have support. Will immediately be available on Android, ChromeOS, Mac, and Windows, since those platforms already support WebGPU. Linux is planned to have WebGPU support in the future, so this feature will become available when WebGPU does.
What about WebView? Do we ship support for WebGPU there?

Yes. WebGPU is supported on Android WebView as well.

Yoav Weiss (@Shopify)

unread,
Mar 12, 2024, 5:14:08 PMMar 12
to François Beaufort, Mike Taylor, blink-dev

François Beaufort

unread,
Mar 13, 2024, 3:06:39 AMMar 13
to Yoav Weiss (@Shopify), Mike Taylor, blink-dev

Note that Shared Workers are not available on Android for now. See https://issues.chromium.org/issues/40290702 

Daniel Bratell

unread,
Mar 13, 2024, 4:55:02 AMMar 13
to François Beaufort, Yoav Weiss (@Shopify), Mike Taylor, blink-dev

Just to ask what is probably a FAQ to get it out here...

The Service Worker timeout is 30 seconds right, so regardless of how heavy the calculations are, a service worker and its associated calculations will die in 30 seconds after the user closes the associated page?

I ask because while it's been possible to run heavy calculations in various workers in the past, this explicitly encourages it. It would be a bad situation if a user cannot detect or stop a runaway WebGPU operation from a possibly hostile site.

/Daniel

Corentin Wallez

unread,
Mar 13, 2024, 10:28:42 AMMar 13
to blink-dev, Daniel Bratell, Mike Taylor, blink-dev, François Beaufort, Yoav Weiss (@Shopify)
I don't know the ServiceWorker mechanisms too much, but if the Javascript dies in 30 seconds then WebGPU operations will soon after. There isn't a lot of use in keeping WebGPU computations running for much longer as Javascript is needed to get the result of any computation in any useful places (canvas, ArrayBuffer, MediaStream, etc). Technically the ServiceWorker could send a much longer running job to the GPU (think an infinite loop) but apart from DDoS there wouldn't be any use to this.

You might also be interested in the privacy and security section of the WebGPU spec.

Corentin Wallez

unread,
Mar 13, 2024, 12:40:32 PMMar 13
to blink-dev, Corentin Wallez, Daniel Bratell, Mike Taylor, blink-dev, François Beaufort, Yoav Weiss (@Shopify)
Just to clarify, the ServiceWorker cannot do anything more than what the main thread can do for DoS. Or I guess the only additional capability is that it can trigger it up to 30 seconds after the user left the page.

The reason why we can't prevent DoS in all cases is that most GPUs don't have preemption so sending an infinite loop can make some of the processing units stuck forever. Chromium has mechanisms to try to detect this and assign the blame to a website that won't be allowed GPU access in the future, and some OSes can restart a stuck GPU. But this is all best effort (unfortunately, and already the case with WebGL, or potentially DOM with crazy filters).

Mike Taylor

unread,
Mar 13, 2024, 12:50:10 PMMar 13
to Corentin Wallez, blink-dev, Daniel Bratell, François Beaufort, Yoav Weiss (@Shopify)

LGTM2

Chris Harrelson

unread,
Mar 14, 2024, 11:01:25 AMMar 14
to Mike Taylor, Corentin Wallez, blink-dev, Daniel Bratell, François Beaufort, Yoav Weiss (@Shopify)
Reply all
Reply to author
Forward
0 new messages