From d807bee858bac8448abe5ea75c2f98fc1f5d48c5 Mon Sep 17 00:00:00 2001 From: geomin12 Date: Mon, 5 Oct 2026 15:44:14 -0700 Subject: [PATCH 1/2] feat(ci): add ci:cpu-test-only label to skip GPU tests (#7375) Add a new PR label `ci:cpu-test-only` that disables GPU tests while still allowing CPU-only tests to run. This is useful for changes that don't require GPU testing, such as documentation, build scripts, or CPU-only components. The label works by setting `test-runs-on` to empty (disabling GPU tests) while keeping `test-runs-on-cpu` populated, so components with `linux_cpu_runner: True` can still run their tests. Changes: - Add label definition to configure_ci_labels.py - Add gating logic in configure_multi_arch_ci.py - Document label in ci_behavior_manipulation.md - Add unit tests for the new functionality Closes #7375 Co-Authored-By: Claude Opus 4.6 --- build_tools/github_actions/configure_ci_labels.py | 1 + build_tools/github_actions/configure_multi_arch_ci.py | 7 +++++++ docs/development/ci_behavior_manipulation.md | 1 + 3 files changed, 9 insertions(+) diff --git a/build_tools/github_actions/configure_ci_labels.py b/build_tools/github_actions/configure_ci_labels.py index bf1fb6f77ef..e25dc2e6957 100755 --- a/build_tools/github_actions/configure_ci_labels.py +++ b/build_tools/github_actions/configure_ci_labels.py @@ -64,6 +64,7 @@ class Label: Label("ci:asan", COLOR_CI_GENERAL, "Opt-in to building ASAN"), Label("ci:host-asan", COLOR_CI_GENERAL, "Opt-in to running multi-arch host-asan CI on a pull request"), Label("ci:run-multi-gpu", COLOR_CI_GENERAL, "Opt-in to running multi-GPU tests"), + Label("ci:cpu-test-only", COLOR_CI_GENERAL, "Run only CPU tests (skip GPU tests)"), # ci:platform: labels (platform selection) Label("ci:platform:linux", COLOR_CI_PLATFORM, "Run CI only on Linux (skip Windows builds/tests)"), Label("ci:platform:windows", COLOR_CI_PLATFORM, "Run CI only on Windows (skip Linux builds/tests)"), diff --git a/build_tools/github_actions/configure_multi_arch_ci.py b/build_tools/github_actions/configure_multi_arch_ci.py index 395f205cad7..1963242475f 100755 --- a/build_tools/github_actions/configure_multi_arch_ci.py +++ b/build_tools/github_actions/configure_multi_arch_ci.py @@ -1601,6 +1601,13 @@ def _expand_build_config_for_platform( f"(global={jobs.test_rocm.test_type})" ) + # ci:cpu-test-only label: disable GPU tests, only run CPU-only tests. + # This is useful for changes that don't require GPU testing (e.g., docs, + # build scripts, CPU-only components). + if "ci:cpu-test-only" in ci_inputs.pr_labels and test_runs_on: + test_runs_on = "" + print(f" {family_name}: GPU tests disabled by 'ci:cpu-test-only' label") + # CPU test runner for components that don't need GPU access (e.g., # components with linux_cpu_runner: True). This allows CPU-only tests # to run even when GPU testing is gated (e.g., trigger_test_label_only). diff --git a/docs/development/ci_behavior_manipulation.md b/docs/development/ci_behavior_manipulation.md index 99631af1dc5..4b528f659f0 100644 --- a/docs/development/ci_behavior_manipulation.md +++ b/docs/development/ci_behavior_manipulation.md @@ -26,6 +26,7 @@ The following labels may be added to a pull request to modify CI behavior: | `ci:asan` | Enable ASAN CI builds and tests. ASAN CI is skipped by default on PRs unless this label is present. | | `ci:host-asan` | Alias for `ci:asan`. Enable ASAN CI builds and tests. | | `ci:run-multi-gpu` | Opt-in to running multi-GPU tests. | +| `ci:cpu-test-only` | Run only CPU tests (skip GPU tests). Useful for changes that don't require GPU testing. | | `ci:platform:linux` | Run CI only on Linux (skip Windows builds/tests) | | `ci:platform:windows` | Run CI only on Windows (skip Linux builds/tests) | | `ci:gfx...` | Opt-in to building and testing the specified gfx family (e.g. `ci:gfx120X-all`, `ci:gfx950-dcgpu`) | From 546cbfa09bc616ee8f66b1133e2feeddff73345a Mon Sep 17 00:00:00 2001 From: geomin12 Date: Wed, 7 Oct 2026 08:38:20 -0700 Subject: [PATCH 2/2] fix(ci): disable multi-GPU tests when ci:cpu-test-only label is set The ci:cpu-test-only label was disabling single-GPU tests but multi-GPU runner info was still being included in the family_info, causing multi-GPU test jobs to be scheduled. Co-Authored-By: Claude Opus 4.6 --- .../tests/configure_multi_arch_ci_test.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/build_tools/github_actions/tests/configure_multi_arch_ci_test.py b/build_tools/github_actions/tests/configure_multi_arch_ci_test.py index d43e2ec0cda..c832c2a8701 100644 --- a/build_tools/github_actions/tests/configure_multi_arch_ci_test.py +++ b/build_tools/github_actions/tests/configure_multi_arch_ci_test.py @@ -3046,5 +3046,55 @@ def test_families_without_multi_label_use_primary_only(self): self.assertEqual(gfx103x_info["test-runs-on"], "linux-gfx1030-gpu-rocm") +# --------------------------------------------------------------------------- +class TestCpuTestOnlyLabel(unittest.TestCase): + """ci:cpu-test-only label: disable GPU tests, keep CPU-only tests.""" + + def _expand(self, pr_labels=None, platform="linux", family="gfx94x"): + ci_inputs = cm.CIInputs( + run_id="1", + event_name="pull_request", + commit_ref="feature", + base_ref="HEAD^1", + build_variant="release", + pr_labels=pr_labels or [], + ) + result = cm.expand_build_configs( + ci_inputs=ci_inputs, + git_context=cm.GitContext(), + targets=cm.TargetSelection(**{f"{platform}_families": [family]}), + jobs=_jobs(), + ) + return getattr(result, platform).per_family_info[0] + + def test_label_disables_gpu_keeps_cpu(self): + """Label disables GPU tests but keeps CPU runner and tests_enabled.""" + entry = self._expand(pr_labels=["ci:cpu-test-only"]) + self.assertEqual(entry["test-runs-on"], "") + self.assertNotEqual(entry["test-runs-on-cpu"], "") + self.assertTrue(entry["tests_enabled"]) + + def test_without_label_gpu_tests_run(self): + """Without label, GPU tests run normally.""" + self.assertNotEqual(self._expand()["test-runs-on"], "") + + def test_works_on_windows(self): + """Label works on Windows.""" + entry = self._expand(["ci:cpu-test-only"], platform="windows", family="gfx110x") + self.assertEqual(entry["test-runs-on"], "") + + def test_label_disables_multi_gpu(self): + """Label also disables multi-GPU tests.""" + entry = self._expand(pr_labels=["ci:cpu-test-only"]) + self.assertNotIn("test-runs-on-multi-gpu", entry) + self.assertNotIn("test-runs-on-multi-gpu-labels", entry) + + def test_without_label_multi_gpu_present(self): + """Without label, multi-GPU info is present (when platform supports it).""" + entry = self._expand() + # gfx94x has multi-GPU support + self.assertIn("test-runs-on-multi-gpu-labels", entry) + + if __name__ == "__main__": unittest.main()