Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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 @@ -220,7 +220,7 @@ jobs:
if: matrix.build_std != ''
# Configure some env vars based on matrix configuration
- run: echo "PROFILE=--profile=${{matrix.profile}}" >> $GITHUB_ENV
- run: echo "PROFILE=${{matrix.profile}}" >> $GITHUB_ENV
shell: bash
- run: echo "NORUN=1" >> $GITHUB_ENV
shell: bash
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
if: ${{ matrix.build_std }}
# Configure some env vars based on matrix configuration
- run: echo "PROFILE=--profile=${{ matrix.profile }}" >> $GITHUB_ENV
- run: echo "PROFILE=${{ matrix.profile }}" >> $GITHUB_ENV
- run: ./ci/intrinsic-test-docker.sh ${{ matrix.target }}
if: ${{ !startsWith(matrix.target, 'thumb') }}
env:
Expand Down
2 changes: 0 additions & 2 deletions ci/docker/wasm32-wasip1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ ENV VERSION=v38.0.3

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

ENV CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime -Wexceptions --dir /checkout/target/wasm32-wasip1/release/deps::."
1 change: 1 addition & 0 deletions ci/intrinsic-test-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ run() {
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--env TARGET="${1}" \
--env PROFILE \
--env "${HOST_LINKER}"="cc" \
--env STDARCH_DISABLE_ASSERT_INSTR \
--env NOSTD \
Expand Down
21 changes: 12 additions & 9 deletions ci/intrinsic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -ex

export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
export HOST_RUSTFLAGS="${RUSTFLAGS}"
export PROFILE="${PROFILE:="--profile=release"}"
export PROFILE="${PROFILE:="release"}"

case ${TARGET} in
# On 32-bit use a static relocation model which avoids some extra
Expand Down Expand Up @@ -85,27 +85,29 @@ esac
# Arm specific
case "${TARGET}" in
aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*)
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=info \
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
--runner "${TEST_RUNNER}" \
--cppcompiler "${TEST_CXX_COMPILER}" \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}" \
--profile "${PROFILE}" \
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
;;

aarch64_be-unknown-linux-gnu*)
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=info \
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
--runner "${TEST_RUNNER}" \
--cppcompiler "${TEST_CXX_COMPILER}" \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}" \
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}" \
--profile "${PROFILE}" \
--linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}"
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}" \
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
;;

x86_64-unknown-linux-gnu*)
Expand All @@ -114,13 +116,14 @@ case "${TARGET}" in
# Hence the use of `env -u`.
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" \
RUST_LOG=info RUST_BACKTRACE=1 \
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
RUST_LOG=warn RUST_BACKTRACE=1 \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
--runner "${TEST_RUNNER}" \
--skip "${TEST_SKIP_INTRINSICS}" \
--cppcompiler "${TEST_CXX_COMPILER}" \
--target "${TARGET}" \
--profile "${PROFILE}" \
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
;;
*)
Expand Down
1 change: 1 addition & 0 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ run() {
--env NORUN \
--env RUSTFLAGS \
--env CARGO_UNSTABLE_BUILD_STD \
--env PROFILE \
--volume "${HOME}/.cargo":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
Expand Down
36 changes: 21 additions & 15 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -ex

export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
export HOST_RUSTFLAGS="${RUSTFLAGS}"
export PROFILE="${PROFILE:="--profile=release"}"
export PROFILE="${PROFILE:="release"}"

case ${TARGET} in
# On Windows the linker performs identical COMDAT folding (ICF) by default
Expand Down Expand Up @@ -63,14 +63,20 @@ cargo_test() {
if [ "$NORUN" = "1" ]; then
export subcmd="build"
fi
cmd="$cmd ${subcmd} --target=$TARGET $1"
cmd="$cmd ${subcmd} --target=$TARGET --profile=$PROFILE $1"
cmd="$cmd -- $2"

case ${TARGET} in
# 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.
wasm32*)
if [ "$PROFILE" = "release" ]; then
dir="release"
else
dir="debug"
fi
export CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime -Wexceptions --dir /checkout/target/wasm32-wasip1/$dir/deps::."
cmd="$cmd --nocapture"
;;
esac
Expand All @@ -80,10 +86,10 @@ cargo_test() {
CORE_ARCH="--manifest-path=crates/core_arch/Cargo.toml"
STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml"

cargo_test "${CORE_ARCH} ${PROFILE}"
cargo_test "${CORE_ARCH}"

if [ "$NOSTD" != "1" ]; then
cargo_test "${STDARCH_EXAMPLES} ${PROFILE}"
cargo_test "${STDARCH_EXAMPLES}"
fi


Expand All @@ -93,41 +99,41 @@ case ${TARGET} in
export STDARCH_DISABLE_ASSERT_INSTR=1

export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
cargo_test "${PROFILE}"
cargo_test

export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx512f"
cargo_test "${PROFILE}"
cargo_test
;;
x86_64* | i686*)
export STDARCH_DISABLE_ASSERT_INSTR=1

export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
cargo_test "${PROFILE}"
cargo_test
;;
# FIXME: don't build anymore
#mips-*gnu* | mipsel-*gnu*)
# export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa,+fp64,+mips32r5"
# cargo_test "${PROFILE}"
# cargo_test
# ;;
mips64*)
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+msa"
cargo_test "${PROFILE}"
cargo_test
;;
s390x*)
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+vector-enhancements-1"
cargo_test "${PROFILE}"
cargo_test
;;
powerpc64*)
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+altivec"
cargo_test "${PROFILE}"
cargo_test

export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+vsx"
cargo_test "${PROFILE}"
cargo_test
;;
powerpc*)
# qemu has a bug in PPC32 which leads to a crash when compiled with `vsx`
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+altivec"
cargo_test "${PROFILE}"
cargo_test
;;
*)
;;
Expand All @@ -138,7 +144,7 @@ if [ "$NORUN" != "1" ] && [ "$NOSTD" != 1 ]; then
# Test examples
(
cd examples
cargo test --target "$TARGET" "${PROFILE}"
echo test | cargo run --target "$TARGET" "${PROFILE}" hex
cargo test --target "${TARGET}" --profile "${PROFILE}"
echo test | cargo run --target "${TARGET}" --profile "${PROFILE}" hex
)
fi
7 changes: 7 additions & 0 deletions crates/intrinsic-test/src/common/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub struct Cli {
#[arg(long, default_value_t = String::from("armv7-unknown-linux-gnueabihf"))]
pub target: String,

/// Pass a profile (release, dev)
#[arg(long, default_value_t = String::from("release"))]
pub profile: String,

/// Set the linker
#[arg(long)]
pub linker: Option<String>,
Expand All @@ -59,6 +63,7 @@ pub struct ProcessedCli {
pub cpp_compiler: Option<String>,
pub runner: String,
pub target: String,
pub profile: String,
pub linker: Option<String>,
pub cxx_toolchain_dir: Option<String>,
pub skip: Vec<String>,
Expand All @@ -70,6 +75,7 @@ impl ProcessedCli {
let filename = cli_options.input;
let runner = cli_options.runner.unwrap_or_default();
let target = cli_options.target;
let profile = cli_options.profile;
let linker = cli_options.linker;
let cxx_toolchain_dir = cli_options.cxx_toolchain_dir;
let sample_percentage = cli_options.sample_percentage;
Expand Down Expand Up @@ -103,6 +109,7 @@ impl ProcessedCli {
cpp_compiler,
runner,
target,
profile,
linker,
cxx_toolchain_dir,
skip,
Expand Down
16 changes: 14 additions & 2 deletions crates/intrinsic-test/src/common/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ fn runner_command(runner: &str) -> Command {
cmd
}

pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target: &str) -> bool {
pub fn compare_outputs(
intrinsic_name_list: &Vec<String>,
runner: &str,
target: &str,
profile: &str,
) -> bool {
let profile_dir = match profile {
"dev" => "debug",
_ => "release",
};

let (c, rust) = rayon::join(
|| {
runner_command(runner)
Expand All @@ -21,7 +31,9 @@ pub fn compare_outputs(intrinsic_name_list: &Vec<String>, runner: &str, target:
},
|| {
runner_command(runner)
.arg(format!("./target/{target}/release/intrinsic-test-programs"))
.arg(format!(
"./target/{target}/{profile_dir}/intrinsic-test-programs"
))
.current_dir("rust_programs")
.output()
},
Expand Down
9 changes: 7 additions & 2 deletions crates/intrinsic-test/src/common/gen_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ pub fn write_lib_rs<T: IntrinsicTypeDefinition>(
Ok(())
}

pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Option<&str>) -> bool {
pub fn compile_rust_programs(
toolchain: Option<&str>,
target: &str,
profile: &str,
linker: Option<&str>,
) -> bool {
/* If there has been a linker explicitly set from the command line then
* we want to set it via setting it in the RUSTFLAGS*/

Expand All @@ -161,7 +166,7 @@ pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Opti
if toolchain.is_some_and(|val| !val.is_empty()) {
cargo_command.arg(toolchain.unwrap());
}
cargo_command.args(["build", "--target", target, "--release"]);
cargo_command.args(["build", "--target", target, "--profile", profile]);

let mut rust_flags = "-Cdebuginfo=0".to_string();
if let Some(linker) = linker {
Expand Down
4 changes: 3 additions & 1 deletion crates/intrinsic-test/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub trait SupportedArchitectureTest {
.unwrap();

let target = &self.cli_options().target;
let profile = &self.cli_options().profile;
let toolchain = self.cli_options().toolchain.as_deref();
let linker = self.cli_options().linker.as_deref();

Expand Down Expand Up @@ -178,7 +179,7 @@ pub trait SupportedArchitectureTest {
.collect::<Result<(), std::io::Error>>()
.unwrap();

compile_rust_programs(toolchain, target, linker)
compile_rust_programs(toolchain, target, profile, linker)
}

fn compare_outputs(&self) -> bool {
Expand All @@ -193,6 +194,7 @@ pub trait SupportedArchitectureTest {
&intrinsics_name_list,
&self.cli_options().runner,
&self.cli_options().target,
&self.cli_options().profile,
)
} else {
true
Expand Down