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

Update and revamp wasm32 SIMD intrinsics #874

Merged
merged 15 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- s390x-unknown-linux-gnu
- wasm32-unknown-unknown
- wasm32-wasi
- i586-unknown-linux-gnu
- x86_64-linux-android
- arm-linux-androideabi
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
disable_assert_instr: true
- target: s390x-unknown-linux-gnu
os: ubuntu-latest
- target: wasm32-unknown-unknown
- target: wasm32-wasi
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
Expand Down
25 changes: 0 additions & 25 deletions ci/docker/wasm32-unknown-unknown/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh

This file was deleted.

22 changes: 22 additions & 0 deletions ci/docker/wasm32-wasi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates \
clang \
cmake \
curl \
git \
libc6-dev \
make \
python \
python3 \
xz-utils

RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar xJf -
ENV PATH=$PATH:/wasmtime-dev-x86_64-linux

ENV CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime \
--enable-simd \
--mapdir .::/checkout/target/wasm32-wasi/release/deps \
--"
31 changes: 16 additions & 15 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ cargo_test() {
fi
cmd="$cmd ${subcmd} --target=$TARGET $1"
cmd="$cmd -- $2"

# wasm targets can't catch panics so if a test failures make sure the test
# harness isn't trying to capture output, otherwise we won't get any useful
# output.
case ${TARGET} in
wasm32*)
cmd="$cmd --nocapture"
;;
esac

$cmd
}

Expand Down Expand Up @@ -72,20 +82,11 @@ case ${TARGET} in
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
cargo_test "--release"
;;
wasm32-unknown-unknown*)
# 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`
# FIXME: broken
#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.
# FIXME: broken
#export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
#cargo_test "--release --no-run"
wasm32*)
prev="$RUSTFLAGS"
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
cargo_test "--release"
export RUSTFLAGS="$prev"
;;
# FIXME: don't build anymore
#mips-*gnu* | mipsel-*gnu*)
Expand All @@ -111,7 +112,7 @@ case ${TARGET} in

esac

if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ] && [ "$TARGET" != "wasm32-unknown-unknown" ]; then
if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ]; then
# Test examples
(
cd examples
Expand Down
8 changes: 1 addition & 7 deletions crates/assert-instr-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ pub fn assert_instr(
};

let tokens: TokenStream = quote! {
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), test)]
#[test]
#[allow(non_snake_case)]
fn #assert_name() {
#to_test
Expand All @@ -146,11 +145,6 @@ pub fn assert_instr(
#instr);
}
};
// why? necessary now to get tests to work?
let tokens: TokenStream = tokens
.to_string()
.parse()
.expect("cannot parse tokenstream");

let tokens: TokenStream = quote! {
#item
Expand Down
3 changes: 0 additions & 3 deletions crates/core_arch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ maintenance = { status = "experimental" }
stdarch-test = { version = "0.*", path = "../stdarch-test" }
std_detect = { version = "0.*", path = "../std_detect" }

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

[package.metadata.docs.rs]
rustdoc-args = [ "--cfg", "dox" ]
9 changes: 4 additions & 5 deletions crates/core_arch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
adx_target_feature,
rtm_target_feature,
f16c_target_feature,
external_doc
external_doc,
allow_internal_unstable,
decl_macro
)]
#![cfg_attr(test, feature(test, abi_vectorcall, untagged_unions))]
#![deny(clippy::missing_inline_in_public_items)]
Expand Down Expand Up @@ -66,13 +68,10 @@ extern crate std_detect;
#[cfg(test)]
extern crate stdarch_test;

#[cfg(all(test, target_arch = "wasm32"))]
extern crate wasm_bindgen_test;

#[path = "mod.rs"]
mod core_arch;

pub use self::core_arch::arch::*;
pub use self::core_arch::arch;

#[allow(unused_imports)]
use core::{ffi, hint, intrinsics, marker, mem, ops, ptr, sync};
2 changes: 2 additions & 0 deletions crates/core_arch/src/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! `core_arch`
#![allow(improper_ctypes_definitions)]

#[macro_use]
mod macros;

Expand Down
2 changes: 0 additions & 2 deletions crates/core_arch/src/wasm32/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#[cfg(test)]
use stdarch_test::assert_instr;
#[cfg(test)]
use wasm_bindgen_test::wasm_bindgen_test;

extern "C" {
#[link_name = "llvm.wasm.atomic.wait.i32"]
Expand Down
2 changes: 0 additions & 2 deletions crates/core_arch/src/wasm32/memory.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#[cfg(test)]
use stdarch_test::assert_instr;
#[cfg(test)]
use wasm_bindgen_test::wasm_bindgen_test;

extern "C" {
#[link_name = "llvm.wasm.memory.grow.i32"]
Expand Down
2 changes: 0 additions & 2 deletions crates/core_arch/src/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#[cfg(test)]
use stdarch_test::assert_instr;
#[cfg(test)]
use wasm_bindgen_test::wasm_bindgen_test;

#[cfg(any(target_feature = "atomics", dox))]
mod atomic;
Expand Down
Loading