design icon indicating copy to clipboard operation
design copied to clipboard

[EcmaScript] 128-bit data type for import/export (SIMD)

Open L2NE-dev opened this issue 2 years ago • 3 comments

For interop between WASM modules needs dedicated EcmaScript v128 data type in EcmaScript. Not Number or BigInt. There is probably needs sort of register reference, or exported 128-bit packed or bitfield value. I not means about SIMD in EcmaScript, but means about data type.

L2NE-dev avatar Sep 12 '23 18:09 L2NE-dev

Could you provide more detail on what interop issues would be solved by having only the v128 data type exposed to JS? The reason v128 types are available in Wasm, is that we expect computations on v128 values to also happen only in Wasm.

dtig avatar Sep 12 '23 22:09 dtig

When needs transfer v128 SIMD value between wasm modules, they can't share memory between of them. I mean, when getting pointer value, doesn't means memory itself. So needs specific data-type for transfering SIMD value between modules.

L2NE-dev avatar Sep 13 '23 11:09 L2NE-dev

Even if the modules do not share a memory, JS should be able to read the vector data out of one module's memory and write it to the other module's memory. Doing a memory copy like this should be more efficient in the common case than passing v128 values one at a time from one module, out to JS, and back into another module.

tlively avatar Oct 06 '23 23:10 tlively