Skip to content

Commit

Permalink
XOP Part 1: fma, hadd, and shifts-rotates
Browse files Browse the repository at this point in the history
Added testing support for xop. Intel SDE doesn't support XOP, so we need qemu for that.
  • Loading branch information
sayantn committed Jul 31, 2024
1 parent fb90dfa commit d170fce
Show file tree
Hide file tree
Showing 7 changed files with 1,117 additions and 8 deletions.
7 changes: 3 additions & 4 deletions ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
make \
ca-certificates \
wget \
xz-utils
xz-utils \
qemu-user

RUN wget https://downloadmirror.intel.com/813591/sde-external-9.33.0-2024-01-07-lin.tar.xz
RUN tar -xJf sde-external-9.33.0-2024-01-07-lin.tar.xz
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/sde-external-9.33.0-2024-01-07-lin/sde64 \
-cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def \
-rtm-mode full -tsx --"
ENV PATH="$PATH:/sde-external-9.33.0-2024-01-07-lin"
4 changes: 2 additions & 2 deletions ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
0000001e ******** => 00000000 00004010 00000000 00000000 #AMX Tmul
00000024 ******** => 00000000 00070001 00000000 00000000 #AVX10
80000000 ******** => 80000008 00000000 00000000 00000000
80000001 ******** => 00000000 00000000 00200961 2c100000
80000001 ******** => 00000000 00000000 00200161 2c100000
80000002 ******** => 00000000 00000000 00000000 00000000
80000003 ******** => 00000000 00000000 00000000 00000000
80000004 ******** => 00000000 00000000 00000000 00000000
Expand All @@ -57,5 +57,5 @@
80000008 ******** => 00003028 00000200 00000200 00000000

# This file was copied from intel-sde/misc/cpuid/future/cpuid.def, and modified to
# use "AuthenticAMD" as the vendor and the support for `XOP`, `SSE4a`, `TBM` and
# use "AuthenticAMD" as the vendor and the support for `SSE4a`, `TBM` and
# `AVX512_VP2INTERSECT` was added in the CPUID.
11 changes: 11 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ STD_DETECT="--manifest-path=crates/std_detect/Cargo.toml"
STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml"
INTRINSIC_TEST="--manifest-path=crates/intrinsic-test/Cargo.toml"

if [ "$STDARCH_TEST_EVERYTHING" = "1" ]; then
# Intel SDE doesn't support xop, so we need qemu (only testing xop to save time)
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="qemu-x86_64 -cpu=max"
cargo_test "${CORE_ARCH} --release xop"

export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="sde64 \
-cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def \
-rtm-mode full -tsx --"
export SKIP_TESTS="xop"
fi

cargo_test "${CORE_ARCH} --release"

if [ "$NOSTD" != "1" ]; then
Expand Down
3 changes: 2 additions & 1 deletion crates/core_arch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
generic_arg_infer,
asm_experimental_arch,
sha512_sm_x86,
f16
f16,
xop_target_feature
)]
#![cfg_attr(test, feature(test, abi_vectorcall, stdarch_internal))]
#![deny(clippy::missing_inline_in_public_items)]
Expand Down
9 changes: 9 additions & 0 deletions crates/core_arch/src/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ pub type _MM_MANTISSA_SIGN_ENUM = i32;
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
pub type _MM_PERM_ENUM = i32;

/// The `_MM_PCOMCTRL_ENUM` type used to specify comparison control operations in XOP intrinsics.
#[allow(non_camel_case_types)]
#[unstable(feature = "xop_target_feature", issue = "127208")]
pub type _MM_PCOMCTRL_ENUM = i32;

#[cfg(test)]
mod test;
#[cfg(test)]
Expand Down Expand Up @@ -1008,3 +1013,7 @@ pub use self::avxneconvert::*;
mod avx512fp16;
#[unstable(feature = "stdarch_x86_avx512_f16", issue = "127213")]
pub use self::avx512fp16::*;

mod xop;
#[unstable(feature = "xop_target_feature", issue = "127208")]
pub use self::xop::*;
Loading

0 comments on commit d170fce

Please sign in to comment.