Skip to content

Deprecate -sUSE_WEBGPU in favor of --use-port=emdawnwebgpu #24220

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

Merged
merged 13 commits into from
May 22, 2025

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Apr 30, 2025

Add a linker warning for using -sUSE_WEBGPU pointing to --use-port=emdawnwebgpu, and update documentation.

Moves the port from contrib.emdawnwebgpu to just emdawnwebgpu since we'll keep maintaining it as we work on Emdawnwebgpu.

Emscripten's implementation of webgpu.h is unmaintained. Dawn now maintains "emdawnwebgpu", a fork of Emscripten's implementation that is up to date, resolving #23432.

We want people to move to emdawnwebgpu. However, the API has changed substantially, so it will take people time to switch over. Plus, there might be new bugs in that implementation. So we need a decently long deprecation period before removing the old implementation.

Closes #23432
Starts fixing #24265

@kainino0x kainino0x force-pushed the deprecate-use_webgpu branch from 7b73690 to 6eff958 Compare April 30, 2025 04:46
@xpenatan
Copy link
Contributor

xpenatan commented May 2, 2025

Hi, what about firefox or browsers that dont use dawn?

@kainino0x
Copy link
Collaborator Author

kainino0x commented May 2, 2025

emdawnwebgpu is independent of browser (except it supports a few experimental features that are only in Chromium browsers). They're actually just a fork of the bindings currently in Emscripten, the only difference is we're maintaining them in the Dawn repository instead of here.

I should clarify this in the deprecation message and/or in the emdawnwebgpu docs.

@kainino0x kainino0x force-pushed the deprecate-use_webgpu branch from 0eb1be6 to b23f8e8 Compare May 6, 2025 01:32
@kainino0x kainino0x marked this pull request as ready for review May 6, 2025 01:41
@kainino0x kainino0x requested a review from sbc100 May 6, 2025 01:42
@sbc100
Copy link
Collaborator

sbc100 commented May 6, 2025

I think we should maybe wait until we have a way for folks to do --use-port=contrib/emdawn.py (or something like that) to use the new version. i.e. lets fix #24260 first?

@ypujante
Copy link
Contributor

ypujante commented May 6, 2025

I think we should maybe wait until we have a way for folks to do --use-port=contrib/emdawn.py (or something like that) to use the new version. i.e. lets fix #24260 first?

I agree 100%. It would be better to deprecate -sUSE_WEBGPU while offering an alternative that is as painless as possible. And using the --user-port=contrib.emdawn syntax would be the least painless possible...

@kainino0x
Copy link
Collaborator Author

Seems reasonable.

Adds a linker warning for using -sUSE_WEBGPU, and update documentation.

Emscripten's implementation of webgpu.h is unmaintained. We want people
to move to Dawn's emdawnwebgpu implementation (fork). However, the API
has changed substantially, so this not a clean transition. Plus, there
might be new bugs in that implementation. So we need a decently long
deprecation period before removing the old implementation.

Issue: 23432
@kainino0x kainino0x force-pushed the deprecate-use_webgpu branch from b23f8e8 to 72bcff5 Compare May 20, 2025 20:24
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a ChangeLog entry?

@kainino0x kainino0x marked this pull request as ready for review May 20, 2025 23:01
@kainino0x kainino0x changed the title Deprecate -sUSE_WEBGPU in favor of Dawn's emdawnwebgpu Deprecate -sUSE_WEBGPU in favor of --use-port=emdawnwebgpu May 20, 2025
@kainino0x kainino0x requested a review from sbc100 May 21, 2025 00:16
@kainino0x kainino0x force-pushed the deprecate-use_webgpu branch from be8431a to 35d443b Compare May 21, 2025 01:43
@kainino0x kainino0x force-pushed the deprecate-use_webgpu branch from 3fdc55f to eb3ce73 Compare May 21, 2025 22:43
@kainino0x
Copy link
Collaborator Author

@sbc100 I think this is ready again. I've done a bunch of stuff since your last full review, so could you review again?

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm % comments

@kainino0x
Copy link
Collaborator Author

kainino0x commented May 22, 2025

The dylink variants failed with:
Exception: FROZEN_CACHE is set, but cache file is missing: "sysroot/lib/wasm32-emscripten/pic/lib_emdawnwebgpu-8eb10848-O0.a" (in cache root path "/root/cache")

I've removed those for now but how would I fix that?

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2025

The dylink variants failed with: Exception: FROZEN_CACHE is set, but cache file is missing: "sysroot/lib/wasm32-emscripten/pic/lib_emdawnwebgpu-8eb10848-O0.a" (in cache root path "/root/cache")

I've removed those for now but how would I fix that?

The other test suite runs in mode where it assumes that all libraries have already been built by the build-linux CI phase.

In order to ensure we don't regresss here we use FROZEN_CACHE so that the test suite cannot build anything new itself.

If you want a port to be available in PIC mode here I think you would need to add it to MINIMAL_PIC_TASKS in ./embuilder.py.

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2025

Also the name of the library looks a little odd. Libraries don't normally have an underscore after the lib part. e.g we call them libc and libz and not lib_c and lib_z

@ypujante
Copy link
Contributor

Also the name of the library looks a little odd. Libraries don't normally have an underscore after the lib part. e.g we call them libc and libz and not lib_c and lib_z

To play devil's advocate here, I would argue that lib_emdawnwebgpu-8eb10848-O0.a is far more readable than libemdawnwebgpu-8eb10848-O0.a... It only looks "odd" because you are used to having short library names and you have seen this names for a long time...

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2025

Also the name of the library looks a little odd. Libraries don't normally have an underscore after the lib part. e.g we call them libc and libz and not lib_c and lib_z

To play devil's advocate here, I would argue that lib_emdawnwebgpu-8eb10848-O0.a is far more readable than libemdawnwebgpu-8eb10848-O0.a... It only looks "odd" because you are used to having short library names and you have seen this names for a long time...

It looks odd because it doesn't follow the standard naming convention.

You could argue the convention is wrong, or needs updating, but I don't think this is the right forum for that.

@kainino0x
Copy link
Collaborator Author

If you want a port to be available in PIC mode here I think you would need to add it to MINIMAL_PIC_TASKS in ./embuilder.py.

Thanks for the tip! It's probably not necessary, I think I'd rather not add a port to that list.

@kainino0x
Copy link
Collaborator Author

Also the name of the library looks a little odd. Libraries don't normally have an underscore after the lib part. e.g we call them libc and libz and not lib_c and lib_z

This name comes from the upstream port, so I'll take note and consider changing it at some point while I'm doing something else (doesn't seem important enough to make a whole CL to change).

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2025

If you want a port to be available in PIC mode here I think you would need to add it to MINIMAL_PIC_TASKS in ./embuilder.py.

Thanks for the tip! It's probably not necessary, I think I'd rather not add a port to that list.

The point of that list is purely to enable this kind of testing. giflib (a port) is already in the list.

Users won't be using that list. And also ./embuilder ALL will already include your new port so its already in embuillder in that sense.

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2025

Also the name of the library looks a little odd. Libraries don't normally have an underscore after the lib part. e.g we call them libc and libz and not lib_c and lib_z

This name comes from the upstream port, so I'll take note and consider changing it at some point while I'm doing something else (doesn't seem important enough to make a whole CL to change).

Indeed, not a blocker.

@kainino0x
Copy link
Collaborator Author

The point of that list is purely to enable this kind of testing. giflib (a port) is already in the list.

Users won't be using that list. And also ./embuilder ALL will already include your new port so its already in embuillder in that sense.

Ah, then it wouldn't be so bad. Though thinking about it, it looks like that's a list of filenames, and since we have a filename that changes constantly it would introduce friction to the roll (unless maybe we detect that we're being downloaded in "remote port" configuration and remove the hash). It's fine, we want the more rigorous testing in Dawn anyway so we catch issues before landing them.

@kainino0x kainino0x enabled auto-merge (squash) May 22, 2025 18:39
@kainino0x kainino0x merged commit 3e6ddb0 into emscripten-core:main May 22, 2025
30 checks passed
@kainino0x kainino0x deleted the deprecate-use_webgpu branch May 22, 2025 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emscripten's webgpu.h is behind the standard and Dawn implementations
4 participants