From 0d904e86c2812dac4895ade23ca0e72063135f25 Mon Sep 17 00:00:00 2001 From: Andrew Milson Date: Sat, 4 May 2024 18:12:19 -0400 Subject: [PATCH] Update CI to test Wasm simd128, avx2 and aarch64 neon --- .github/workflows/ci.yaml | 72 ++++++++++++++++++++++++--------- .github/workflows/coverage.yaml | 2 + Cargo.toml | 1 + crates/prover/Cargo.toml | 12 +++++- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 322f1d2b2..ce7d529ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,7 +38,7 @@ jobs: toolchain: nightly-2024-01-04 - uses: Swatinem/rust-cache@v2 - run: scripts/clippy.sh - + doc: runs-on: ubuntu-latest steps: @@ -49,7 +49,39 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo +nightly-2024-01-04 doc + run-wasm32-wasi-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-01-04 + targets: wasm32-wasi + - uses: taiki-e/install-action@v2 + with: + tool: wasmtime + - uses: Swatinem/rust-cache@v2 + - run: cargo test --target wasm32-wasi + env: + CARGO_TARGET_WASM32_WASI_RUNNER: "wasmtime run --" + RUSTFLAGS: -C target-feature=+simd128 + + run-neon-tests: + runs-on: macos-latest-xlarge + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-01-04 + - uses: Swatinem/rust-cache@v2 + - run: cargo +nightly-2024-01-04 test + env: + RUSTFLAGS: -C target-feature=+neon + run-avx-tests: + strategy: + matrix: + target-feature: [avx512f, avx2] runs-on: avx steps: - uses: actions/checkout@v4 @@ -57,9 +89,11 @@ jobs: with: toolchain: nightly-2024-01-04 - uses: Swatinem/rust-cache@v2 - - run: ./scripts/test_avx.sh - - run-avx-bench: + - run: cargo +nightly-2024-01-04 test + env: + RUSTFLAGS: -C target-cpu=native -C target-feature=+${{ matrix.target-feature }} + + run-avx512-bench: runs-on: avx steps: - uses: actions/checkout@v4 @@ -76,20 +110,17 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 with: - tool: 'cargo' + tool: "cargo" output-file-path: output.txt external-data-json-path: ./cache/benchmark-data.json fail-on-alert: true summary-always: true github-token: ${{ secrets.GITHUB_TOKEN }} comment-on-alert: true - alert-comment-cc-users: '@spapinistarkware' + alert-comment-cc-users: "@spapinistarkware" run-tests: - strategy: - matrix: - os: [ubuntu-latest, macos-latest-xlarge] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master @@ -116,17 +147,18 @@ jobs: env: RUSTUP_TOOLCHAIN: nightly-2024-01-04 - all-tests: runs-on: ubuntu-latest needs: - - clippy - - format - - run-tests - - run-avx-tests - - udeps + - clippy + - format + - run-tests + - run-avx-tests + - run-neon-tests + - run-wasm32-wasi-tests + - udeps steps: - - name: Decide whether all the needed jobs succeeded or failed - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} + - name: Decide whether all the needed jobs succeeded or failed + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 8098727db..504cd67bb 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -16,6 +16,8 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov + # TODO: Merge coverage reports for tests on different architectures. + # - name: Generate code coverage run: cargo +nightly-2024-01-04 llvm-cov --codecov --output-path codecov.json env: diff --git a/Cargo.toml b/Cargo.toml index 2159d2b93..8ebdd6e11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["crates/prover"] +resolver = "2" [workspace.package] version = "0.1.1" diff --git a/crates/prover/Cargo.toml b/crates/prover/Cargo.toml index fed9ad7ce..f687cbe72 100644 --- a/crates/prover/Cargo.toml +++ b/crates/prover/Cargo.toml @@ -20,10 +20,20 @@ tracing.workspace = true [dev-dependencies] aligned = "0.4.2" -criterion = { version = "0.5.1", features = ["html_reports"] } test-log = { version = "0.2.15", features = ["trace"] } tracing-subscriber = "0.3.18" +[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.criterion] +features = ["html_reports"] +version = "0.5.1" + +# Default features cause compile error: +# "Rayon cannot be used when targeting wasi32. Try disabling default features." +[target.'cfg(target_arch = "wasm32")'.dev-dependencies.criterion] +default-features = false +features = ["html_reports"] +version = "0.5.1" + [lib] bench = false