-
Notifications
You must be signed in to change notification settings - Fork 824
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
Support cross compile for LLVM backend #959
Comments
By exposing the target information through `CompilerConfig`, compiler(only LLVM at the moment) could create a machine with different CPU feature flags other than current host, which makes it capable to "cross compile" to some degree. Update wasmerio#959
Yes, cross-compilation is a great idea and we'd love to support it. Thank you for getting this started! Really there's two issues here, one is supporting cross-compilation, but the other is supporting precompilation and loading precompiled code, even on the same target. Depending on how you design it, cross-compilation probably isn't useful unless you can load precompiled code on the other machine with the other architecture? I said it's dependent on the design, for instance LLVM ORC JIT has a networked mode where you can request cross-compiled code over the network, in which case we wouldn't be precompiling, per se. Let's make sure we agree on an overall plan so that you don't spend time preparing PRs only to discover that we want a different design. As a first draft, how about this:
Other backends should be able to implement this same interface. Over time I'd like to minimize the difference in features between the different backends. |
964: Enable compilation for specific target r=syrusakbary a=xofyarg <!-- Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test: https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests --> # Description <!-- Provide details regarding the change including motivation, links to related issues, and the context of the PR. --> By exposing the target information through `CompilerConfig`, compiler(only LLVM at the moment) could create a machine with different CPU feature flags other than current host, which makes it capable to "cross compile" to some degree. Update #959 # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: anb <[email protected]>
Yes, that's my intention. Thanks for the breakdown. As you mentioned, I think using wasmer cache format and focus on x86-64 is a good scope, it can keep things simple to adopt and test. In our use case, we are having issue to use module cache compiled by a different host with different CPU feature flag. |
By exposing the target information through `CompilerConfig`, compiler(only LLVM at the moment) could create a machine with different CPU feature flags other than current host, which makes it capable to "cross compile" to some degree. Update wasmerio#959
By exposing the target information through `CompilerConfig`, compiler(only LLVM at the moment) could create a machine with different CPU feature flags other than current host, which makes it capable to "cross compile" to some degree. Update wasmerio#959
964: Enable compilation for specific target r=MarkMcCaskey a=xofyarg <!-- Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test: https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests --> # Description <!-- Provide details regarding the change including motivation, links to related issues, and the context of the PR. --> By exposing the target information through `CompilerConfig`, compiler(only LLVM at the moment) could create a machine with different CPU feature flags other than current host, which makes it capable to "cross compile" to some degree. Update #959 # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: anb <[email protected]>
This is done in the refactor. Will close the issue once it lands in |
Thanks to the refactor we now support cross compilation to different architectures.
And then, in the aarch64:
|
Motivation
When having multiple places running the same module, depends on the scale, it would save lots of CPU cycles if precompiled module is distributed instead of wasm code.
Proposed solution
Add an API to be able to override target triple/cpu/features when create target machine.
The text was updated successfully, but these errors were encountered: