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

WebAssembly/WASI support #491

Open
emmatyping opened this issue Apr 11, 2021 · 1 comment
Open

WebAssembly/WASI support #491

emmatyping opened this issue Apr 11, 2021 · 1 comment

Comments

@emmatyping
Copy link

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.

@emmatyping
Copy link
Author

Ah ok the error seems to be my own fault, I initially tried to add a new architecture for WASM but I seem to have done so incorrectly (possibly something about the context initialization?). Anyway, I will leave this open for WASM kernels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants