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

Evaluate size savings of switching on certain Wasm target features #334

Open
Tracked by #9354
cmichi opened this issue Aug 25, 2021 · 1 comment
Open
Tracked by #9354

Evaluate size savings of switching on certain Wasm target features #334

cmichi opened this issue Aug 25, 2021 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@cmichi
Copy link
Collaborator

cmichi commented Aug 25, 2021

I've looked into how building contracts with the simd128 target feature affects contract sizes. The results can be found here. This is the cargo-contract branch I used for this: cmichi-build-contracts-with-simd-128.

The results look promising, though it would require implementing this feature in wasmi, as well as follow-up work in the contracts pallet to e.g. determine weights.

We should evaluate the other target features as well:

$ rustc --target=wasm32-unknown-unknown --print target-features
Features supported by rustc for this target:
    simd128             - Enable 128-bit SIMD.
    atomics             - Enable Atomics.
    nontrapping-fptoint - Enable non-trapping float-to-int conversion operators.
    crt-static          - Enables C Run-time Libraries to be statically linked.

Code-generation features supported by LLVM for this target:
    bulk-memory         - Enable bulk memory operations.
    exception-handling  - Enable Wasm exception handling.
    multivalue          - Enable multivalue blocks, instructions, and functions.
    mutable-globals     - Enable mutable globals.
    reference-types     - Enable reference types.
    sign-ext            - Enable sign extension operators.
    tail-call           - Enable tail call instructions.

My branch from above can basically just be adapted with switching on other target features.

I've also tried multivalue, but unfortunately it's currently broken in rustc due to rust-lang/rust#73755. In order to get an idea of the changes in contract size we should use an older rustc where multivalue still works and build the contracts with it.

@athei
Copy link
Contributor

athei commented Sep 17, 2021

In addition what you already stated: Most features are also broken in parity-wasm. I recently fixed multi-value support but especially simd128 needs some fixing. pallet-contracts depends on parity-wasm for instrumentation. It is not a big deal. But we need to keep in mind that fix crates need to be fixed first.

We should also don't allow any non finalized proposals for contracts because we need to stay backwards compatible. Here the list: https://github.com/WebAssembly/proposals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants