Conversation
| [profile.dev.package.wasmi] | ||
| opt-level = 2 | ||
| codegen-units = 1 |
There was a problem hiding this comment.
Do I need to also set it in all projects that use the crate?
There was a problem hiding this comment.
I found the answer myself: Yes 🙃
thread 'main' (733177) has overflowed its stack
fatal runtime error: stack overflow, aborting
[1] 733177 IOT instruction (core dumped) cargo run
There was a problem hiding this comment.
Actually, no, it doesn't help, I still get Stack Overflow in the emulator even with optimizations enabled.
There was a problem hiding this comment.
That's an extremely good question. I'd say it is mostly important for the final binary.
For testing you could also use Wasmi's new portable-dispatch crate feature. It executes way slower, but at least it works universally.
There was a problem hiding this comment.
Can you try:
[profile.release]
opt-level = 3
codegen-units = 1in your emulator?
There was a problem hiding this comment.
I tried that as well, same result.
There was a problem hiding this comment.
Last option is to enable Wasmi's portable-dispatch crate feature. Execution performance will likely suffer but at least it is universally applicable.
Yeah, sorry about that. It's the latest version in the git repo. |
I have some benchmarks for the device but all of them so far are focused on my implementation of host functions rather than the interpreter performance, since the latter is out of my control. I can hold on to merging the changes and later make some simple "CPU-heavy" benchmarks if you want. |
I really don't want to cause you even more work than already is on your plate. But it would certainly be very nice to know upfront, how future Wasmi versions behave, so that I can influence that. That way you kinda have control over the engine again. ;) I plan some more significant optimizations for future Wasmi version. So a set of compute benchmarks for your hardware would really be nice. |
|
I have published a new release, it now uses |
f237f64 to
3102c30
Compare
3102c30 to
bbf6f06
Compare
|
Sorry, I messed up |
|
@orsinium Can you try the following [profile.release]
opt-level = 3
codegen-units = 1If there are still stackoverflow issues, can you tell me the name of the target architecture so I can at least build for it and look at the assembly of Wasmi? |
|
Okay I have made some research: From docs I can see that you are using Espressif chips. Therefore either Xtensa or RISC-V based ones.
The RISV-V based ones properly support tail calls and LLVM also should have no issues dealing with them. |
We're on ESP32-S3 now, which is Xtensa. We want to move to ESP32-P4, which is RISC-V, but the native Rust bindings don't support P4 (and there is no plan to support it in 2026), so IDK yet if we managed to do that. |
Then enabling the |
cc @orsinium
Note: Wasmi
v2.0.0-beta.1really is just a beta version. Not actually production ready. Though I would be very interested how this Wasmi version performs on your firefly-zero hardware.Be warned. Though, I would love to know if and how this new Wasmi version changes performance for the
firefly-zeroproject so that I can apply necessary changes and optimizations before releasing the stable Wasmiv2.0.0.Furthermore, due to internal interpreter architecture changes it is necessary to always build this version of Wasmi with at least
even in
devmode. The reason for this is that otherwise sibling-calls won't get optimized and you get astack-overflowupon execution.Unfortunately, due to
It was a bit messy to check if this version still compiled, but according to my tests it does.