Hello
We have a production use case where we would like to use Wasmtime to run a Wasm module that has been initialized with more than 4GB of data. I have been running into a few u32 overflows while trying this (even when the memory64 config setting is enabled). Some of the errors seem to be coming from the "wasm-encoder" and "wasmparser" crates, and some from the Wasmtime code itself. Specifically the errors seems to be happening when Wasmtime is compiling and initializing the Wasm module before execution (see links below).
Note, this doesn't seem to be an issue when the Wasm module starts with less than 4GB of data and then grows to more than 4GB of data while running. Only if the Wasm module starts with more than 4GB of data.
I was able to get things working in a fork by changing those u32s to u64 (or usize in some cases). I was wondering if there are plans to add support for this use case? Or maybe I have missed something about why it is implemented as is?
Here's a link to my Wasmtime diff for reference: main...ryankalla:wasmtime:main
And here is my Wasm-Tools diff: bytecodealliance/wasm-tools@main...ryankalla:wasm-tools:main
P.S.
I used Wizer to initialize and snapshot the Wasm module I'm using (this is where I'm loading >4GB of data into memory). I needed to make some similar changes to Wizer as well to enable memory64 and support these large data sizes.
Here is a link to my Wizer diff: bytecodealliance/wizer@main...ryankalla:wizer:main
Let me know if I should open separate issues in the Wasm-Tools and Wizer repos, or just keep the whole discussion here.
Thanks!
Hello
We have a production use case where we would like to use Wasmtime to run a Wasm module that has been initialized with more than 4GB of data. I have been running into a few u32 overflows while trying this (even when the memory64 config setting is enabled). Some of the errors seem to be coming from the "wasm-encoder" and "wasmparser" crates, and some from the Wasmtime code itself. Specifically the errors seems to be happening when Wasmtime is compiling and initializing the Wasm module before execution (see links below).
Note, this doesn't seem to be an issue when the Wasm module starts with less than 4GB of data and then grows to more than 4GB of data while running. Only if the Wasm module starts with more than 4GB of data.
I was able to get things working in a fork by changing those u32s to u64 (or usize in some cases). I was wondering if there are plans to add support for this use case? Or maybe I have missed something about why it is implemented as is?
Here's a link to my Wasmtime diff for reference: main...ryankalla:wasmtime:main
And here is my Wasm-Tools diff: bytecodealliance/wasm-tools@main...ryankalla:wasm-tools:main
P.S.
I used Wizer to initialize and snapshot the Wasm module I'm using (this is where I'm loading >4GB of data into memory). I needed to make some similar changes to Wizer as well to enable memory64 and support these large data sizes.
Here is a link to my Wizer diff: bytecodealliance/wizer@main...ryankalla:wizer:main
Let me know if I should open separate issues in the Wasm-Tools and Wizer repos, or just keep the whole discussion here.
Thanks!