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

WASM: Runtime Library #555

Closed
4 tasks done
certik opened this issue Aug 15, 2022 · 6 comments
Closed
4 tasks done

WASM: Runtime Library #555

certik opened this issue Aug 15, 2022 · 6 comments

Comments

@certik
Copy link
Contributor

certik commented Aug 15, 2022

Original issue: https://gitlab.com/lfortran/lfortran/-/issues/720

Continued from https://gitlab.com/lfortran/lfortran/-/issues/706

Related to https://gitlab.com/lfortran/lfortran/-/issues/700

For the LFortran WebAssembly Backend, we need to get the runtime library working, so that one can use functions like sin/cos, etc.

The runtime library has two parts:

  1. pure part (we have to package the .mod files together with the emscripten compiled LFortran. (WASM: Support runtime library #643, Support runtime library lcompilers_frontend#37)
  2. impure part (Implemented in C)
This was referenced Aug 15, 2022
@Shaikh-Ubaid
Copy link
Member

Shaikh-Ubaid commented Aug 22, 2022

I tried the following test cases at the current live site https://dev.lfortran.org/

  • integration_tests/abs_01.f90
  • integration_tests/abs_02.f90
  • integration_tests/abs_03.f90
  • integration_tests/intrinsics_21.f90 // for modulo() and mod()
  • integration_tests/intrinsics_23.f90 // for huge()
  • integration_tests/floor_01.f90
  • integration_tests/floor_02.f90
  • integration_tests/floor_03.f90

They all seem to work. Thus, it seems the runtime library works at https://dev.lfortran.org/

Please, could someone possibly share if this issue is safe to close?

@certik
Copy link
Contributor Author

certik commented Aug 22, 2022

Nice, great job!

Try this: use the default example and change dp=8 to dp=kind(0.d0). I get:

Screen Shot 2022-08-22 at 11 16 25 PM

Kind of good, but not quite. :)

@Shaikh-Ubaid
Copy link
Member

Shaikh-Ubaid commented Aug 23, 2022

Thank you for sharing the bug, Ondrej Sir. We merged a PR #657 which should (hopefully) fix the issue. I also submitted a PR at lfortran/lcompilers_frontend#40 to update the lfortran version/commit to be used at https://dev.lfortran.org/

@Shaikh-Ubaid
Copy link
Member

Try this: use the default example and change dp=8 to dp=kind(0.d0). I get:

With the fixes in #657 and lfortran/lcompilers_frontend#40, the latest lfortran at https://dev.lfortran.org/ seems to now support it.
image

@Shaikh-Ubaid
Copy link
Member

integration_tests/abs_01.f90
integration_tests/abs_02.f90
integration_tests/abs_03.f90
integration_tests/intrinsics_21.f90 // for modulo() and mod()
integration_tests/intrinsics_23.f90 // for huge()
integration_tests/floor_01.f90
integration_tests/floor_02.f90
integration_tests/floor_03.f90

I tested these examples again at https://dev.lfortran.org/. They all seem to work. Thus, it seems the runtime library works at https://dev.lfortran.org/

Please, could someone possibly share if this issue is safe to close?

@certik
Copy link
Contributor Author

certik commented Aug 23, 2022

I tested this by hand as well and I think everything is indeed fixed! Amazing.

The parts of the runtime library that do not work are all calls into C, however I am guessing just providing the appropriate JavaScript implementations might fix it. We will eventually use pure Fortran implementations of trigonometric functions like sin(x). But for now we can either implement them in JavaScript, or figure out how to compile the C part of the runtime library using Clang and somehow link it.

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

No branches or pull requests

2 participants