Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions .github/actions/rocprofiler-sdk-util/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: 'Path to ROCm installation'
required: false
default: '/opt/rocm'
python-venv-path:
description: 'Python virtual environment with the pinned cmake, relative to the workspace'
required: false
default: ''
gpu-target:
description: 'GPU target (e.g., gfx94X, gfx110X, gfx120X)'
required: true
Expand Down Expand Up @@ -37,6 +41,10 @@ inputs:
description: 'Enable ROCJPEG build'
required: false
default: 'false'
enable-hipfile-build:
description: 'Enable hipFILE build'
required: false
default: 'false'
enable-rocprof-trace-decoder-build:
description: 'Enable rocprof-trace-decoder build'
required: false
Expand Down Expand Up @@ -70,13 +78,6 @@ inputs:
runs:
using: 'composite'
steps:
- name: Setup environment variables
shell: bash
run: |
echo "PKG_CONFIG_PATH=/opt/amdgpu/lib64/pkgconfig:/opt/amdgpu/lib/pkgconfig:/opt/amdgpu/lib/$(uname -p)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${{ inputs.rocm-path }}/lib64:${{ inputs.rocm-path }}/lib:${{ inputs.rocm-path }}/llvm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "PATH=${{ inputs.rocm-path }}/bin:${{ inputs.rocm-path }}/llvm/bin:$HOME/.local/bin:${PATH}" >> $GITHUB_ENV

- name: Setup ccache
if: ${{ inputs.enable-ccache == 'true' }}
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
Expand All @@ -98,6 +99,16 @@ runs:
echo "Warning: Compiler launcher ${{ inputs.compiler-launcher }} not found or not executable"
fi

- name: Setup environment variables
shell: bash
run: |
if [ -n "${{ inputs.python-venv-path }}" ]; then
echo "${GITHUB_WORKSPACE}/${{ inputs.python-venv-path }}/bin" >> $GITHUB_PATH
fi
echo "PKG_CONFIG_PATH=/opt/amdgpu/lib64/pkgconfig:/opt/amdgpu/lib/pkgconfig:/opt/amdgpu/lib/$(uname -p)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${{ inputs.rocm-path }}/lib64:${{ inputs.rocm-path }}/lib:${{ inputs.rocm-path }}/llvm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "PATH=${{ inputs.rocm-path }}/bin:${{ inputs.rocm-path }}/llvm/bin:$HOME/.local/bin:${PATH}" >> $GITHUB_ENV

- name: Build and Install ROCR-Runtime
if: ${{ inputs.enable-rocr-build == 'true' }}
shell: bash
Expand Down Expand Up @@ -149,7 +160,7 @@ runs:
shell: bash
working-directory: projects/rocprofiler-register
run: |
export PATH=${{ inputs.rocm-path }}/bin:${{ inputs.rocm-path }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
export PATH=${{ inputs.rocm-path }}/bin:${{ inputs.rocm-path }}/llvm/bin:${PATH}:/usr/local/bin
echo "Install ROCProfiler-Register"
cmake -B build-rocprofiler-register \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
Expand All @@ -163,6 +174,40 @@ runs:
cmake --build build-rocprofiler-register --target install
echo "✅ ROCProfiler-Register Installation complete!"

- name: Build and Install hipFILE
if: ${{ inputs.enable-hipfile-build == 'true' }}
shell: bash
working-directory: projects/hipfile
run: |
export ROCM_PATH=${{ inputs.rocm-path }}
export HIP_PLATFORM=amd
export LD_LIBRARY_PATH=${{ inputs.rocm-path }}/lib:${{ inputs.rocm-path }}/lib/rocm_sysdeps/lib:${{ inputs.rocm-path }}/llvm/lib:$LD_LIBRARY_PATH
export PATH=${{ inputs.rocm-path }}/bin:${{ inputs.rocm-path }}/llvm/bin:${PATH}:/usr/local/bin
# Temporary workaround until hipFILE adds the ROCm sysdeps include path for libmount.
if [ -f "${ROCM_PATH}/lib/rocm_sysdeps/include/libmount/libmount.h" ]; then
install -D -m 0644 \
"${ROCM_PATH}/lib/rocm_sysdeps/include/libmount/libmount.h" \
"${ROCM_PATH}/include/libmount/libmount.h"
fi
echo "Install hipFILE..."
cmake -B build-hipfile \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER=${{ inputs.rocm-path }}/llvm/bin/amdclang++ \
-DCMAKE_HIP_PLATFORM=amd \
-DCMAKE_PREFIX_PATH='${{ inputs.rocm-path }};${{ inputs.rocm-path }}/llvm;${{ inputs.rocm-path }}/lib/rocm_sysdeps' \
-DCMAKE_LIBRARY_PATH=${{ inputs.rocm-path }}/lib/rocm_sysdeps/lib \
-DCMAKE_INCLUDE_PATH=${{ inputs.rocm-path }}/lib/rocm_sysdeps/include \
-DCMAKE_INSTALL_PREFIX=${{ inputs.rocm-path }} \
-DCMAKE_C_COMPILER_LAUNCHER=${{ inputs.compiler-launcher }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ inputs.compiler-launcher }} \
-DBUILD_TESTING=OFF \
-DAIS_INSTALL_EXAMPLES=OFF \
-DAIS_INSTALL_TOOLS=OFF \
.
cmake --build build-hipfile --target hipfile --parallel ${{ inputs.build-jobs }}
cmake --build build-hipfile --target install
echo "✅ hipFILE Installation complete!"

