Skip to content

WebAssembly/WASI support #491

@emmatyping

Description

@emmatyping

Hi,

I realized that BLIS is probably the best prepared to run in web assembly of all of the BLAS libraries I'm aware of because it uses C99 instead of Fortran (also supporting threadless builds is very important). I am interested in building targeting WASM with the WASI SDK, as that is a minimal posix-like environment that makes building for WASM easy, and doesn't use JS shims like Emscripten.

I've built blis with the generic kernel using the WASI SDK but when I run the example https://github.com/flame/blis/blob/master/examples/oapi/09level3.c with wasmer I get the following output:

libblis: frame/base/bli_gks.c (line 354):
libblis: Invalid architecture id value.
libblis: Aborting.
error: failed to run `./level3`
│   1: WASI execution failed
│   2: failed to run WASI `_start` function
│   3: RuntimeError: unreachable
           at abort (level3[1078]:0xffffffff)
           at bli_abort (level3[189]:0xffffffff)
           at bli_check_error_code_helper (level3[158]:0xffffffff)
           at bli_gks_init (level3[572]:0xffffffff)
           at bli_init_apis (level3[578]:0xffffffff)
           at bli_pthread_once (level3[1017]:0xffffffff)
           at bli_init_once (level3[579]:0xffffffff)
           at bli_obj_create (level3[594]:0xffffffff)
           at main (level3[11]:0xffffffff)
           at __main_void (level3[1081]:0xffffffff)
           at __original_main (level3[1079]:0xffffffff)
           at _start (level3[10]:0xffffffff)
╰─> 4: unreachable

It isn't clear to me why this is happening. Any pointers as to why this might be happening would be greatly appreciated.

Also, it would be great if there was support for WebAssembly SIMD kernels, though I realize that would be significantly more work to do, and I don't know what is involved with this process. I suppose I could probably try to translate the NEON or SSE kernels, but I've never really written these before.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions