autoresearch: 26 experiments, Metal 34.6 tok/s (+51% vs CPU) #129
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
| name: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| RUSTC_WRAPPER: "" | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Build (CPU, all models) | |
| run: cargo build -p cake-core -p cake-cli | |
| - name: Unit tests (cake-core lib) | |
| run: cargo test -p cake-core --lib | |
| - name: Unit tests (cake-core external) | |
| run: cargo test -p cake-core --test unit | |
| - name: Protocol tests | |
| run: cargo test -p cake-core --test protocol | |
| test-android: | |
| name: Test (Android aarch64) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| ANDROID_NDK_VERSION: r27c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-linux-android | |
| components: clippy | |
| - name: Set up Android NDK ${{ env.ANDROID_NDK_VERSION }} | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: ${{ env.ANDROID_NDK_VERSION }} | |
| add-to-path: false | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: android-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: android-cargo- | |
| - name: Cache cargo-ndk binary | |
| id: cache-cargo-ndk | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-ndk | |
| key: cargo-ndk-bin-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-ndk | |
| if: steps.cache-cargo-ndk.outputs.cache-hit != 'true' | |
| run: cargo install cargo-ndk --locked | |
| - name: Build cake-mobile (Android aarch64) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android build -p cake-mobile | |
| - name: Clippy (cake-core + cake-mobile, Android) | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: cargo ndk -t aarch64-linux-android clippy -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5" -p cake-mobile -- -D warnings | |
| - name: Unit tests (cake-core lib) | |
| run: cargo test -p cake-core --lib | |
| - name: Unit tests (cake-core external) | |
| run: cargo test -p cake-core --test unit | |
| - name: Protocol tests | |
| run: cargo test -p cake-core --test protocol | |
| test-ios: | |
| name: Test (iOS arm64) | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-ios | |
| components: clippy | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ios-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ios-cargo- | |
| - name: Build cake-mobile (iOS arm64) | |
| env: | |
| IPHONEOS_DEPLOYMENT_TARGET: "16.0" | |
| run: cargo build --target=aarch64-apple-ios -p cake-mobile --features metal | |
| - name: Clippy (cake-core + cake-mobile, iOS) | |
| env: | |
| IPHONEOS_DEPLOYMENT_TARGET: "16.0" | |
| run: cargo clippy --target=aarch64-apple-ios -p cake-core --lib --no-default-features --features "llama,qwen2,qwen3_5,metal" -p cake-mobile --features metal -- -D warnings | |
| - name: Unit tests (cake-core lib, Metal) | |
| run: cargo test -p cake-core --lib --features metal | |
| - name: Unit tests (cake-core external, Metal) | |
| run: cargo test -p cake-core --test unit --features metal | |
| - name: Protocol tests (Metal) | |
| run: cargo test -p cake-core --test protocol --features metal | |
| test-features: | |
| name: Test (${{ matrix.name }}) | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux-cuda | |
| os: ubuntu-latest | |
| features: cuda | |
| cuda: "12.4.0" | |
| compute_cap: "89" | |
| - name: linux-flash-attn | |
| os: ubuntu-latest | |
| features: flash-attn | |
| cuda: "12.4.0" | |
| compute_cap: "89" | |
| - name: linux-vulkan | |
| os: ubuntu-latest | |
| features: vulkan | |
| cuda: "" | |
| compute_cap: "" | |
| - name: linux-rocm | |
| os: ubuntu-latest | |
| features: rocm | |
| cuda: "" | |
| compute_cap: "" | |
| - name: macos-metal | |
| os: macos-latest | |
| features: metal | |
| cuda: "" | |
| compute_cap: "" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y lld | |
| - name: Install CUDA toolkit | |
| if: matrix.cuda != '' | |
| uses: Jimver/cuda-toolkit@v0.2.30 | |
| with: | |
| cuda: ${{ matrix.cuda }} | |
| method: local | |
| linux-local-args: '["--toolkit"]' | |
| log-file-suffix: '${{ matrix.name }}.txt' | |
| - name: Create CUDA runtime stub | |
| if: matrix.cuda != '' | |
| run: | | |
| STUBS_DIR="${CUDA_PATH}/lib64/stubs" | |
| sudo ln -s "${STUBS_DIR}/libcuda.so" "${STUBS_DIR}/libcuda.so.1" | |
| echo "LD_LIBRARY_PATH=${STUBS_DIR}:${LD_LIBRARY_PATH}" >> "$GITHUB_ENV" | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo-${{ matrix.name }}- | |
| - name: Unit tests (cake-core lib) | |
| env: | |
| CUDA_COMPUTE_CAP: ${{ matrix.compute_cap }} | |
| run: cargo test -p cake-core --lib --features "${{ matrix.features }}" | |
| - name: Unit tests (cake-core external) | |
| env: | |
| CUDA_COMPUTE_CAP: ${{ matrix.compute_cap }} | |
| run: cargo test -p cake-core --test unit --features "${{ matrix.features }}" | |
| - name: Protocol tests | |
| env: | |
| CUDA_COMPUTE_CAP: ${{ matrix.compute_cap }} | |
| run: cargo test -p cake-core --test protocol --features "${{ matrix.features }}" | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo-clippy- | |
| - name: Clippy (cake-core + cake-cli, all features) | |
| run: cargo clippy -p cake-core --lib --tests -p cake-cli --features "vulkan,rocm" -- -D warnings |