wasmerio / wasmer-go

🐹🕸️ WebAssembly runtime for Go

Home Page:https://pkg.go.dev/github.com/wasmerio/wasmer-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does wasmer-go support simd instruction?

orangeC23 opened this issue · comments

I use wasmer-go to run wasm program contains simd instruction, but failed.

go program:

`package main

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

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

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

// Compiles the module
fmt.Println("Compiling module...")
module, err := wasmer.NewModule(store, wasmBytes)
if err != nil {
		fmt.Println("Failed to compile module:", err)
	}

// Instantiates the module
importObject := wasmer.NewImportObject()
fmt.Println("Instantiating module...")
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("func1")
if err != nil {
		panic(fmt.Sprintln("Failed to get the `func1` function:", err))
	}

fmt.Println("Calling `func1` function...")
res, err := func1()

if err != nil {
		panic(fmt.Sprintln("Error caught from `func1`:", err))
	}

fmt.Println("Executing func1 res ...")
fmt.Println(res)

}

func main(){
fmt.Println("========== Start test ==========")
test()
fmt.Println("========== Finish test ==========")
}`

The output is :

compiling error