Files
TheRock/build_tools/github_actions/configure_target_run.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

99 lines
4.1 KiB
Python

# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
"""This file looks up the test-runs-on runner label for a given GPU family.
Environment variable inputs:
* 'TARGET': A GPU family like 'gfx95X-dcgpu' or 'gfx1151', corresponding
to a release index.
* 'PLATFORM': "linux" or "windows"
"""
import os
from amdgpu_family_matrix import get_all_families_for_trigger_types
from github_actions_api import *
def get_runner_label(target: str, platform: str) -> str:
print(f"Searching for a runner for target '{target}' on platform '{platform}'")
amdgpu_family_info_matrix = get_all_families_for_trigger_types(
["presubmit", "postsubmit"]
)
for key, info_for_key in amdgpu_family_info_matrix.items():
print(f"Cheecking key '{key}' with info:\n {info_for_key}")
platform_for_key = info_for_key.get(platform)
if not platform_for_key:
# Some AMDGPU families are only supported on certain platforms.
print(f" Skipping since this entry has no platform '{platform}'")
continue
# Check against both the inner "family" and the outer "key". If neither
# match then skip. Workflows are expected to use the inner "family"
# but manually triggered runs may use the outer "key" instead, so we'll
# be a bit lenient here.
# This needs a rework, see https://github.com/ROCm/TheRock/issues/1097.
family_for_platform = platform_for_key.get("family")
if target != family_for_platform and key not in target.lower():
print(
f" Skipping since the target '{target}' does not match the family '{family_for_platform}'"
)
continue
# If there is a test machine available for this target, run on it.
test_runs_on_machine = platform_for_key.get("test-runs-on")
if test_runs_on_machine:
print(f" Found runner: '{test_runs_on_machine}'")
return test_runs_on_machine
return ""
def get_upload_label(target: str, platform: str) -> str:
print(f"Searching for a runner for target '{target}' on platform '{platform}'")
amdgpu_family_info_matrix = get_all_families_for_trigger_types(
["presubmit", "postsubmit"]
)
for key, info_for_key in amdgpu_family_info_matrix.items():
print(f"Cheecking key '{key}' with info:\n {info_for_key}")
platform_for_key = info_for_key.get(platform)
if not platform_for_key:
# Some AMDGPU families are only supported on certain platforms.
print(f" Skipping since this entry has no platform '{platform}'")
continue
# Check against both the inner "family" and the outer "key". If neither
# match then skip. Workflows are expected to use the inner "family"
# but manually triggered runs may use the outer "key" instead, so we'll
# be a bit lenient here.
# This needs a rework, see https://github.com/ROCm/TheRock/issues/1097.
family_for_platform = platform_for_key.get("family")
if target != family_for_platform and key not in target.lower():
print(
f" Skipping since the target '{target}' does not match the family '{family_for_platform}'"
)
continue
# If there is no test machine available and bypass_tests_for_releases flag is True for GPU family and platform, output bypass_tests_for_releases as True
bypass_tests_for_releases = platform_for_key.get("bypass_tests_for_releases")
if bypass_tests_for_releases:
print(f" bypass_tests_for_releases: True")
return bypass_tests_for_releases
return ""
def main(target: str, platform: str):
runner_label = get_runner_label(target, platform)
if runner_label:
gha_set_output({"test-runs-on": runner_label})
upload_label = get_upload_label(target, platform)
if upload_label:
gha_set_output({"bypass_tests_for_releases": upload_label})
if __name__ == "__main__":
target = os.getenv("TARGET", "")
platform = os.getenv("PLATFORM", "")
main(target=target, platform=platform)