Add SIMD emulation of mul_add_precise for f64 on SSE4.2
#1395
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| env: | |
| # We aim to always test with the latest stable Rust toolchain, however we pin to a specific | |
| # version like 1.70. Note that we only specify MAJOR.MINOR and not PATCH so that bugfixes still | |
| # come automatically. If the version specified here is no longer the latest stable version, | |
| # then please feel free to submit a PR that adjusts it along with the potential clippy fixes. | |
| RUST_STABLE_VER: "1.89" # In quotes because otherwise (e.g.) 1.70 would be interpreted as 1.7 | |
| # The purpose of checking with the minimum supported Rust toolchain is to detect its staleness. | |
| # If the compilation fails, then the version specified here needs to be bumped up to reality. | |
| # Be sure to also update the rust-version property in the workspace Cargo.toml file, | |
| # plus all the README.md files of the affected packages. | |
| RUST_MIN_VER: "1.89" | |
| # List of packages that will be checked with the minimum supported Rust version. | |
| # This should be limited to packages that are intended for publishing. | |
| RUST_MIN_VER_PKGS: "-p fearless_simd" | |
| # List of features that depend on the standard library and will be excluded from no_std checks. | |
| FEATURES_DEPENDING_ON_STD: "std,default" | |
| # List of packages that can not target Wasm. | |
| NO_WASM_PKGS: "--exclude fearless_simd_gen" | |
| # Rationale | |
| # | |
| # We don't run clippy with --all-targets because then even --lib and --bins are compiled with | |
| # dev dependencies enabled, which does not match how they would be compiled by users. | |
| # A dev dependency might enable a feature that we need for a regular dependency, | |
| # and checking with --all-targets would not find our feature requirements lacking. | |
| # This problem still applies to cargo resolver version 2. | |
| # Thus we split all the targets into two steps, one with --lib --bins | |
| # and another with --tests --benches --examples. | |
| # Also, we can't give --lib --bins explicitly because then cargo will error on binary-only packages. | |
| # Luckily the default behavior of cargo with no explicit targets is the same but without the error. | |
| # | |
| # We use cargo-hack for a similar reason. Cargo's --workspace will do feature unification across | |
| # the whole workspace. While cargo-hack will instead check each workspace package separately. | |
| # | |
| # Using cargo-hack also allows us to more easily test the feature matrix of our packages. | |
| # We use --each-feature & --optional-deps which will run a separate check for every feature. | |
| # | |
| # The MSRV jobs run only cargo check because different clippy versions can disagree on goals and | |
| # running tests introduces dev dependencies which may require a higher MSRV than the bare package. | |
| # | |
| # For no_std checks we target x86_64-unknown-none, because this target doesn't support std | |
| # and as such will error out if our dependency tree accidentally tries to use std. | |
| # https://doc.rust-lang.org/stable/rustc/platform-support/x86_64-unknown-none.html | |
| # | |
| # We don't save caches in the merge-group cases, because those caches will never be re-used (apart | |
| # from the very rare cases where there are multiple PRs in the merge queue). | |
| # This is because GitHub doesn't share caches between merge queues and the main branch. | |
| name: CI | |
| on: | |
| pull_request: | |
| merge_group: | |
| # We run on push, even though the commit is the same as when we ran in merge_group. | |
| # This allows the cache to be primed. | |
| # See https://github.com/orgs/community/discussions/66430 | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| fmt: | |
| name: formatting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| components: rustfmt | |
| - name: cargo fmt | |
| run: cargo fmt --all --check | |
| - name: Install Taplo | |
| uses: uncenter/setup-taplo@09968a8ae38d66ddd3d23802c44bf6122d7aa991 # v1 | |
| with: | |
| version: "0.9.3" | |
| - name: Run taplo fmt | |
| run: taplo fmt --check --diff | |
| - name: install ripgrep | |
| run: | | |
| sudo apt update | |
| sudo apt install ripgrep | |
| - name: check copyright headers | |
| run: bash .github/copyright.sh | |
| - name: Install cargo-rdme | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-rdme@1.4.8 | |
| - name: Run cargo rdme (fearless_simd) | |
| run: cargo rdme --check --workspace-project=fearless_simd | |
| clippy-stable: | |
| name: cargo clippy | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest, ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: x86_64-unknown-none | |
| components: clippy | |
| - name: install cargo-hack | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-hack | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: cargo clippy (no_std) | |
| run: cargo hack clippy -p fearless_simd --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} --target x86_64-unknown-none -- -D warnings | |
| - name: cargo clippy | |
| run: cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features std -- -D warnings | |
| - name: cargo clippy (auxiliary) | |
| run: cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features std --tests --benches --examples -- -D warnings | |
| clippy-stable-wasm: | |
| name: cargo clippy (wasm32) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: wasm32-unknown-unknown | |
| components: clippy | |
| - name: install cargo-hack | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-hack | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: cargo clippy (no_std) | |
| run: cargo hack clippy --workspace ${{ env.NO_WASM_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} -- -D warnings | |
| - name: cargo clippy | |
| run: cargo hack clippy --workspace ${{ env.NO_WASM_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std -- -D warnings | |
| - name: cargo clippy (auxiliary) | |
| run: cargo hack clippy --workspace ${{ env.NO_WASM_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std --tests --benches --examples -- -D warnings | |
| check-generated-code: | |
| name: check generated code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| components: rustfmt | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: run code generator | |
| run: cargo run --bin fearless_simd_gen | |
| - name: check for uncommitted changes | |
| run: git diff --exit-code | |
| test-stable: | |
| name: cargo test | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - { target: aarch64-apple-darwin, os: macos-latest } | |
| - { target: x86_64-apple-darwin, os: macos-26-intel } | |
| - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } | |
| - { target: x86_64-pc-windows-msvc, os: windows-latest } | |
| - { target: i686-pc-windows-msvc, os: windows-latest } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: ${{ matrix.platform.target }} | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: cargo test | |
| run: cargo test --workspace --locked --all-features --no-fail-fast --target ${{ matrix.platform.target }} | |
| test-sde: | |
| name: cargo test in an emulator | |
| runs-on: ${{ matrix.platform.os }} | |
| env: | |
| # doc tests take a long time to run in the emulator and are already tested elsewhere, so exclude them with --lib --bins --tests | |
| # the rest of the arguments match the native test jobs | |
| CARGO_TEST_ARGS: --release --lib --bins --tests --workspace --locked --all-features | |
| # explicitly enable debug assertions because we're building tests in release mode for performance | |
| CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: "true" | |
| # SDE package name without the platform suffix. | |
| SDE_PKG: sde-external-10.8.0-2026-03-15 | |
| SDE_SHA256: 50b320cd226acef7a491f5b321fc1be3c3c7984f9e27a456e64894b5b0979dd3 | |
| strategy: | |
| matrix: | |
| platform: | |
| - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: ${{ matrix.platform.target }} | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: install Intel Software Development Emulator | |
| run: | | |
| curl -fsSL -o "${SDE_PKG}-lin.tar.xz" "https://github.com/Shnatsel/intel-sde-mirror/releases/download/sde-${SDE_PKG#sde-external-}/${SDE_PKG}-lin.tar.xz" | |
| if ! echo "${SDE_SHA256} ${SDE_PKG}-lin.tar.xz" | sha256sum -c -; then | |
| echo "SDE archive checksum verification failed" >&2 | |
| exit 1 | |
| fi | |
| tar -Jxf "${SDE_PKG}-lin.tar.xz" | |
| # build the tests outside the emulator, otherwise this job would be very slow | |
| - name: build tests | |
| run: cargo test --no-run $CARGO_TEST_ARGS | |
| - parallel: | |
| - name: run tests on CPU with only SSE2 | |
| # -p4p stands for Pentium 4 Prescott, the first Intel 64-bit CPU | |
| run: ${SDE_PKG}-lin/sde64 -p4p -- cargo test $CARGO_TEST_ARGS | |
| - name: run tests on CPU with SSE4.2 | |
| # -nhm stands for Nehalem | |
| run: ${SDE_PKG}-lin/sde64 -nhm -- cargo test $CARGO_TEST_ARGS | |
| - name: run tests on CPU with AVX2 | |
| # -hsw stands for Haswell | |
| run: ${SDE_PKG}-lin/sde64 -hsw -- cargo test $CARGO_TEST_ARGS | |
| - name: run tests on CPU with AVX-512 | |
| # Github Actions doesn't give us AVX-512 so this is the only way to exercise AVX-512 codepaths on CI. | |
| # -icl stands for Ice Lake. Technically Skylake added AVX-512 first, but it's mostly useless there due to | |
| # downclocking, so our explicit AVX-512 level targets Ice Lake. | |
| run: ${SDE_PKG}-lin/sde64 -icl -- cargo test $CARGO_TEST_ARGS | |
| test-aarch64-qemu: | |
| # This job runs tests on an emulated CPU that only implements the baseline Aarch64 | |
| # to check that we didn't accidentally use NEON instructions that aren't part of the baseline. | |
| name: cargo test in an Aarch64 emulator | |
| runs-on: ${{ matrix.platform.os }} | |
| env: | |
| # doc tests take a long time to run in the emulator and are already tested elsewhere, so exclude them with --lib --bins --tests | |
| # the rest of the arguments match the native test jobs | |
| CARGO_TEST_ARGS: --lib --bins --tests --workspace --locked --all-features | |
| strategy: | |
| matrix: | |
| platform: | |
| - { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04-arm } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: ${{ matrix.platform.target }} | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: install QEMU | |
| run: sudo apt-get update && sudo apt-get install -y qemu-user | |
| # build the tests outside the emulator, otherwise this job would be very slow | |
| - name: build tests | |
| run: cargo test --no-run $CARGO_TEST_ARGS | |
| - name: run tests on CPU with only baseline Aarch64 | |
| # cortex-a53 is the baseline Aarch64 chip | |
| run: cargo test $CARGO_TEST_ARGS | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER: "qemu-aarch64 -cpu cortex-a53" | |
| test-nightly-asan: | |
| name: cargo test with Address Sanitizer | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - { target: aarch64-apple-darwin, os: macos-latest } | |
| - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install nightly toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: nightly | |
| targets: ${{ matrix.platform.target }} | |
| components: rust-src | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| # doc tests fail to link under ASAN so we use use --lib --bins --tests to exclude them | |
| - name: RUSTFLAGS=-Zsanitizer=address cargo +nightly test | |
| run: RUSTFLAGS=-Zsanitizer=address cargo +nightly test -Zbuild-std --lib --bins --tests --workspace --locked --all-features --target ${{ matrix.platform.target }} | |
| test-stable-wasm: | |
| name: cargo test (wasm32) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VER }} | |
| targets: wasm32-unknown-unknown,wasm32-wasip1 | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: install wasmtime | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: wasmtime-cli | |
| # We test using wasm32-wasip1, but want to make sure that wasm32-unknown-unknown still builds | |
| - name: cargo build (wasm32-unknown-unknown) | |
| run: | | |
| cargo build --target wasm32-unknown-unknown \ | |
| --config 'target.wasm32-unknown-unknown.rustflags = "-Ctarget-feature=+simd128"' | |
| - name: cargo build (wasm32-unknown-unknown w/ relaxed-simd) | |
| run: | | |
| cargo build --target wasm32-unknown-unknown \ | |
| --config 'target.wasm32-unknown-unknown.rustflags = "-Ctarget-feature=+simd128,+relaxed-simd"' | |
| - name: cargo test | |
| run: | | |
| cargo test --workspace --locked --all-features --no-fail-fast --target wasm32-wasip1 \ | |
| --config 'target.wasm32-wasip1.rustflags = "-Ctarget-feature=+simd128"' \ | |
| --config 'target.wasm32-wasip1.rustdocflags = "-Ctarget-feature=+simd128"' \ | |
| --config 'target.wasm32-wasip1.runner = "wasmtime"' | |
| - name: cargo test (w/ relaxed-simd) | |
| run: | | |
| cargo test --workspace --locked --all-features --no-fail-fast --target wasm32-wasip1 \ | |
| --config 'target.wasm32-wasip1.rustflags = "-Ctarget-feature=+simd128,+relaxed-simd"' \ | |
| --config 'target.wasm32-wasip1.rustdocflags = "-Ctarget-feature=+simd128,+relaxed-simd"' \ | |
| --config 'target.wasm32-wasip1.runner = "wasmtime"' | |
| check-msrv: | |
| name: cargo check (msrv) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest, ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install msrv toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_MIN_VER }} | |
| targets: x86_64-unknown-none,aarch64-unknown-none | |
| - name: install cargo-hack | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-hack | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: cargo check (no_std) | |
| run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} --target x86_64-unknown-none | |
| - name: cargo check (no_std aarch64) | |
| run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} --target aarch64-unknown-none | |
| - name: cargo check | |
| run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features std | |
| check-msrv-wasm: | |
| name: cargo check (msrv) (wasm32) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install msrv toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_MIN_VER }} | |
| targets: wasm32-unknown-unknown | |
| - name: install cargo-hack | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-hack | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| - name: cargo check | |
| run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std | |
| doc: | |
| name: cargo doc | |
| # NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu. | |
| # If we get per-platform docs (win/macos/linux/wasm32/..) then doc jobs should match that. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install nightly toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| - name: restore cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.event_name != 'merge_group' }} | |
| # We test documentation using nightly to match docs.rs. | |
| - name: cargo doc | |
| run: cargo doc --workspace --locked --all-features --no-deps --document-private-items | |
| env: | |
| RUSTDOCFLAGS: '--cfg docsrs -D warnings' | |
| # If this fails, consider changing your text or adding something to .typos.toml. | |
| typos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: check typos | |
| uses: crate-ci/typos@v1.33.1 |