Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to support simd instructions in wasmer-go? #383

Open
orangeC23 opened this issue Apr 11, 2023 · 0 comments
Open

How to support simd instructions in wasmer-go? #383

orangeC23 opened this issue Apr 11, 2023 · 0 comments
Labels
❓ question Further information is requested

Comments

@orangeC23
Copy link

Summary

Using wasmer-go to execute the following wat file:

(module
  (type (;0;) (func (result v128)))
  (func (;0;) (type 0) (result v128)
    v128.const i32x4 0x733c3e67 0x3c3e6776 0x3e677673 0x6776733c
    i64x2.abs
    i64x2.bitmask
    i8x16.splat
    v128.const i32x4 0x733c3e67 0x3c3e6776 0x3e677673 0x6776733c
    i64x2.ge_s
    f32x4.floor
    v128.not
    i16x8.extadd_pairwise_i8x16_u)
  (export "x" (func 0)))

The go file is :

package main

import (
	"fmt"
	"github.com/wasmerio/wasmer-go/wasmer"
	"io/ioutil"
)

func main() {
    wasmBytes, _ := ioutil.ReadFile("./tmp.wasm")

    engine := wasmer.NewEngine()
    store := wasmer.NewStore(engine)

    // Compiles the module
    module, err := wasmer.NewModule(store, wasmBytes)

    if err != nil {
        fmt.Println("Failed to compile module:", err)
    }

    // Instantiates the module
    importObject := wasmer.NewImportObject()
    instance, err := wasmer.NewInstance(module, importObject)

    if err != nil {
        panic(fmt.Sprintln("Failed to instantiate the module:", err))
    }

    // Gets the `sum` exported function from the WebAssembly instance.

    func1, err := instance.Exports.GetFunction("x")
    if err != nil {
	    panic(fmt.Sprintln("Failed to get the `x` function:", err))
    }

    result, err := func1()

    if err != nil {
        panic(fmt.Sprintln("Failed to call the `x` function:", err))
    }
    
    fmt.Println(result)
}

Additional details

wat2wasm tmp.wat
go run tmp.go

It prints:
Failed to compile module: WebAssembly translation error: Unsupported feature: proposed simd operator I16x8ExtAddPairwiseI8x16U
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x409560a]

@orangeC23 orangeC23 added the ❓ question Further information is requested label Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant