Skip to content

feat(rocprim) Replace index-based test filters in rtest.xml by names #8058

feat(rocprim) Replace index-based test filters in rtest.xml by names

feat(rocprim) Replace index-based test filters in rtest.xml by names #8058

# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# Multi-Arch CI for rocm-libraries
#
# This workflow replicates TheRock's multi-arch CI pipeline by calling
# TheRock's reusable workflows directly. It provides sharded, multi-stage
# builds with per-architecture testing.
#
# Key differences from therock-ci.yml:
# - Uses TheRock's multi-arch sharded build pipeline (foundation -> compiler-runtime -> math-libs)
# - Supports prebuilt stages to skip certain build stages
# - Better parallelization across GPU architectures
name: TheRock Multi-Arch CI
# TheRock ref: pinned to ROCm/TheRock commit df3d451a3c054e14705ddf94e58498e1208df8d5.
# NOTE: update all `@<ref>` refs and `ref:` inputs together when switching.
on:
push:
branches:
- develop
- release/therock-*
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
workflow_dispatch:
inputs:
linux_amdgpu_families:
type: string
description: "Insert comma-separated list of Linux GPU families to build and test. ex: gfx94X, gfx120X (empty = skip linux)"
default: ""
linux_test_labels:
type: string
description: "If enabled, reduce test set on Linux to the list of labels prefixed with 'test:'. ex: test:rocprim, test:hipcub"
default: ""
windows_amdgpu_families:
type: string
description: "Insert comma-separated list of Windows GPU families to build and test. ex: gfx94X, gfx120X (empty = skip windows)"
default: ""
windows_test_labels:
type: string
description: "If enabled, reduce test set on Windows to the list of labels prefixed with 'test:' ex: test:rocprim, test:hipcub"
default: ""
prebuilt_stages:
type: string
default: ""
description: "Comma-separated build stages to skip (or 'all' for all stages); artifacts are copied from baseline_run_id instead"
baseline_run_id:
type: string
default: ""
description: "Workflow run ID to copy prebuilt stage artifacts from; required when prebuilt_stages is set"
baseline_repository:
type: string
default: ""
description: "Repository to query for baseline_run_id. Defaults to github.repository for workflow_dispatch."
build_python_packages:
type: boolean
default: false
description: "Build ROCm Python packages"
build_pytorch:
type: boolean
default: false
description: "Build PyTorch wheels"
build_jax:
type: boolean
default: false
description: "Build JAX wheels"
build_native_linux:
type: boolean
default: false
description: "Build native Linux packages and run install tests"
permissions:
contents: read
actions: read
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
ci-env:
name: Load CI Environment
runs-on: ubuntu-24.04
outputs:
baseline-run-id: ${{ steps.ci-env.outputs.baseline-run-id }}
steps:
- name: Checkout ci-env action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github/actions/ci-env
sparse-checkout-cone-mode: true
- name: Load CI environment
id: ci-env
uses: ./.github/actions/ci-env
configure:
name: Configure Changed Projects
runs-on: ubuntu-24.04
outputs:
changed_projects: ${{ steps.configure.outputs.changed_projects }}
test_projects: ${{ steps.test-projects.outputs.test_projects }}
run_all_tests: ${{ steps.configure.outputs.run_all_tests }}
skip_tests: ${{ steps.configure.outputs.skip_tests }}
steps:
- name: Checkout repository config
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: |
.github/repos-config.json
.github/scripts/ci_utils.py
.github/scripts/multi_arch_test_projects.py
.github/scripts/therock_matrix.py
sparse-checkout-cone-mode: false
- name: Checkout TheRock for configure script
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ROCm/TheRock
ref: df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
path: _therock
sparse-checkout: build_tools/github_actions
sparse-checkout-cone-mode: true
- name: Configure CI
id: configure
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
python3 _therock/build_tools/github_actions/configure_external_repo_ci.py \
--event-name "${{ github.event_name }}" \
--github-repo "${{ github.repository }}" \
--base-sha "${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}" \
--head-sha "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" \
--config-path ".github/repos-config.json"
- name: Select multi-arch test projects
id: test-projects
run: |
python3 .github/scripts/multi_arch_test_projects.py \
--changed-projects "${{ steps.configure.outputs.changed_projects }}"
setup:
needs: [ci-env, configure]
uses: ROCm/TheRock/.github/workflows/setup_multi_arch.yml@df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
with:
build_variant: "release"
# Limit GPU families for rocm-libraries CI.
# gfx125X (CDNA5/gfx1250) is included build-only on every PR/push: no test
# hardware exists for it yet (see amdgpu_family_matrix.py in TheRock, family
# key "gfx125x": test-runs-on is empty everywhere), but legacy therock-ci.yml
# built it on every PR/push before Multi-Arch CI became the default, and this
# restores that parity so gfx1250 build breaks are caught same-PR instead of
# only nightly.
linux_amdgpu_families: ${{ inputs.linux_amdgpu_families || 'gfx94X,gfx950,gfx125X' }}
windows_amdgpu_families: ${{ inputs.windows_amdgpu_families || 'gfx110X' }}
linux_test_labels: ${{ inputs.linux_test_labels || '' }}
windows_test_labels: ${{ inputs.windows_test_labels || '' }}
# Copy all stages except math-libs and ml-libs from TheRock baseline
# rocm-libraries only affects math-libs and ml-libs source sets
# RPP owns cv-libs, so rebuild that stage when projects/rpp changes.
# Note: compiler-runtime excluded due to hardcoded CMake paths (fftw3, etc.)
# When baseline-run-id is empty, clear prebuilt_stages to force full rebuild
prebuilt_stages: ${{ inputs.prebuilt_stages || (needs.ci-env.outputs.baseline-run-id != '' && (contains(format(',{0},', needs.configure.outputs.changed_projects), ',projects/rpp,') && 'runtime-tests,comm-libs,storage-libs,debug-tools,dctools-core,profiler-apps,media-libs,wsl-rocdxg' || 'runtime-tests,comm-libs,cv-libs,storage-libs,debug-tools,dctools-core,profiler-apps,media-libs,wsl-rocdxg')) || '' }}
# Pull baseline run ID from ci-env (updated by assistant-librarian[bot] on submodule bumps)
baseline_run_id: ${{ inputs.baseline_run_id || needs.ci-env.outputs.baseline-run-id }}
baseline_repository: ${{ inputs.baseline_repository || (inputs.baseline_run_id != '' && github.repository) || '' }}
build_python_packages: ${{ inputs.build_python_packages || false }}
build_pytorch: ${{ inputs.build_pytorch || false }}
build_jax: ${{ inputs.build_jax || false }}
build_native_linux: ${{ inputs.build_native_linux || false }}
# Enable automatic stage reuse - TheRock finds commit-compatible baselines
# and determines which stages to rebuild based on changed files
stage_reuse_mode: reuse-stage
repository: ROCm/TheRock
ref: df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
# Pass external repo info for stage-impact analysis.
# extra_cmake_options is appended to the cmake configure line of every
# build stage, scoped to this repository's CI runs. TheRock keeps
# HIPKERNELPROVIDER_ENABLE_ROCKE OFF by default; enabling it here is what
# gives rocKE build and test signal while it is still in development.
# Keep the value constant: the flag state file participates in every
# subproject's configure fingerprint, and stage reuse does not key on
# flags (TheRock#3399), so a per-PR value would churn fingerprints and
# let baselines built with the opposite value look reusable.
external_repo: >-
{
"repository": "${{ github.repository }}",
"ref": "${{ github.sha }}",
"extra_cmake_options": "-DTHEROCK_FLAG_HIPKERNELPROVIDER_ENABLE_ROCKE=ON"
}
linux_build_and_test:
name: Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }}
needs: [configure, setup]
if: >-
${{
needs.setup.outputs.linux_build_config != '' &&
needs.setup.outputs.enable_build_jobs == 'true' &&
needs.configure.outputs.skip_tests != 'true'
}}
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_linux.yml@df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
secrets: inherit
with:
build_config: ${{ needs.setup.outputs.linux_build_config }}
test_labels: ${{ needs.setup.outputs.linux_test_labels }}
rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }}
rocm_deb_package_version: ${{ needs.setup.outputs.rocm_deb_package_version }}
rocm_rpm_package_version: ${{ needs.setup.outputs.rocm_rpm_package_version }}
test_type: ${{ needs.setup.outputs.test_type }}
external_repo_config: ${{ needs.setup.outputs.external_repo_config }}
# Empty string when run_all_tests=true triggers full test run in downstream workflow
changed_projects: ${{ needs.configure.outputs.run_all_tests == 'true' && '' || needs.configure.outputs.test_projects }}
repository: ROCm/TheRock
# Concrete SHA resolved once by setup; do not re-resolve main here.
ref: df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
permissions:
contents: read
id-token: write
windows_build_and_test:
name: Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }}
needs: [configure, setup]
if: >-
${{
needs.setup.outputs.windows_build_config != '' &&
needs.setup.outputs.enable_build_jobs == 'true' &&
needs.configure.outputs.skip_tests != 'true'
}}
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_windows.yml@df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
secrets: inherit
with:
build_config: ${{ needs.setup.outputs.windows_build_config }}
test_labels: ${{ needs.setup.outputs.windows_test_labels }}
rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }}
test_type: ${{ needs.setup.outputs.test_type }}
external_repo_config: ${{ needs.setup.outputs.external_repo_config }}
# Empty string when run_all_tests=true triggers full test run in downstream workflow
changed_projects: ${{ needs.configure.outputs.run_all_tests == 'true' && '' || needs.configure.outputs.test_projects }}
repository: ROCm/TheRock
# Concrete SHA resolved once by setup; do not re-resolve main here.
ref: df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
permissions:
contents: read
id-token: write
multi_arch_ci_summary:
name: Multi-Arch CI Summary
if: always()
needs:
- ci-env
- configure
- setup
- linux_build_and_test
- windows_build_and_test
runs-on: ubuntu-24.04
steps:
- name: Checkout TheRock repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: "ROCm/TheRock"
# Concrete SHA resolved once by setup; do not re-resolve main here.
ref: df3d451a3c054e14705ddf94e58498e1208df8d5 # 2026-09-08
sparse-checkout: build_tools/github_actions
sparse-checkout-cone-mode: true
- name: Evaluate workflow results
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
python build_tools/github_actions/workflow_summary.py \
--needs-json '${{ toJSON(needs) }}'