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

[CI] Install libc6-dev-i386 to compile wasm32 #6886

Merged
merged 2 commits into from
Nov 17, 2020
Merged

Conversation

kazum
Copy link
Contributor

@kazum kazum commented Nov 9, 2020

The wasm32 test doesn't work with the current wasmtime (after the commit bytecodealliance/wasmtime#1565). It seems that we cannot generate a wasm binary which is compatible with the new WASI ABI.

This PR pins the wasmtime version to v0.16.0, the latest stable version which can work with our wasm32 test, and makes #6871 pass the CI. This also installs libc6-dev-i386 needed for wasm32 compilation.

@jroesch @tqchen @nhynes

@tqchen
Copy link
Member

tqchen commented Nov 9, 2020

@kazum it would be great if we can still generate wasm32 that is compatible with the new WASI ABI. Is it possible to look a bit into it?

@kazum
Copy link
Contributor Author

kazum commented Nov 12, 2020

@tqchen There are two kinds of WASI binaries, command and reactor, and what we generate in the test is a command.  A WASI command may not export global variables, but we export two variables, __tvm_module_ctx and __tvm_main__.

If I changed the llvm linkage type of this line and this line to InternalLinkage, I could produce a compatible wasm32 which is runnable with the latest wasmtime, but I think the change is not acceptable for other targets.

Another fix I came up with was localizing those variables with llvm-objcopy after we generate the wasm library.  But the current llvm-objcopy has only initial support for wasm, so we cannot do it yet.

I think it's a reasonable workaround to pin the wasmtime version until llvm-objcopy supports hiding global variables for wasm32. What do you think of it?

@tqchen
Copy link
Member

tqchen commented Nov 12, 2020

Thanks @kazum what you said makes sense. We could actually change the LLVM codegen. Under the systemlib mode, it is not necessary to export these two global variables and since they are registered via a startup function. While it is not good to keep them as InternalLinkage (we might still need to make them weak).

But we can skip the set dll export part of the codegen

@kazum
Copy link
Contributor Author

kazum commented Nov 12, 2020

@tqchen Thanks, it makes sense to me :) I'll send the change in #6871 later.

Installing libc6-dev-i386 is necessary to compile wasm32 anyway. Could you merge the change if it's okay?

@kazum kazum changed the title [CI] Pin wasmtime version to 0.16.0 [CI] Install libc6-dev-i386 to compile wasm32 Nov 12, 2020
@tqchen tqchen merged commit b236f10 into apache:main Nov 17, 2020
@jroesch
Copy link
Member

jroesch commented Nov 17, 2020

Looks good to me, was on vacation for a few days, thanks for the fix!

@tqchen
Copy link
Member

tqchen commented Nov 17, 2020

@jroesch still need to update the images to reflect the change

@jroesch
Copy link
Member

jroesch commented Nov 18, 2020

@tqchen these tests are only ran on CPU so I should only have to update that image right?

@tqchen
Copy link
Member

tqchen commented Nov 18, 2020

Right

@kazum kazum deleted the ci-rust-wasm32 branch November 20, 2020 01:08
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
* [CI] Pin wasmtime version to 0.16.0

* Keep the wasmtime version to the latest
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
* [CI] Pin wasmtime version to 0.16.0

* Keep the wasmtime version to the latest
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
* [CI] Pin wasmtime version to 0.16.0

* Keep the wasmtime version to the latest
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

Successfully merging this pull request may close these issues.

3 participants