From 52a4a5c373d08f385b71502f222aa97942aa6372 Mon Sep 17 00:00:00 2001 From: adust09 Date: Mon, 15 Sep 2025 10:18:46 +0900 Subject: [PATCH 1/7] =?UTF-8?q?CI:=20AVX2/AVX=E2=80=91512/NEON=20=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=83=93=E3=83=AB=E3=83=89=E3=83=BB=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0=20(vibe-kanban=204c682469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit branche name: feat/multi_arch_ci ## 背景 - 本ワークスペースの SIMD 最適化(AVX2/AVX‑512/NEON)コードパスの劣化検知が必要 。 - GitHub ホストランナーは AVX‑512 を保証せず、ARM64 も環境により未提供のため、実行戦略を分離。 - AVX2: x86_64 ランナーでビルド+テストを実行。 - AVX‑512: x86_64 ランナーでは未対応の可能性が高く、ビルドのみで担保。 - NEON: ARM64 ランナー(例: `ubuntu-24.04-arm64` または `self-hosted, Linux, ARM64`)でビルド+テストを実行。 ## スコープ - `.github/workflows/rust.yml` の Build & Test を CPU 機能マトリクス化。 - x86_64/AVX2 は実行テストまで、x86_64/AVX‑512 はビルドのみ、ARM64/NEON は実行テストまで。 - 既存の Clippy/Fmt ジョブは維持。 - すべて nightly、`Swatinem/rust-cache@v2`、`RUST_BACKTRACE=1` を適用。 ## 受け入れ条件 - Push/PR で以下が動作: - x64/AVX2: リリースビルド+テストが成功。 - x64/AVX‑512: リリースビルドが成功(テストはスキップ)。 - ARM64/NEON: リリースビルド+テストが成功(ARM64 ランナーが利用可能な場合)。 - Clippy/Fmt は従来通り、警告・未整形で CI が失敗。 - 2 回目以降の実行でビルドキャッシュが効く。 ## 注意点 - AVX‑512 はホストランナーで未対応の可能性が高く、テスト実行は SIGILL 回避のためスキップ。 - ARM64 ランナーが未提供の場合は NEON 行を一時的にコメントアウト、または `self-hosted` ラベル運用に切替。 - 実行テストは `is_x86_feature_detected!` や `cfg(target_feature)` で条件化し、誤実行を防止。 ## 提案する rust.yml(差し替え案) ```yaml name: Rust CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: permissions: contents: read concurrency: group: rust-ci-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: build-test-matrix: name: Build & Test (${{ matrix.name }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - name: x64-avx2 os: ubuntu-latest rustflags: -C target-cpu=haswell run_tests: true - name: x64-avx512-build os: ubuntu-latest rustflags: -C target-cpu=skylake-avx512 run_tests: false # build only to avoid SIGILL - name: arm64-neon # 利用可能な場合は GitHub ホスト ARM64 ランナーに置換 # 例: ubuntu-24.04-arm64(組織設定依存) # 未提供時は self-hosted を使用: [self-hosted, Linux, ARM64] os: ubuntu-24.04-arm64 rustflags: -C target-feature=+neon run_tests: true steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Build (release) run: cargo build --workspace --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }} - name: Test (release) if: ${{ matrix.run_tests == true }} run: cargo test --workspace --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }} clippy: runs-on: ubuntu-latest name: Clippy steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly components: clippy - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Clippy (deny warnings) run: cargo clippy --workspace --all-targets --all-features -- -D warning s fmt: runs-on: ubuntu-latest name: Rustfmt steps: - uses: actions/checkout@v4 - name: Install nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly components: rustfmt - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Check formatting run: cargo fmt --all -- --check ``` --- .github/workflows/rust.yml | 91 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..94d0a018 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,91 @@ +name: Rust CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: rust-ci-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + build-test-matrix: + name: Build & Test (${{ matrix.name }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: x64-avx2 + os: ubuntu-latest + rustflags: -C target-cpu=haswell + run_tests: true + - name: x64-avx512-build + os: ubuntu-latest + rustflags: -C target-cpu=skylake-avx512 + run_tests: false # build only to avoid SIGILL + - name: arm64-neon + # If available, use GitHub-hosted ARM64 runner + # e.g. ubuntu-24.04-arm64 (org setting dependent) + # If unavailable, consider: [self-hosted, Linux, ARM64] + os: ubuntu-24.04-arm64 + rustflags: -C target-feature=+neon + run_tests: true + steps: + - uses: actions/checkout@v4 + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + - name: Cache cargo build + uses: Swatinem/rust-cache@v2 + - name: Build (release) + run: cargo build --workspace --release --verbose + env: + RUSTFLAGS: ${{ matrix.rustflags }} + - name: Test (release) + if: ${{ matrix.run_tests == true }} + run: cargo test --workspace --release --verbose + env: + RUSTFLAGS: ${{ matrix.rustflags }} + + clippy: + runs-on: ubuntu-latest + name: Clippy + steps: + - uses: actions/checkout@v4 + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: clippy + - name: Cache cargo build + uses: Swatinem/rust-cache@v2 + - name: Clippy (deny warnings) + run: cargo clippy --workspace --all-targets --all-features -- -D warnings + + fmt: + runs-on: ubuntu-latest + name: Rustfmt + steps: + - uses: actions/checkout@v4 + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: rustfmt + - name: Cache cargo build + uses: Swatinem/rust-cache@v2 + - name: Check formatting + run: cargo fmt --all -- --check + From 9865abab1a62d55568b83987157ab846ee39a8e1 Mon Sep 17 00:00:00 2001 From: adust09 Date: Tue, 16 Sep 2025 18:36:40 +0900 Subject: [PATCH 2/7] delete unsupported machine --- .github/workflows/rust.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 39bd2841..14d1fce3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,14 +30,7 @@ jobs: os: ubuntu-latest rustflags: -C target-cpu=haswell run_tests: true - - name: x64-avx512-build - os: ubuntu-latest - rustflags: -C target-cpu=skylake-avx512 - run_tests: false # build only to avoid SIGILL - name: arm64-neon - # If available, use GitHub-hosted ARM64 runner - # e.g. ubuntu-24.04-arm64 (org setting dependent) - # If unavailable, consider: [self-hosted, Linux, ARM64] os: ubuntu-24.04-arm64 rustflags: -C target-feature=+neon run_tests: true From 2373478fd45c68d8ad594051cf17d973f061165d Mon Sep 17 00:00:00 2001 From: adust09 Date: Tue, 16 Sep 2025 18:59:36 +0900 Subject: [PATCH 3/7] test neon --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 14d1fce3..69aa039d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,10 +26,10 @@ jobs: fail-fast: false matrix: include: - - name: x64-avx2 - os: ubuntu-latest - rustflags: -C target-cpu=haswell - run_tests: true + # - name: x64-avx2 + # os: ubuntu-latest + # rustflags: -C target-cpu=haswell + # run_tests: true - name: arm64-neon os: ubuntu-24.04-arm64 rustflags: -C target-feature=+neon From 3a00b5a44ff27aec0f6588edd9d7f61014e73775 Mon Sep 17 00:00:00 2001 From: adust09 Date: Sat, 20 Sep 2025 15:39:26 +0900 Subject: [PATCH 4/7] Enable AVX2 tests in CI workflow by uncommenting the x64-avx2 configuration in rust.yml --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 69aa039d..14d1fce3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,10 +26,10 @@ jobs: fail-fast: false matrix: include: - # - name: x64-avx2 - # os: ubuntu-latest - # rustflags: -C target-cpu=haswell - # run_tests: true + - name: x64-avx2 + os: ubuntu-latest + rustflags: -C target-cpu=haswell + run_tests: true - name: arm64-neon os: ubuntu-24.04-arm64 rustflags: -C target-feature=+neon From 2f096967b12964d7b2ec9651123826248a62f245 Mon Sep 17 00:00:00 2001 From: adust09 Date: Sat, 20 Sep 2025 15:47:24 +0900 Subject: [PATCH 5/7] Refactor CI workflow: Rename jobs for clarity and update step names in rust.yml --- .github/workflows/rust.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 14d1fce3..3558acad 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Rust CI +name: Rust on: push: @@ -52,7 +52,7 @@ jobs: env: RUSTFLAGS: ${{ matrix.rustflags }} - clippy: + cargo-clippy: runs-on: ubuntu-latest name: Clippy steps: @@ -64,12 +64,12 @@ jobs: components: clippy - name: Cache cargo build uses: Swatinem/rust-cache@v2 - - name: Clippy (deny warnings) + - name: Clippy Check run: cargo clippy --workspace --all-targets --all-features -- -D warnings - fmt: + cargo-fmt: runs-on: ubuntu-latest - name: Rustfmt + name: Rustfmt Check steps: - uses: actions/checkout@v4 - name: Install nightly toolchain From 17ad5f6ecaa1724b7e528c4ed937b8f5a43a1a6f Mon Sep 17 00:00:00 2001 From: adust09 Date: Sat, 20 Sep 2025 15:54:05 +0900 Subject: [PATCH 6/7] Update Clippy command in CI workflow to use a more concise flag format in rust.yml --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3558acad..1477fd44 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -65,7 +65,7 @@ jobs: - name: Cache cargo build uses: Swatinem/rust-cache@v2 - name: Clippy Check - run: cargo clippy --workspace --all-targets --all-features -- -D warnings + run: cargo clippy --workspace --all-targets -- -Dwarnings cargo-fmt: runs-on: ubuntu-latest From a371c335638d7fb08f740f7544e7fa59afd182b4 Mon Sep 17 00:00:00 2001 From: adust09 Date: Sat, 20 Sep 2025 15:55:45 +0900 Subject: [PATCH 7/7] Refactor CI workflow: Simplify build and test steps in rust.yml by removing workspace flag --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1477fd44..e1c65415 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -42,13 +42,13 @@ jobs: toolchain: nightly - name: Cache cargo build uses: Swatinem/rust-cache@v2 - - name: Build (release) - run: cargo build --workspace --release --verbose + - name: Build + run: cargo build --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }} - - name: Test (release) + - name: Test if: ${{ matrix.run_tests == true }} - run: cargo test --workspace --release --verbose + run: cargo test --release --verbose env: RUSTFLAGS: ${{ matrix.rustflags }}