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

Improved Apple Silicon & LLVM 11 support #2008

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- build: windows-x64
os: windows-latest
rust: 1.48
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/windows-amd64.tar.gz'
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/windows-amd64.tar.gz'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using how own build instead of installing LLVM from choco?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don’t have an LLVM build for Apple Silicon

Copy link
Contributor

Choose a reason for hiding this comment

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

This appears to be in the windows-x64 section, not the macos-arm64 one

artifact_name: 'wasmer-windows-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_win'
run_integration_tests: true
Expand Down Expand Up @@ -92,12 +92,16 @@ jobs:
target: ${{ matrix.target }}
override: true
- name: Install LLVM (Windows)
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-latest' && !matrix.llvm_url
shell: cmd
run: |
choco install llvm
- name: Install LLVM (macOS Apple Silicon)
if: matrix.os == 'macos-11.0' && !matrix.llvm_url
run: |
brew install llvm
- name: Install LLVM
if: matrix.os != 'windows-latest' && matrix.os != 'macos-11.0'
if: matrix.llvm_url
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.gz
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ ifneq (, $(shell which llvm-config 2>/dev/null))
ifneq (, $(findstring 10,$(LLVM_VERSION)))
compilers += llvm
endif
ifneq (, $(findstring 11,$(LLVM_VERSION)))
compilers += llvm
endif
else
ifneq (, $(shell which llvm-config-10 2>/dev/null))
compilers += llvm
endif
ifneq (, $(shell which llvm-config-11 2>/dev/null))
compilers += llvm
endif
endif

ifeq ($(ARCH), x86_64)
Expand Down Expand Up @@ -297,6 +303,9 @@ else
if [ -d "wapm-cli" ]; then \
cp wapm-cli/target/release/wapm package/bin/ ;\
fi
ifeq ($(UNAME_S), Darwin)
codesign -s - package/bin/wapm
endif
endif

package-wasmer:
Expand All @@ -305,6 +314,9 @@ ifeq ($(OS), Windows_NT)
cp target/release/wasmer.exe package/bin/
else
cp target/release/wasmer package/bin/
ifeq ($(UNAME_S), Darwin)
codesign -s - package/bin/wasmer
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

endif
endif

package-capi:
Expand Down
7 changes: 4 additions & 3 deletions tests/compilers/native_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,13 @@ fn non_native_functions_and_closures_with_no_env_work() -> Result<()> {
}

// The native ABI for functions fails when defining a function natively in
// macos (Darwin) with the Apple Silicon ARM chip
// TODO: Cranelift should have a good ABI for the ABI
// macos (Darwin) with the Apple Silicon ARM chip and Cranelift.
// We should enable it for LLVM in Apple Silicon, but now is not trivial.
// TODO: Fix once Cranelift has a correct ABI for Apple Silicon.
#[test]
#[cfg_attr(
all(
feature = "test-cranelift",
// feature = "test-cranelift",
target_os = "macos",
target_arch = "aarch64",
),
Expand Down
2 changes: 1 addition & 1 deletion tests/compilers/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn get_engine(canonicalize_nans: bool) -> impl Engine {
}
#[cfg(feature = "test-native")]
pub fn get_engine(canonicalize_nans: bool) -> impl Engine {
let mut compiler_config = get_compiler(canonicalize_nans);
let compiler_config = get_compiler(canonicalize_nans);
Native::new(compiler_config).engine()
}

Expand Down
2 changes: 1 addition & 1 deletion tests/compilers/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn get_store(features: Features, try_nan_canonicalization: bool) -> Store {

#[cfg(feature = "test-native")]
fn get_store(features: Features, try_nan_canonicalization: bool) -> Store {
let mut compiler_config = get_compiler(try_nan_canonicalization);
let compiler_config = get_compiler(try_nan_canonicalization);
Store::new(&Native::new(compiler_config).features(features).engine())
}

Expand Down