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

Test stdarch (only x86 SSE and SSE2 for now) #19

Merged
merged 1 commit into from
Sep 29, 2023
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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ jobs:
- name: Test
run: bash ./ci-test.sh simd

test-stdarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh stdarch

# Send a Zulip notification when a cron job fails
cron-fail-notify:
name: cronjob failure notification
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ members = [
exclude = [
# stdarch has its own Cargo workspace
"library/stdarch",
"rust-src-patched/library/stdarch",
]
9 changes: 9 additions & 0 deletions ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ simd)
2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
stdarch)
for TARGET in x86_64-unknown-linux-gnu i686-unknown-linux-gnu; do
echo "::group::Testing stdarch ($TARGET)"
MIRIFLAGS="$DEFAULTFLAGS" \
./run-stdarch-test.sh $TARGET \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
;;
*)
echo "Unknown command"
exit 1
Expand Down
67 changes: 67 additions & 0 deletions run-stdarch-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
set -euo pipefail

## Run stdarch test suite with Miri.
## Assumes Miri to be installed.
## Usage:
## ./run-test.sh TARGET
## Environment variables:
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
## RUSTFLAGS: rustc flags (optional)
## MIRIFLAGS: Miri flags (optional)

if [ $# -ne 1 ]; then
echo "Usage: $0 TARGET"
exit 1
fi

export TARGET="$1"

case "$TARGET" in
i586-*|i686-*|x86_64-*)
RUSTFLAGS="-C target-feature=+sse2"
TEST_ARGS=(
core_arch::x86::{sse,sse2}::
core_arch::x86_64::{sse,sse2}::
# FIXME add `#[cfg_attr(miri, ignore)]` to those tests in stdarch
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# FIXME add `#[cfg_attr(miri, ignore)]` to those tests in stdarch
# FIXME add `#[cfg_attr(miri, ignore)]` to those tests in stdarch
# These are nontemporal stores, fences, and CSR (FP env status register) accesses

# These are nontemporal stores, fences, and CSR (FP env status register) accesses
--skip test_mm_comieq_ss_vs_ucomieq_ss
--skip test_mm_getcsr_setcsr_1
--skip test_mm_getcsr_setcsr_2
--skip test_mm_getcsr_setcsr_underflow
--skip test_mm_sfence
--skip test_mm_stream_ps
--skip test_mm_clflush
--skip test_mm_lfence
--skip test_mm_maskmoveu_si128
--skip test_mm_mfence
--skip test_mm_stream_pd
--skip test_mm_stream_si128
--skip test_mm_stream_si32
--skip test_mm_stream_si64
# FIXME not yet implemented
--skip test_mm_madd_epi16
# FIXME fix those in stdarch
--skip test_mm_rcp_ss # __m128(0.24997461, 13.0, 16.0, 100.0) != __m128(0.24993896, 13.0, 16.0, 100.0)
--skip test_mm_store1_ps # attempt to subtract with overflow
--skip test_mm_store_ps # attempt to subtract with overflow
--skip test_mm_storer_ps # attempt to subtract with overflow
)
;;
*)
echo "Unknown target $TARGET"
exit 1
esac

export RUSTFLAGS="${RUSTFLAGS:-} -Ainternal_features"

# Make sure all tested target features are enabled
export STDARCH_TEST_EVERYTHING=1
# Needed to pass the STDARCH_TEST_EVERYTHING environment variable
export MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-disable-isolation"

cd $MIRI_LIB_SRC/stdarch
cargo miri test \
--target "$TARGET" \
--manifest-path=crates/core_arch/Cargo.toml \
-- "${TEST_ARGS[@]}"
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-08-16
nightly-2023-09-28