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

Request: Wasi support #7

Open
rjzak opened this issue Apr 10, 2022 · 3 comments
Open

Request: Wasi support #7

rjzak opened this issue Apr 10, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@rjzak
Copy link

rjzak commented Apr 10, 2022

In your blog post, you discuss the use of WebAssembly and Javascript for use in the browser. How about support for Wasi and a runtime environment like Wasmtime? It might even just work out of the box, I haven't yet tried your Docker image.

@StarGate01
Copy link
Owner

StarGate01 commented Apr 10, 2022

Hi, thanks for bringing this up, interesting idea.

At the moment, the toolchain uses the gfortran runtime provided by GCC, which relies on libc. Emscripten then provides the needed libc/musl binding to the existing Browser system interfaces.

Implementing support for a completely new system backend would require either replacing libc with something call-compatible that uses Wasi in the background, or moving to a different compiler infrastructure. I am still hoping for LLVM/flang to be released, moving to a 100% LLVM toolchain would eliminate many quirks and problems of the current toolchain. However, the flang compiler is not finished yet. In addition, I am unsure how easy it would be to use Wasi as a system backend in LLVM.

If you have any ideas, let me know.

Edit: I had a quick look at Wasi, and it appears that it provides a sizeable set of libc-like APIs. It might be feasible to compile libgfortran using this.

@rjzak
Copy link
Author

rjzak commented Apr 10, 2022

I think Emscripten can work with Wasi. There are a few examples and there's also the wasi-sdk, which supports C/C++.

I've also been communicating with someone who's been trying to get WebAssembly support added to LFortran here. There was an additional PR 6 months ago, but it wasn't approved.

@StarGate01
Copy link
Owner

StarGate01 commented Apr 10, 2022

LFortran is a really cool project, but not yet complete enough to run most/all of the scientific codes I usually work with. See https://docs.lfortran.org/progress/ . I had a look at it in 2020 when I started this project, and it seems like a lot has been implemented since. But there are still more functions needed for full support.

I am intrigued by the Wasi framework. I'll take a more thorough look at it in the next days. This might help me with a semi-related project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants