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

Start testing runtime execution of wasm32 simd intrinsics #715

Closed
wants to merge 3 commits into from
Closed
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
27 changes: 19 additions & 8 deletions ci/docker/wasm32-unknown-unknown/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
FROM ubuntu:18.04 as node

RUN apt-get update -y && apt-get install -y \
g++ \
git \
make \
python


# Install `node`
RUN git clone https://github.com/nodejs/node --depth 1
WORKDIR node
RUN ./configure --prefix=/node-install
RUN make -j$(nproc) install

FROM ubuntu:18.04

RUN apt-get update -y && apt-get install -y --no-install-recommends \
Expand All @@ -16,12 +31,8 @@ RUN git clone --recursive https://github.com/WebAssembly/wabt
RUN make -C wabt -j$(nproc)
ENV PATH=$PATH:/wabt/bin

# Install `wasm-bindgen-test-runner`
RUN curl -L https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.19/wasm-bindgen-0.2.19-x86_64-unknown-linux-musl.tar.gz \
| tar xzf -
ENV PATH=$PATH:/wasm-bindgen-0.2.19-x86_64-unknown-linux-musl
ENV CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner
COPY --from=node /node-install /
ENV PATH=$PATH:/node-install/bin

# Install `node`
RUN curl https://nodejs.org/dist/v10.8.0/node-v10.8.0-linux-x64.tar.xz | tar xJf -
ENV PATH=$PATH:/node-v10.8.0-linux-x64/bin
COPY docker/wasm32-unknown-unknown/wasm-entrypoint.sh /wasm-entrypoint.sh
ENTRYPOINT ["/wasm-entrypoint.sh"]
15 changes: 15 additions & 0 deletions ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

# Download an appropriate version of wasm-bindgen based off of what's being used
# in the lock file. Ideally we'd use `wasm-pack` at some point for this!
version=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version)
version=$(echo $version | awk '{print $3}' | sed 's/"//g')
curl -L https://github.com/rustwasm/wasm-bindgen/releases/download/$version/wasm-bindgen-$version-x86_64-unknown-linux-musl.tar.gz \
| tar xzf - -C target
export PATH=$PATH:`pwd`/target/wasm-bindgen-$version-x86_64-unknown-linux-musl
export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner
export NODE_ARGS=--experimental-wasm-simd

exec "$@"
14 changes: 10 additions & 4 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ STD_DETECT="--manifest-path=crates/std_detect/Cargo.toml"
STDSIMD_EXAMPLES="--manifest-path=examples/Cargo.toml"
cargo_test "${CORE_ARCH}"
cargo_test "${CORE_ARCH} --release"

if [ "$NOSTD" != "1" ]; then
cargo_test "${STD_DETECT}"
cargo_test "${STD_DETECT} --release"
Expand All @@ -72,10 +73,15 @@ case ${TARGET} in
cargo_test "--release"
;;
wasm32-unknown-unknown*)
# There's no node or other runtime which supports the most recent SIMD
# proposal, but hopefully that's coming soon! For now just test that we
# can codegen with no LLVM faults, and we'll remove `--no-run` at a
# later date.
# Attempt to actually run some SIMD tests in node.js. Unfortunately
# though node.js (transitively through v8) doesn't have support for the
# full SIMD spec yet, only some functions. As a result only pass in
# some target features and a special `--cfg`
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128 --cfg only_node_compatible_functions"
cargo_test "--release"

# After that passes make sure that all intrinsics compile, passing in
# the extra feature to compile in non-node-compatible SIMD.
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
cargo_test "--release --no-run"
;;
Expand Down
4 changes: 2 additions & 2 deletions crates/core_arch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ stdsimd-test = { version = "0.*", path = "../stdsimd-test" }
std_detect = { version = "0.*", path = "../std_detect" }

[target.wasm32-unknown-unknown.dev-dependencies]
wasm-bindgen-test = "=0.2.19"
wasm-bindgen-test = "0.2.39"

[package.metadata.docs.rs]
rustdoc-args = [ "--cfg", "dox" ]
rustdoc-args = [ "--cfg", "dox" ]
Binary file removed crates/core_arch/foo.wasm
Binary file not shown.
Loading