- name: Build and Install Aqlprofile
if: ${{ inputs.enable-aqlprofile-build == 'true' }}
shell: bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Resolve CI config
description: Resolve runner labels from ROCm/therock-ci-config
description: Resolve build and GPU runner labels from ROCm/therock-ci-config

inputs:
config-path:
Expand All @@ -14,14 +14,63 @@ inputs:
description: Sandbox runner label to use if the shared CI config cannot be loaded
required: false
default: linux-mi325-gpu-rocm-cpu-sandbox
fallback-gfx950-runner:
description: Runner label for gfx950 if the shared CI config cannot be loaded
required: false
default: linux-gfx950-1gpu-ccs-ossci-rocm
fallback-gfx90a-runner:
description: Runner label for gfx90a if the shared CI config cannot be loaded
required: false
default: linux-gfx90a-gpu-rocm
fallback-gfx103x-runner:
description: Runner label for gfx103x if the shared CI config cannot be loaded
required: false
default: linux-gfx1030-gpu-rocm
fallback-gfx110x-runner:
description: Runner label for gfx110x if the shared CI config cannot be loaded
required: false
default: linux-gfx110X-gpu-rocm
fallback-gfx120x-runner:
description: Runner label for gfx120x if the shared CI config cannot be loaded
required: false
default: linux-gfx120X-gpu-rocm
fallback-gfx1151-runner:
description: Runner label for gfx1151 if the shared CI config cannot be loaded
required: false
default: linux-gfx1151-gpu-rocm
fallback-linux-build-runner:
description: Linux build runner label if the shared CI config cannot be loaded
required: false
default: aws-linux-scale-rocm-prod

outputs:
linux_build_runner:
description: Linux CPU build runner label
value: ${{ steps.runner.outputs.linux_build_runner }}
gfx90a_runner:
description: Linux gfx90a test runner label
value: ${{ steps.runner.outputs.gfx90a_runner }}
gfx94x_runner:
description: Linux gfx94x test runner label
value: ${{ steps.runner.outputs.gfx94x_runner }}
gfx94x_sandbox_runner:
description: Linux gfx94x sandbox test runner label
value: ${{ steps.runner.outputs.gfx94x_sandbox_runner }}
gfx950_runner:
description: Linux gfx950 test runner label
value: ${{ steps.runner.outputs.gfx950_runner }}
gfx103x_runner:
description: Linux gfx103x (Navi 2x) test runner label
value: ${{ steps.runner.outputs.gfx103x_runner }}
gfx110x_runner:
description: Linux gfx110x (Navi 3x) test runner label
value: ${{ steps.runner.outputs.gfx110x_runner }}
gfx120x_runner:
description: Linux gfx120x (Navi 4x) test runner label
value: ${{ steps.runner.outputs.gfx120x_runner }}
gfx1151_runner:
description: Linux gfx1151 test runner label
value: ${{ steps.runner.outputs.gfx1151_runner }}

