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

chore: Upgrade RTS Dependencies #4677

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

luc-blaeser
Copy link
Contributor

Upgrading Motoko RTS dependencies:

  • LLVM 18.1.8
  • Rust 1.82.0

Special aspects:

  • Support for both wasm32 and wasm64.
  • Support new dylink.0 instead of dylink.
  • Support GOT.mem for RTS in the Motoko linker.
  • LLVM LLD (used for wasm-ld) needs a bug fix: [lld][WebAssembly] Fix relocation of Wasm table index with GOT access llvm/llvm-project#104043. Therefore, patching wasm-ld.
  • Float formatting is now based on Rust and no longer on musl. There are format changes to output of NaN and infinity. Moreover, one particular output format (hexadecimal float) is no longer supported. Updating the documentation and base library is needed.
  • musl is still used in 32-bit but not in 64-bit. In the future, we should get rid of musl entirely. The musl import is rather old, upgrading is complicated as it involves a lot of unwanted dependencies.
  • No longer using emscripten for 64-bit Wasm compilation (as there is a nix build issue with latest emscripten). Instead, the clang compiler is directly invoked.
  • Adjusting the RTS code in line with the latest Rust features/rules.
  • The new Rust core library bloats the RTS binary size (especially due to print formatter logic). Therefore, wasm-opt is applied to again reduce it to an acceptable size.

Note:

  • If your nix-shell crashes with a segmentation fault with this PR, you need to upgrade nix. For this, you need to manually uninstall and re-install nix.

@luc-blaeser luc-blaeser self-assigned this Aug 29, 2024
@luc-blaeser luc-blaeser added the dependencies Pull requests that update a dependency file label Aug 29, 2024
Copy link

github-actions bot commented Aug 29, 2024

Comparing from 247aa05 to a6d1305:
In terms of gas, 4 tests regressed, 1 tests improved and the mean change is -0.0%.
In terms of size, 5 tests regressed and the mean change is +29.3%.

-mllvm -enable-emscripten-sjlj -mllvm -disable-lsr \
-Wno-override-module
RTS_LL_64_DEBUG=$(RTS_LL_64)
RTS_LL_64_RELEASE=$(RTS_LL_64) -Oz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be that the change from 02 to 0z is causing the rts size increase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the increase would be even higher with O2. I'll double check and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants