From b3b8f1e23f9f7686f991800a6fc06999ed760071 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:18:21 -0700 Subject: [PATCH 1/7] ci: add ubuntu-latest test pipelines for highest/lowest torch Add 4 GitHub-hosted Linux pipelines that run on ubuntu-latest: - highest-torch slow, highest-torch fast - lowest-torch slow, lowest-torch fast Each runs the corresponding make target with --junit and uploads its test-results artifact. Ungated and independent of the macOS self-hosted jobs so they also run on forks. --- .github/workflows/ci.yaml | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b33ca79..32f666c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,3 +58,83 @@ jobs: with: name: test-results-macos-highest-fast path: test-results/ + + linux-highest-slow: + name: Linux / make test-highest-pytorch / markers=slow + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-highest-pytorch` + run: make test-highest-pytorch PYTEST_ARGS="--marker slow --junit" + - name: Upload test results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-linux-highest-slow + path: test-results/ + + linux-highest-fast: + name: Linux / make test-highest-pytorch / markers=not-slow + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-highest-pytorch` + run: make test-highest-pytorch PYTEST_ARGS="--marker 'not slow' --junit" + - name: Upload test results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-linux-highest-fast + path: test-results/ + + linux-lowest-slow: + name: Linux / make test-lowest-pytorch / markers=slow + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-lowest-pytorch` + run: make test-lowest-pytorch PYTEST_ARGS="--marker slow --junit" + - name: Upload test results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-linux-lowest-slow + path: test-results/ + + linux-lowest-fast: + name: Linux / make test-lowest-pytorch / markers=not-slow + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-lowest-pytorch` + run: make test-lowest-pytorch PYTEST_ARGS="--marker 'not slow' --junit" + - name: Upload test results + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-linux-lowest-fast + path: test-results/ From 0c3cfa3b738611e2f44a6f67722da7d953e30cbc Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 12:26:15 -0700 Subject: [PATCH 2/7] ci: gate test matrix behind a tiered check/smoke/tutorials stage Introduce a tiered CI structure: - Tier 1 (ubuntu-latest, ungated): make check, make test-smoke, make test-tutorials. - Tier 2 (needs all of Tier 1): the 4 linux test pipelines and the macOS test run. Move `check` off the macOS self-hosted runner to ubuntu-latest and drop its repo gate so the gate also runs on forks (otherwise Tier 2 would be skipped there). test-smoke/test-tutorials targets are added by a separate change; until then those jobs fail and Tier 2 is skipped. --- .github/workflows/ci.yaml | 42 +++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 32f666c..6edc21f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,10 +20,11 @@ concurrency: jobs: + # ── Stage 1: cheap correctness gate (ubuntu-latest, ungated). ── + # Stage 2 runs only if all three of these pass. check: - name: macOS / make check - if: github.repository == 'apple/coreai-optimization' - runs-on: [self-hosted, macos, tahoe, ARM64] + name: Linux / make check + runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Check out repository @@ -37,9 +38,38 @@ jobs: - name: Run `make check` run: make check + test-smoke: + name: Linux / make test-smoke + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-smoke` + run: make test-smoke + + test-tutorials: + name: Linux / make test-tutorials + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Check out repository + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Run `make test-tutorials` + run: make test-tutorials + + # ── Stage 2: full test matrix, gated on Stage 1. ── macos-tests: name: macOS / make test-highest-pytorch / markers=not-slow - needs: [check] + needs: [check, test-smoke, test-tutorials] if: github.repository == 'apple/coreai-optimization' runs-on: [self-hosted, macos, tahoe, ARM64] timeout-minutes: 60 @@ -61,6 +91,7 @@ jobs: linux-highest-slow: name: Linux / make test-highest-pytorch / markers=slow + needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 steps: @@ -81,6 +112,7 @@ jobs: linux-highest-fast: name: Linux / make test-highest-pytorch / markers=not-slow + needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 60 steps: @@ -101,6 +133,7 @@ jobs: linux-lowest-slow: name: Linux / make test-lowest-pytorch / markers=slow + needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 steps: @@ -121,6 +154,7 @@ jobs: linux-lowest-fast: name: Linux / make test-lowest-pytorch / markers=not-slow + needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 60 steps: From 2d370c5215fb81660ff9eac65dcea122a1f11075 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 13:48:29 -0700 Subject: [PATCH 3/7] ci: set linux test pipeline timeout-minutes to 120 --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6edc21f..cae5534 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -114,7 +114,7 @@ jobs: name: Linux / make test-highest-pytorch / markers=not-slow needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 120 steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -156,7 +156,7 @@ jobs: name: Linux / make test-lowest-pytorch / markers=not-slow needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 120 steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 From d1b53a029d51cf41b7231f5e19b98cb05c84dda0 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 14:11:43 -0700 Subject: [PATCH 4/7] build: gate pre-commit hook install behind INSTALL_PRECOMMIT Port the scripts/make changes from coreai-opt#497 so INSTALL_PRECOMMIT is a real knob: setup_env.sh defaults it (false in --ensure mode, true otherwise) and threads it to install_pre_commit_hooks.sh, which skips `pre-commit install -f` when INSTALL_PRECOMMIT=false. --- scripts/make/install_pre_commit_hooks.sh | 8 ++++++-- scripts/make/setup_env.sh | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/make/install_pre_commit_hooks.sh b/scripts/make/install_pre_commit_hooks.sh index 36c080b..a9ca8df 100755 --- a/scripts/make/install_pre_commit_hooks.sh +++ b/scripts/make/install_pre_commit_hooks.sh @@ -60,5 +60,9 @@ if ! command -v lychee &>/dev/null; then fi # Configure git hooks. Force-install so the shebang points to the current venv. -uv run --no-sync --active pre-commit install -f -echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV" +if [[ "${INSTALL_PRECOMMIT:-true}" == "false" ]]; then + echo "Skipping git hook configuration (INSTALL_PRECOMMIT=$INSTALL_PRECOMMIT)" +else + uv run --no-sync --active pre-commit install -f + echo "✓ Pre-commit hooks configured to use $VIRTUAL_ENV" +fi diff --git a/scripts/make/setup_env.sh b/scripts/make/setup_env.sh index e4af6e4..36b123b 100755 --- a/scripts/make/setup_env.sh +++ b/scripts/make/setup_env.sh @@ -195,6 +195,12 @@ while [[ $# -gt 0 ]]; do esac done +if [[ "$ENSURE_MODE" == true ]]; then + INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-false}" +else + INSTALL_PRECOMMIT="${INSTALL_PRECOMMIT:-true}" +fi + # Validate required arguments if [[ -z "$PYTHON_VERSION" ]]; then echo "Error: --python-version is required" @@ -339,11 +345,11 @@ echo "Running: ${SYNC_CMD[*]}" "${SYNC_CMD[@]}" echo "" -echo "[3/3] Configuring pre-commit hooks..." +echo "[3/3] Installing hook dependencies and configuring pre-commit hooks..." if [[ "$VENV_PREEXISTED" == "true" ]]; then echo "Skipped (venv already exists, hooks already configured)" else - "$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME" + INSTALL_PRECOMMIT="$INSTALL_PRECOMMIT" "$SCRIPTS_DIR/make/install_pre_commit_hooks.sh" "$COREAI_OPT_HOME" fi echo "" From 0df3fca0c0f856390e55d4a01392ab302c99ec45 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 14:11:43 -0700 Subject: [PATCH 5/7] ci: set INSTALL_PRECOMMIT=false for the test, smoke, and tutorial jobs Skip git-hook configuration during env setup for the 4 linux test jobs, the macOS test run, test-smoke, and test-tutorials. `check` is left as-is. --- .github/workflows/ci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cae5534..7376aa6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,6 +42,8 @@ jobs: name: Linux / make test-smoke runs-on: ubuntu-latest timeout-minutes: 60 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -56,6 +58,8 @@ jobs: name: Linux / make test-tutorials runs-on: ubuntu-latest timeout-minutes: 60 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -73,6 +77,8 @@ jobs: if: github.repository == 'apple/coreai-optimization' runs-on: [self-hosted, macos, tahoe, ARM64] timeout-minutes: 60 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -94,6 +100,8 @@ jobs: needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -115,6 +123,8 @@ jobs: needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -136,6 +146,8 @@ jobs: needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -157,6 +169,8 @@ jobs: needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 + env: + INSTALL_PRECOMMIT: "false" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 From b41b0a9747b4230cee0984b2cb33f764c5ab91e8 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 14:27:08 -0700 Subject: [PATCH 6/7] ci: collapse linux test jobs into a strategy matrix GitHub Actions doesn't support YAML anchors, so collapse the 4 linux-* test jobs into a single `linux-tests` job with a strategy.matrix over {highest,lowest} x {slow,fast}, declaring needs:/env:/steps once. Also drop the redundant "Stage 2 runs only if..." comment. --- .github/workflows/ci.yaml | 85 +++++---------------------------------- 1 file changed, 10 insertions(+), 75 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7376aa6..92ff6f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,6 @@ concurrency: jobs: # ── Stage 1: cheap correctness gate (ubuntu-latest, ungated). ── - # Stage 2 runs only if all three of these pass. check: name: Linux / make check runs-on: ubuntu-latest @@ -95,13 +94,18 @@ jobs: name: test-results-macos-highest-fast path: test-results/ - linux-highest-slow: - name: Linux / make test-highest-pytorch / markers=slow + linux-tests: + name: Linux / make test-${{ matrix.torch }}-pytorch / markers=${{ matrix.speed == 'slow' && 'slow' || 'not-slow' }} needs: [check, test-smoke, test-tutorials] runs-on: ubuntu-latest timeout-minutes: 120 env: INSTALL_PRECOMMIT: "false" + strategy: + fail-fast: false + matrix: + torch: [highest, lowest] + speed: [slow, fast] steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -109,80 +113,11 @@ jobs: uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 with: enable-cache: false - - name: Run `make test-highest-pytorch` - run: make test-highest-pytorch PYTEST_ARGS="--marker slow --junit" - - name: Upload test results - if: always() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: test-results-linux-highest-slow - path: test-results/ - - linux-highest-fast: - name: Linux / make test-highest-pytorch / markers=not-slow - needs: [check, test-smoke, test-tutorials] - runs-on: ubuntu-latest - timeout-minutes: 120 - env: - INSTALL_PRECOMMIT: "false" - steps: - - name: Check out repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - name: Install uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - enable-cache: false - - name: Run `make test-highest-pytorch` - run: make test-highest-pytorch PYTEST_ARGS="--marker 'not slow' --junit" - - name: Upload test results - if: always() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: test-results-linux-highest-fast - path: test-results/ - - linux-lowest-slow: - name: Linux / make test-lowest-pytorch / markers=slow - needs: [check, test-smoke, test-tutorials] - runs-on: ubuntu-latest - timeout-minutes: 120 - env: - INSTALL_PRECOMMIT: "false" - steps: - - name: Check out repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - name: Install uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - enable-cache: false - - name: Run `make test-lowest-pytorch` - run: make test-lowest-pytorch PYTEST_ARGS="--marker slow --junit" - - name: Upload test results - if: always() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: test-results-linux-lowest-slow - path: test-results/ - - linux-lowest-fast: - name: Linux / make test-lowest-pytorch / markers=not-slow - needs: [check, test-smoke, test-tutorials] - runs-on: ubuntu-latest - timeout-minutes: 120 - env: - INSTALL_PRECOMMIT: "false" - steps: - - name: Check out repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - name: Install uv - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - with: - enable-cache: false - - name: Run `make test-lowest-pytorch` - run: make test-lowest-pytorch PYTEST_ARGS="--marker 'not slow' --junit" + - name: Run `make test-${{ matrix.torch }}-pytorch` + run: make test-${{ matrix.torch }}-pytorch PYTEST_ARGS="--marker '${{ matrix.speed == 'slow' && 'slow' || 'not slow' }}' --junit" - name: Upload test results if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: test-results-linux-lowest-fast + name: test-results-linux-${{ matrix.torch }}-${{ matrix.speed }} path: test-results/ From 442ff94c113a5a609376c980035a111815e85007 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:54:48 -0700 Subject: [PATCH 7/7] test: set strict=False on the resnet export xfail --- tests/export/test_graph_mode_mlir_export.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/export/test_graph_mode_mlir_export.py b/tests/export/test_graph_mode_mlir_export.py index 2ef1d61..27b6b28 100644 --- a/tests/export/test_graph_mode_mlir_export.py +++ b/tests/export/test_graph_mode_mlir_export.py @@ -211,6 +211,7 @@ def test_mnist_export( "[Export Tests] ResNet50 graph-mode int8 quantization" " SNR falls below threshold on Linux (19.44 < 20.0)" ), + strict=False, ) def test_resnet_export( resnet50_model: torch.nn.Module,