unwasm icon indicating copy to clipboard operation
unwasm copied to clipboard

Simd128 support?

Open juls0730 opened this issue 1 month ago • 4 comments

Describe the feature

Hi, I've been playing around with WASM and Zig recently, and I recently tried enabling fixed width simd operation with zig. In the browser it works fine, but when loading the wasm module through nuxt (which I understand uses unwasm) I get this:

[unwasm] Failed to parse WASM module wasm/validator-7175a506b2723ec1.wasm: [unwasm] Failed to parse wasm/validator-7175a506b2723ec1.wasm: Error: Unexpected instruction: 0xfd

From what I understand, 0xfd indicates a simd instruction, is there any movement on getting simd support in unwasm? Thanks.

Additional information

  • [ ] Would you be willing to help implement this feature?

juls0730 avatar Nov 10 '25 16:11 juls0730

Some had been added through this patch: https://github.com/unjs/unwasm/blob/main/patches/%40webassemblyjs__helper-wasm-bytecode.patch

PR welcome to add any missing one

pi0 avatar Nov 10 '25 16:11 pi0

Some had been added through this patch: https://github.com/unjs/unwasm/blob/main/patches/%40webassemblyjs__helper-wasm-bytecode.patch

PR welcome to add any missing one

I'll see what I can do

juls0730 avatar Nov 10 '25 17:11 juls0730

Hey @pi0 I think I have a patch: https://github.com/juls0730/unwasm I'm going to try and test it before I make a PR.

juls0730 avatar Nov 11 '25 01:11 juls0730

Hm, upon further investigation, it may be more difficult than simply adding the instructions. In that patch I have above the number of arguments on a few of the instructions is wrong, but if I change around the values, it errors on v128.const and I think this is because the leb library cannot read u128 values, which the v128.const requires. I think for now I'll just continue not using simd on the server. Let me know if I can be of any use

juls0730 avatar Nov 11 '25 01:11 juls0730