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

Fixes to get example running in wasm #267

Merged
merged 1 commit into from
Jan 26, 2023
Merged

Fixes to get example running in wasm #267

merged 1 commit into from
Jan 26, 2023

Conversation

raphlinus
Copy link
Contributor

A number of things were wrong:

  • The args were missing to run
  • The robust memory changes introduced uniformity errors
  • clear_buffer is a todo for wgpu on wasm
  • Some more time calls crept in
  • Initializing both env_logger and console_logger fails

In addition, we conditionally opt the shaders into workgroupUniformLoad, as that's available on wasm but not yet native.

Some of the things (args, uniformity errors) are important fixes. Other things (clear_buffer, wUL being optional) are workarounds for wgpu limitations and have TODO items to be removed when wgpu catches up.

A number of things were wrong:

* The args were missing to `run`
* The robust memory changes introduced uniformity errors
* `clear_buffer` is a todo for wgpu on wasm
* Some more time calls crept in
* Initializing both env_logger and console_logger fails

In addition, we conditionally opt the shaders into
`workgroupUniformLoad`, as that's available on wasm but not yet native.

Some of the things (args, uniformity errors) are important fixes. Other
things (clear_buffer, wUL being optional) are workarounds for wgpu
limitations and have TODO items to be removed when wgpu catches up.
@raphlinus
Copy link
Contributor Author

This will close #237, as it uses workgroupUniformLoad on wasm targets.

Copy link
Collaborator

@dfrg dfrg left a comment

Choose a reason for hiding this comment

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

I see what’s going on but the changes here are… unfortunate :(

@raphlinus raphlinus merged commit ca79d5c into main Jan 26, 2023
@raphlinus raphlinus deleted the wasm_fix branch January 26, 2023 22:18
raphlinus added a commit that referenced this pull request Jan 29, 2023
Just load the atomic bump counter directly instead of piping it through a shared variable, when workgroupUniformLoad is not available. The value is in fact dynamically uniform, but that depends on the stage not setting its own failure flag, a fairly subtle invariant.

I think there was a write-after-read hazard for the reuse of sh_part_count[0]. However, doing the experiment of just changing that doesn't fix the problem on mac. It's possible there's a shader compilation problem (possibly the same one as provoking the storageBarrier workaround in tile_alloc), or also possibly a logic error I'm not understanding.

In any case, this change does appear to fix the hangs on mac.

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

Successfully merging this pull request may close these issues.

2 participants