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

Avoid calling std::time::Instant::now on wasm32-unknown-unknown #283

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

robertknight
Copy link
Owner

  • std::time::Instant::now panics on wasm32-unknown-unknown. Replace calls with a wrapper which is currently a no-op, but can be modified to use performance.now() in future.
  • Fix test execution under wasm32 by skipping the Model::load_mmap test
  • Add a note about how to modify the wasm build to get a useful stacktrace if a crash happens

See robertknight/ocrs#93.

This function was called at the start of every graph run, even when timing was
disabled. Replace it with a fallback which does nothing on wasm32. In future
this can be modified to use `performance.now()`.
This makes it possible to get the stack trace if model loading crashes inside
the rten wasm binary.
Downstream applications targeting wasm32 will need to use `Model::load_file`
instead.
@robertknight robertknight merged commit dd29ee3 into main Jul 17, 2024
2 checks passed
@robertknight robertknight deleted the wasm-no-instant branch July 17, 2024 07:53
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.

1 participant