runs:
using: composite
Expand All @@ -41,4 +90,11 @@ runs:
CI_CONFIG_PATH: ${{ inputs.config-path }}
FALLBACK_GFX94X_RUNNER: ${{ inputs.fallback-gfx94x-runner }}
FALLBACK_GFX94X_SANDBOX_RUNNER: ${{ inputs.fallback-gfx94x-sandbox-runner }}
FALLBACK_GFX950_RUNNER: ${{ inputs.fallback-gfx950-runner }}
FALLBACK_GFX90A_RUNNER: ${{ inputs.fallback-gfx90a-runner }}
FALLBACK_GFX103X_RUNNER: ${{ inputs.fallback-gfx103x-runner }}
FALLBACK_GFX110X_RUNNER: ${{ inputs.fallback-gfx110x-runner }}
FALLBACK_GFX120X_RUNNER: ${{ inputs.fallback-gfx120x-runner }}
FALLBACK_GFX1151_RUNNER: ${{ inputs.fallback-gfx1151-runner }}
FALLBACK_LINUX_BUILD_RUNNER: ${{ inputs.fallback-linux-build-runner }}
run: python3 "${GITHUB_ACTION_PATH}/resolve_ci_config.py"
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,58 @@
from pathlib import Path
from typing import Any

GPU_FAMILIES = [
"gfx94x",
"gfx950",
"gfx90a",
"gfx103x",
"gfx110x",
"gfx120x",
"gfx1151",
]
TRIGGER_TYPES = ["presubmit", "postsubmit", "nightly"]


def warn(message: str) -> None:
print(f"::warning::{message}")


def load_gfx94x_linux_config(config_path: Path) -> dict[str, Any]:
def load_ci_configs(
config_path: Path,
) -> tuple[dict[str, dict[str, Any]], dict[str, Any]]:
if not config_path.exists():
warn("CI config checkout missing. Using fallback runner labels.")
return {}
return {}, {}

sys.path.insert(0, str(config_path))
try:
from ci_config_api import load_config_v1

config = load_config_v1(config_path)
return (
config.get_gpu_families(["presubmit"])
.get("gfx94x", {})
.get("linux", {})
)
all_families = config.get_gpu_families(TRIGGER_TYPES)
gpu_configs = {
family: all_families.get(family, {}).get("linux", {})
for family in GPU_FAMILIES
}
return gpu_configs, config.build_runners
except Exception as exc:
warn(f"Failed to load CI config: {exc}. Using fallback runner labels.")
return {}
return {}, {}


def load_gpu_configs(config_path: Path) -> dict[str, dict[str, Any]]:
return load_ci_configs(config_path)[0]


def get_linux_build_runner(build_runners: dict[str, Any], fallback: str) -> str:
return next(
(
runner["label"]
for runner in build_runners.get("linux", {}).get("default", [])
if runner.get("label") and runner.get("weight", 0) > 0
),
fallback,
)


def set_outputs(outputs: dict[str, str]) -> None:
Expand All @@ -40,23 +69,32 @@ def set_outputs(outputs: dict[str, str]) -> None:

def main() -> None:
config_path = Path(os.environ["CI_CONFIG_PATH"])
fallback_runner = os.environ["FALLBACK_GFX94X_RUNNER"]
fallback_sandbox_runner = os.environ["FALLBACK_GFX94X_SANDBOX_RUNNER"]
gpu_configs, build_runners = load_ci_configs(config_path)

gfx94x_linux_config = load_gfx94x_linux_config(config_path)
runner = gfx94x_linux_config.get("test-runs-on") or fallback_runner
sandbox_runner = (
gfx94x_linux_config.get("test-runs-on-sandbox") or fallback_sandbox_runner
outputs: dict[str, str] = {}
fallback_linux_build_runner = os.environ.get("FALLBACK_LINUX_BUILD_RUNNER", "")
linux_build_runner = get_linux_build_runner(
build_runners, fallback_linux_build_runner
)

print(f"Using gfx94x runner: {runner}")
outputs["linux_build_runner"] = linux_build_runner
print(f"Using Linux build runner: {linux_build_runner}")

for family in GPU_FAMILIES:
linux_config = gpu_configs.get(family, {})
fallback_env = f"FALLBACK_{family.upper()}_RUNNER"
fallback = os.environ.get(fallback_env, "")

runner = linux_config.get("test-runs-on") or fallback
outputs[f"{family}_runner"] = runner
print(f"Using {family} runner: {runner}")

fallback_sandbox = os.environ.get("FALLBACK_GFX94X_SANDBOX_RUNNER", "")
gfx94x_config = gpu_configs.get("gfx94x", {})
sandbox_runner = gfx94x_config.get("test-runs-on-sandbox") or fallback_sandbox
outputs["gfx94x_sandbox_runner"] = sandbox_runner
print(f"Using gfx94x sandbox runner: {sandbox_runner}")
set_outputs(
{
"gfx94x_runner": runner,
"gfx94x_sandbox_runner": sandbox_runner,
}
)

set_outputs(outputs)


if __name__ == "__main__":
Expand Down
Loading
Loading