Skip to content

Is V128 restricted to wasm or Global? #1474

@codefromthecrypt

Description

@codefromthecrypt

In the current specification, javascript is restricted from any external function definitions that include a v128 value type

Calling an Exported Function will throw a TypeError, when parameters or results contains a v128.

https://github.com/WebAssembly/spec/blob/f5a260a2025ba4d7d398654581c7c532e3a2c319/proposals/simd/SIMD.md#module-function-imports

Moreover, the host test only includes V128 as a global type (not a func type)

VecType V128Type -> Vec (V128 (V128.I32x4.of_lanes [666l; 666l; 666l; 666l]))

https://github.com/WebAssembly/spec/blob/f5a260a2025ba4d7d398654581c7c532e3a2c319/interpreter/host/spectest.ml

It seems like there's an implicit rule that host functions shouldn't use the V128 type, which can make sense as vectorizing via the host feels like it would never be performant. OTOH, there is exposing a global of V128 which is strange without rationale.

Can you please clarify the following?

  1. Are languages besides javascript supposed to support V128 param or results and why?
  2. What is the use case for a V128 global?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions