diff --git a/.github/workflows/multi_arch_ci.yml b/.github/workflows/multi_arch_ci.yml index 8da1b44d215..3c2765517d7 100644 --- a/.github/workflows/multi_arch_ci.yml +++ b/.github/workflows/multi_arch_ci.yml @@ -86,6 +86,7 @@ jobs: test_labels: ${{ needs.setup.outputs.linux_test_labels }} rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }} test_type: ${{ needs.setup.outputs.test_type }} + run_extended_tests: ${{ needs.setup.outputs.run_extended_tests }} permissions: contents: read id-token: write @@ -105,6 +106,7 @@ jobs: test_labels: ${{ needs.setup.outputs.windows_test_labels }} rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }} test_type: ${{ needs.setup.outputs.test_type }} + run_extended_tests: ${{ needs.setup.outputs.run_extended_tests }} permissions: contents: read id-token: write diff --git a/.github/workflows/multi_arch_ci_linux.yml b/.github/workflows/multi_arch_ci_linux.yml index e684cee5c73..3e2a3b512f4 100644 --- a/.github/workflows/multi_arch_ci_linux.yml +++ b/.github/workflows/multi_arch_ci_linux.yml @@ -20,6 +20,9 @@ on: type: string test_type: type: string + run_extended_tests: + type: string + default: 'false' release_type: description: 'Release type: "" for CI, or "dev", "nightly", "prerelease".' type: string @@ -105,15 +108,18 @@ jobs: matrix: family_info: ${{ fromJSON(inputs.build_config).per_family_info }} uses: ./.github/workflows/test_artifacts.yml + secrets: inherit with: # Use architecture-specific artifact group for fetching per-arch artifacts artifact_group: ${{ matrix.family_info.amdgpu_family }} amdgpu_families: ${{ matrix.family_info.amdgpu_family }} amdgpu_targets: ${{ matrix.family_info.amdgpu_targets }} test_runs_on: ${{ matrix.family_info.test-runs-on }} + benchmark_runs_on: ${{ matrix.family_info.benchmark-runs-on }} test_type: ${{ inputs.test_type }} test_labels: ${{ inputs.test_labels }} sanity_check_only_for_family: ${{ matrix.family_info.sanity_check_only_for_family }} + run_extended_tests: ${{ inputs.run_extended_tests }} release_type: ${{ inputs.release_type }} build_python_packages: diff --git a/.github/workflows/multi_arch_ci_windows.yml b/.github/workflows/multi_arch_ci_windows.yml index b9ea035b174..b2ce807f624 100644 --- a/.github/workflows/multi_arch_ci_windows.yml +++ b/.github/workflows/multi_arch_ci_windows.yml @@ -20,6 +20,9 @@ on: type: string test_type: type: string + run_extended_tests: + type: string + default: 'false' release_type: description: 'Release type: "" for CI, or "dev", "nightly", "prerelease".' type: string @@ -110,15 +113,18 @@ jobs: matrix: family_info: ${{ fromJSON(inputs.build_config).per_family_info }} uses: ./.github/workflows/test_artifacts.yml + secrets: inherit with: # Use architecture-specific artifact group for fetching per-arch artifacts artifact_group: ${{ matrix.family_info.amdgpu_family }} amdgpu_families: ${{ matrix.family_info.amdgpu_family }} amdgpu_targets: ${{ matrix.family_info.amdgpu_targets }} test_runs_on: ${{ matrix.family_info.test-runs-on }} + benchmark_runs_on: ${{ matrix.family_info.benchmark-runs-on }} test_type: ${{ inputs.test_type }} test_labels: ${{ inputs.test_labels }} sanity_check_only_for_family: ${{ matrix.family_info.sanity_check_only_for_family }} + run_extended_tests: ${{ inputs.run_extended_tests }} release_type: ${{ inputs.release_type }} build_python_packages: diff --git a/.github/workflows/setup_multi_arch.yml b/.github/workflows/setup_multi_arch.yml index 29892a20907..fb4cfb56d9f 100644 --- a/.github/workflows/setup_multi_arch.yml +++ b/.github/workflows/setup_multi_arch.yml @@ -74,6 +74,9 @@ on: rocm_package_version: description: ROCm package version (primarily for Python packages). value: ${{ jobs.setup.outputs.rocm_package_version }} + run_extended_tests: + description: "Boolean string ('true'/'false') controlling extended test enablement (functional + benchmarks)." + value: ${{ jobs.setup.outputs.run_extended_tests }} permissions: contents: read @@ -89,6 +92,7 @@ jobs: linux_test_labels: ${{ steps.configure.outputs.linux_test_labels }} windows_test_labels: ${{ steps.configure.outputs.windows_test_labels }} rocm_package_version: ${{ steps.rocm_package_version.outputs.rocm_package_version }} + run_extended_tests: ${{ steps.configure.outputs.run_extended_tests }} steps: - name: Checking out repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/build_tools/github_actions/configure_multi_arch_ci.py b/build_tools/github_actions/configure_multi_arch_ci.py index 5e58c00dc45..5bc1a8c8707 100755 --- a/build_tools/github_actions/configure_multi_arch_ci.py +++ b/build_tools/github_actions/configure_multi_arch_ci.py @@ -368,9 +368,7 @@ class TestRocmDecision(JobGroupDecision): test_type: str = "quick" test_type_reason: str = "default" - # TODO: Consolidate test_type, test labels, and run_functional_tests - # (from the single-arch pipeline) into a per-platform test config object - # (e.g. linux_test_config JSON) instead of separate top-level outputs. + run_extended_tests: bool = False @dataclass(frozen=True) @@ -603,10 +601,14 @@ def decide_jobs( ci_inputs=ci_inputs, git_context=git_context, ) + run_extended_tests = ci_inputs.is_schedule or ( + ci_inputs.is_workflow_dispatch and _has_test_labels(ci_inputs) + ) test_rocm = TestRocmDecision( action=JobAction.RUN, test_type=test_type, test_type_reason=test_type_reason, + run_extended_tests=run_extended_tests, ) # Other jobs run unconditionally with no configuration. @@ -871,6 +873,7 @@ def _expand_build_config_for_platform( "amdgpu_family": platform_info["family"], "amdgpu_targets": ",".join(platform_info["fetch-gfx-targets"]), "test-runs-on": test_runs_on, + "benchmark-runs-on": platform_info.get("benchmark-runs-on", ""), "sanity_check_only_for_family": platform_info.get( "sanity_check_only_for_family", False ), @@ -967,12 +970,16 @@ def write_outputs( linux = outputs.builds.linux windows = outputs.builds.windows test_type = outputs.jobs.test_rocm.test_type if outputs.is_ci_enabled else "" + run_extended_tests = ( + outputs.jobs.test_rocm.run_extended_tests if outputs.is_ci_enabled else False + ) output_vars = { # Workflow YAML references this as 'enable_build_jobs' "enable_build_jobs": json.dumps(outputs.is_ci_enabled), "linux_build_config": json.dumps(linux.to_dict()) if linux else "", "windows_build_config": json.dumps(windows.to_dict()) if windows else "", "test_type": test_type, + "run_extended_tests": json.dumps(run_extended_tests), "linux_test_labels": outputs.linux_test_labels, "windows_test_labels": outputs.windows_test_labels, } diff --git a/build_tools/github_actions/configure_multi_arch_ci_summary.py b/build_tools/github_actions/configure_multi_arch_ci_summary.py index d747ea5309e..1e8fb2db80e 100644 --- a/build_tools/github_actions/configure_multi_arch_ci_summary.py +++ b/build_tools/github_actions/configure_multi_arch_ci_summary.py @@ -209,6 +209,10 @@ def _append_test_rocm(lines: list[str], outputs: CIOutputs) -> None: lines.append( f"Test level: **{test_rocm.test_type}** ({test_rocm.test_type_reason})" ) + lines.append( + f"Extended tests (functional + benchmarks): " + f"**{'enabled' if test_rocm.run_extended_tests else 'disabled'}**" + ) # Component test labels (per platform) if outputs.linux_test_labels: 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 a4543e06335..b2785fd44b9 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 @@ -359,6 +359,48 @@ def test_build_rocm_stage_partitioning(self): ) self.assertEqual(decision.rebuild_stages, ["math-libs"]) + # -- run_extended_tests determination -- + + def test_schedule_enables_extended_tests(self): + """Schedule trigger → run_extended_tests True.""" + result = cm.decide_jobs( + self._inputs(event_name="schedule"), git_context=cm.GitContext() + ) + self.assertTrue(result.test_rocm.run_extended_tests) + + def test_workflow_dispatch_with_labels_enables_extended_tests(self): + """workflow_dispatch with test labels → run_extended_tests True.""" + result = cm.decide_jobs( + self._inputs( + event_name="workflow_dispatch", + linux_test_labels=["test:rocprim"], + ), + git_context=cm.GitContext(), + ) + self.assertTrue(result.test_rocm.run_extended_tests) + + def test_workflow_dispatch_without_labels_disables_extended_tests(self): + """workflow_dispatch without test labels → run_extended_tests False.""" + result = cm.decide_jobs( + self._inputs(event_name="workflow_dispatch"), + git_context=cm.GitContext(), + ) + self.assertFalse(result.test_rocm.run_extended_tests) + + def test_pr_disables_extended_tests(self): + """pull_request → run_extended_tests False.""" + result = cm.decide_jobs( + self._inputs(event_name="pull_request"), git_context=cm.GitContext() + ) + self.assertFalse(result.test_rocm.run_extended_tests) + + def test_push_disables_extended_tests(self): + """push → run_extended_tests False.""" + result = cm.decide_jobs( + self._inputs(event_name="push"), git_context=cm.GitContext() + ) + self.assertFalse(result.test_rocm.run_extended_tests) + # --------------------------------------------------------------------------- # Step 4: Select Targets @@ -713,6 +755,7 @@ def test_release_produces_configs_for_both_platforms(self): "amdgpu_family", "amdgpu_targets", "test-runs-on", + "benchmark-runs-on", "sanity_check_only_for_family", } for config in [result.linux, result.windows]: @@ -822,6 +865,21 @@ def test_no_test_runner_label_uses_default(self): self.assertNotEqual(entry["test-runs-on"], "linux-gfx1151-gpu-rocm") self.assertNotIn("oem", entry["test-runs-on"]) + def test_benchmark_runs_on_key_always_emitted(self): + """benchmark-runs-on key is present (as a string) even when the matrix entry omits it. + + gfx94x has benchmark-runs-on in the matrix; gfx110x does not. + expand_build_configs must emit the key for both, defaulting to ''. + """ + targets = cm.TargetSelection(linux_families=["gfx94x", "gfx110x"]) + result = cm.expand_build_configs( + targets=targets, ci_inputs=self._inputs(), test_type="quick" + ) + self.assertIsNotNone(result.linux) + for entry in result.linux.per_family_info: + self.assertIn("benchmark-runs-on", entry) + self.assertIsInstance(entry["benchmark-runs-on"], str) + # --------------------------------------------------------------------------- # Step 6: Format Outputs @@ -869,6 +927,39 @@ def test_skipped_ci_write_outputs_summary(self): outputs = cm.CIOutputs(is_ci_enabled=False) cm.write_outputs(self._inputs(), outputs) + def test_write_outputs_emits_run_extended_tests(self): + """write_outputs serialises run_extended_tests bool as 'true'/'false' string.""" + jobs = cm.JobDecisions( + build_rocm=cm.BuildRocmDecision(action=cm.JobAction.RUN), + test_rocm=cm.TestRocmDecision( + action=cm.JobAction.RUN, + test_type="comprehensive", + run_extended_tests=True, + ), + build_rocm_python=cm.JobGroupDecision(action=cm.JobAction.RUN), + build_pytorch=cm.JobGroupDecision(action=cm.JobAction.RUN), + test_pytorch=cm.JobGroupDecision(action=cm.JobAction.RUN), + ) + outputs = cm.CIOutputs(is_ci_enabled=True, jobs=jobs) + captured = {} + with patch( + "configure_multi_arch_ci.gha_set_output", + side_effect=lambda v: captured.update(v), + ): + cm.write_outputs(self._inputs(), outputs) + self.assertEqual(captured["run_extended_tests"], "true") + + def test_write_outputs_skipped_ci_extended_tests_false(self): + """Skipped CI emits run_extended_tests='false'.""" + outputs = cm.CIOutputs(is_ci_enabled=False) + captured = {} + with patch( + "configure_multi_arch_ci.gha_set_output", + side_effect=lambda v: captured.update(v), + ): + cm.write_outputs(self._inputs(), outputs) + self.assertEqual(captured["run_extended_tests"], "false") + # --------------------------------------------------------------------------- # End-to-end: configure() pipeline @@ -901,6 +992,32 @@ def test_pipeline_skips_when_gate_says_skip(self, mock_skip): self.assertFalse(outputs.is_ci_enabled) self.assertIsNone(outputs.builds.linux) + def test_schedule_pipeline_enables_extended_tests(self): + """Schedule trigger through full pipeline → run_extended_tests True.""" + inputs = cm.CIInputs( + run_id="12345", + event_name="schedule", + commit_ref="main", + base_ref="HEAD^1", + build_variant="release", + ) + outputs = cm.configure(inputs, cm.GitContext()) + self.assertTrue(outputs.is_ci_enabled) + self.assertTrue(outputs.jobs.test_rocm.run_extended_tests) + + def test_pr_pipeline_disables_extended_tests(self): + """PR trigger through full pipeline → run_extended_tests False.""" + inputs = cm.CIInputs( + run_id="12345", + event_name="pull_request", + commit_ref="feature", + base_ref="HEAD^1", + build_variant="release", + ) + outputs = cm.configure(inputs, cm.GitContext()) + self.assertTrue(outputs.is_ci_enabled) + self.assertFalse(outputs.jobs.test_rocm.run_extended_tests) + # --------------------------------------------------------------------------- # Contract: BuildConfig fields match workflow YAML references