softgpu 0.8.0

Developer-oriented GPU emulation, testing, debugging, and sanitization runtime
Documentation
name: SoftGPU CI

on:
  push:
    branches: [main, master]
  pull_request:

concurrency:
  group: softgpu-ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  core-macos:
    name: core (macOS aarch64)
    runs-on: macos-14
    steps:
      - uses: actions/checkout@v7
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup show
      - name: Format
        run: cargo fmt --all -- --check
      - name: Build and test (locked)
        run: cargo test --workspace --locked
      - name: Clippy
        run: cargo clippy --workspace --locked --all-targets -- -D warnings
      - name: HSA layout probe
        run: |
          cc -I third_party/rocr-headers -o target/hsa-layout-probe tools/hsa-layout-probe/probe.c
          ./target/hsa-layout-probe
      - name: Doc link check
        run: bash tools/check-docs-links.sh
      - name: Validate bundled profiles
        run: |
          cargo run --locked -- validate-profile profiles/softgpu-generic-v0.json
          cargo run --locked -- validate-profile profiles/amd-radeon-ai-pro-r9700-gfx1201-v0.json

  core-linux:
    name: core (Linux x86_64, no ROCm)
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v7
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup show
      - name: Format
        run: cargo fmt --all -- --check
      - name: Build and test (locked)
        run: cargo test --workspace --locked
      - name: Clippy
        run: cargo clippy --workspace --locked --all-targets -- -D warnings
      - name: HSA layout probe
        run: |
          cc -I third_party/rocr-headers -o target/hsa-layout-probe tools/hsa-layout-probe/probe.c
          ./target/hsa-layout-probe
      - name: Doc link check
        run: bash tools/check-docs-links.sh

  rocm-integration:
    name: ROCm/HIP SoftGPU load proof (x86_64)
    runs-on: ubuntu-24.04
    timeout-minutes: 180
    steps:
      - uses: actions/checkout@v7
      - name: Load ROCm image pin
        id: pin
        run: |
          set -euo pipefail
          # shellcheck disable=SC1091
          source environments/rocm-x86_64/PINNED
          echo "image=${ROCM_IMAGE}" >> "$GITHUB_OUTPUT"
          echo "digest=${ROCM_IMAGE_DIGEST}" >> "$GITHUB_OUTPUT"
          echo "version=${ROCM_VERSION}" >> "$GITHUB_OUTPUT"
      - name: Pull pinned ROCm image
        run: |
          set -euo pipefail
          docker pull "${{ steps.pin.outputs.image }}@${{ steps.pin.outputs.digest }}"
      - name: Phase 1 HIP load proof in pinned ROCm container
        run: |
          set -euo pipefail
          chmod +x environments/rocm-x86_64/ci-entrypoint.sh \
                   environments/rocm-x86_64/run-phase1-load-proof.sh
          docker run --rm \
            --platform linux/amd64 \
            -v "$PWD:/src:rw" \
            -w /src \
            -e CARGO_HOME=/tmp/cargo \
            -e RUSTUP_HOME=/tmp/rustup \
            "${{ steps.pin.outputs.image }}@${{ steps.pin.outputs.digest }}" \
            bash environments/rocm-x86_64/ci-entrypoint.sh

  ci-result-policy:
    name: CI result policy (skipped ≠ passed)
    runs-on: ubuntu-24.04
    needs: [core-macos, core-linux, rocm-integration]
    if: always()
    steps:
      - name: Record gate status
        run: |
          echo "core-macos=${{ needs.core-macos.result }}"
          echo "core-linux=${{ needs.core-linux.result }}"
          echo "rocm-integration=${{ needs.rocm-integration.result }}"
          test "${{ needs.core-macos.result }}" = "success"
          test "${{ needs.core-linux.result }}" = "success"
          test "${{ needs.rocm-integration.result }}" = "success"
          echo "Phase 1 ROCm/HIP load proof is a required gate (not a skip)."