diff --git a/.github/build_tools/configure_ci.py b/.github/build_tools/configure_ci.py new file mode 100644 index 000000000..7f29db93a --- /dev/null +++ b/.github/build_tools/configure_ci.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Configure CI matrix based on workflow inputs or defaults.""" +import os +import json + +# GPU target to TheRock family mapping +GPU_CONFIG_MAP = { + "gfx1100": "gfx110X-all", + "gfx90a": "gfx90X-dcgpu", + "gfx942": "gfx94X-dcgpu", +} + +# Default configurations for automated runs (push/PR) +DEFAULT_GPU_TARGETS = ["gfx1100"] +DEFAULT_INSTALL_METHODS = ["wheel", "tarball"] + + +def main(): + # Read inputs from environment (set by workflow) + gpu_input = os.getenv("GPU_CONFIG", "") + install_input = os.getenv("INSTALL_METHOD", "") + + # Determine GPU configurations + if gpu_input: + # Manual dispatch: use the single provided value + gpu_targets = [gpu_input] + else: + # Automated run: use all defaults + gpu_targets = DEFAULT_GPU_TARGETS + + # Determine install methods + if install_input: + # Manual dispatch: use the single provided value + install_methods = [install_input] + else: + # Automated run: use all defaults + install_methods = DEFAULT_INSTALL_METHODS + + # Build gpu_config array with both gpu_target and therock_family + gpu_configs = [] + for target in gpu_targets: + family = GPU_CONFIG_MAP.get(target, "gfx110X-all") + gpu_configs.append({ + "gpu_target": target, + "therock_family": family + }) + + # Write outputs to $GITHUB_OUTPUT + github_output = os.getenv("GITHUB_OUTPUT") + if github_output: + with open(github_output, "a") as f: + f.write(f"gpu_configs={json.dumps(gpu_configs)}\n") + f.write(f"install_methods={json.dumps(install_methods)}\n") + print(f"Wrote outputs to {github_output}") + else: + # Local testing + print(f"gpu_configs={json.dumps(gpu_configs)}") + print(f"install_methods={json.dumps(install_methods)}") + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/build_applications.yml b/.github/workflows/build_applications.yml index 010ffa006..114cfc560 100644 --- a/.github/workflows/build_applications.yml +++ b/.github/workflows/build_applications.yml @@ -12,6 +12,10 @@ on: - 'Applications/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.1.1' diff --git a/.github/workflows/build_applications_cuda.yml b/.github/workflows/build_applications_cuda.yml index 677a8d696..cbc98aba9 100644 --- a/.github/workflows/build_applications_cuda.yml +++ b/.github/workflows/build_applications_cuda.yml @@ -12,6 +12,10 @@ on: - 'Applications/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.0' diff --git a/.github/workflows/build_applications_vs.yml b/.github/workflows/build_applications_vs.yml index 6e6de6853..e1064e240 100644 --- a/.github/workflows/build_applications_vs.yml +++ b/.github/workflows/build_applications_vs.yml @@ -14,6 +14,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 1c95fec1c..f0088b65c 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -11,11 +11,15 @@ on: paths: - 'Dockerfiles/**' - '.github/workflows/**' - + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + jobs: find-dockerfiles: name: Find Dockerfiles - runs-on: self-hosted + runs-on: ubuntu-latest outputs: files: ${{ steps.find-files.outputs.files }} steps: diff --git a/.github/workflows/build_hip_basic.yml b/.github/workflows/build_hip_basic.yml index 3f8150b16..27783cb28 100644 --- a/.github/workflows/build_hip_basic.yml +++ b/.github/workflows/build_hip_basic.yml @@ -12,6 +12,10 @@ on: - 'HIP-Basic/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.1.1' diff --git a/.github/workflows/build_hip_basic_cuda.yml b/.github/workflows/build_hip_basic_cuda.yml index 80bf2676a..a5ec70b50 100644 --- a/.github/workflows/build_hip_basic_cuda.yml +++ b/.github/workflows/build_hip_basic_cuda.yml @@ -12,6 +12,10 @@ on: - 'HIP-Basic/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.0' diff --git a/.github/workflows/build_hip_basic_vs.yml b/.github/workflows/build_hip_basic_vs.yml index 29a38a567..2061b6c8a 100644 --- a/.github/workflows/build_hip_basic_vs.yml +++ b/.github/workflows/build_hip_basic_vs.yml @@ -14,6 +14,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_hip_documentation.yml b/.github/workflows/build_hip_documentation.yml index 8318cb610..f2d6def47 100644 --- a/.github/workflows/build_hip_documentation.yml +++ b/.github/workflows/build_hip_documentation.yml @@ -12,6 +12,10 @@ on: - 'HIP-Doc/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.1.1' diff --git a/.github/workflows/build_hip_documentation_cuda.yml b/.github/workflows/build_hip_documentation_cuda.yml index f84e2eac7..5eb195d42 100644 --- a/.github/workflows/build_hip_documentation_cuda.yml +++ b/.github/workflows/build_hip_documentation_cuda.yml @@ -12,6 +12,10 @@ on: - 'HIP-Doc/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.0' diff --git a/.github/workflows/build_hip_documentation_vs.yml b/.github/workflows/build_hip_documentation_vs.yml index e1a28a8d3..d6edeaa78 100644 --- a/.github/workflows/build_hip_documentation_vs.yml +++ b/.github/workflows/build_hip_documentation_vs.yml @@ -14,6 +14,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_libraries.yml b/.github/workflows/build_libraries.yml index e757dcd8a..ca2f1f461 100644 --- a/.github/workflows/build_libraries.yml +++ b/.github/workflows/build_libraries.yml @@ -12,6 +12,10 @@ on: - 'Libraries/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.1.1' diff --git a/.github/workflows/build_libraries_cuda.yml b/.github/workflows/build_libraries_cuda.yml index bcaf6f00c..5a7bc81cd 100644 --- a/.github/workflows/build_libraries_cuda.yml +++ b/.github/workflows/build_libraries_cuda.yml @@ -12,6 +12,10 @@ on: - 'Libraries/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.0' diff --git a/.github/workflows/build_libraries_vs.yml b/.github/workflows/build_libraries_vs.yml index 44542d8d9..b9f9e5f56 100644 --- a/.github/workflows/build_libraries_vs.yml +++ b/.github/workflows/build_libraries_vs.yml @@ -14,6 +14,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_portable_sln.yml b/.github/workflows/build_portable_sln.yml index 90c19b2a2..4790c8a5e 100644 --- a/.github/workflows/build_portable_sln.yml +++ b/.github/workflows/build_portable_sln.yml @@ -22,6 +22,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_programming_guide.yml b/.github/workflows/build_programming_guide.yml index 2370424ed..2590e9d64 100644 --- a/.github/workflows/build_programming_guide.yml +++ b/.github/workflows/build_programming_guide.yml @@ -12,6 +12,10 @@ on: - 'Programming-Guide/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.1.1' diff --git a/.github/workflows/build_programming_guide_cuda.yml b/.github/workflows/build_programming_guide_cuda.yml index ed8f21bbb..680521140 100644 --- a/.github/workflows/build_programming_guide_cuda.yml +++ b/.github/workflows/build_programming_guide_cuda.yml @@ -12,6 +12,10 @@ on: - 'Programming-Guide/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive ROCM_VERSION: '7.0' diff --git a/.github/workflows/build_programming_guide_vs.yml b/.github/workflows/build_programming_guide_vs.yml index 87e07656a..168c3e487 100644 --- a/.github/workflows/build_programming_guide_vs.yml +++ b/.github/workflows/build_programming_guide_vs.yml @@ -14,6 +14,10 @@ on: - '.github/workflows/**' - 'Scripts/VisualStudio/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: PLATFORM_TOOLSET_VERSION: 6.4 HIP_PATH: C:\Program Files\AMD\ROCm\6.4\ diff --git a/.github/workflows/build_tools.yml b/.github/workflows/build_tools.yml index 1500b84e9..f43cd8440 100644 --- a/.github/workflows/build_tools.yml +++ b/.github/workflows/build_tools.yml @@ -12,6 +12,10 @@ on: - 'Tools/**' - '.github/workflows/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: ROCM_VERSION: '7.1.1' AMDGPU_INSTALLER_VERSION: 7.1.1.70101-1 diff --git a/.github/workflows/ci_nightly.yml b/.github/workflows/ci_nightly.yml new file mode 100644 index 000000000..201ffe73d --- /dev/null +++ b/.github/workflows/ci_nightly.yml @@ -0,0 +1,188 @@ +name: Nightly CI + +on: + schedule: + # Run nightly at 2 AM UTC + - cron: '0 2 * * *' + pull_request: + branches: [ amd-staging, amd-mainline, release/** ] + paths: + - '.github/workflows/**' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +env: + DEBIAN_FRONTEND: noninteractive + +jobs: + build: + name: "SLES 15.7 - ${{ matrix.gpu_config.gpu_target }} - ${{ matrix.install_method }}" + runs-on: [self-hosted, Linux, "${{ matrix.gpu_config.therock_family }}"] + container: + # Base image with Python venv, GLFW, Vulkan SDK pre-installed + # ROCm installation delegated to workflow (wheel or tarball) + image: ghcr.io/sshi-amd/rocm-examples-base:sles15.7-rocm + options: + --group-add video + --device /dev/kfd + --device /dev/dri + --security-opt seccomp=unconfined + strategy: + fail-fast: false + matrix: + install_method: ['wheel', 'tarball'] + gpu_config: + - gpu_target: gfx1100 + therock_family: gfx110X-all + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install TheRock Python wheel + if: ${{ matrix.install_method == 'wheel' }} + shell: bash + run: | + pip install --no-cache-dir --index-url https://rocm.nightlies.amd.com/v2/${{ matrix.gpu_config.therock_family }}/ \ + "rocm[libraries,devel]" + + - name: Wheel sanity check + if: ${{ matrix.install_method == 'wheel' }} + id: sanity-check + shell: bash + run: | + ROCM_VERSION=$(rocm-sdk version) + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "## ROCm Version: $ROCM_VERSION" >> $GITHUB_STEP_SUMMARY + rocm-sdk init + rocm-sdk test + continue-on-error: true + + - name: Setup environment variables (wheel) + if: ${{ matrix.install_method == 'wheel' }} + shell: bash + run: | + ROCM_PATH=$(rocm-sdk path --root) + echo "ROCM_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PLATFORM=amd" >> $GITHUB_ENV + echo "HIP_DEVICE_LIB_PATH=$ROCM_PATH/lib/llvm/amdgcn/bitcode" >> $GITHUB_ENV + echo "PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH" >> $GITHUB_ENV + + - name: Install TheRock tarball + if: ${{ matrix.install_method == 'tarball' }} + id: install-tarball + shell: bash + run: | + LATEST_TARBALL=$(curl -s https://rocm.nightlies.amd.com/tarball/ | grep -oE "therock-dist-linux-${{ matrix.gpu_config.therock_family }}-[0-9]+\.[0-9]+\.\w+\.tar\.gz" | tail -1) + mkdir /therock-tarball && cd /therock-tarball + wget https://rocm.nightlies.amd.com/tarball/$LATEST_TARBALL + mkdir install + tar -xzf $LATEST_TARBALL -C install + + ROCM_VERSION=$(echo $LATEST_TARBALL | grep -oE "[0-9]+\.[0-9]+\.\w+") + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "## ROCm Version: $ROCM_VERSION" >> $GITHUB_STEP_SUMMARY + echo "## Tarball link: https://rocm.nightlies.amd.com/tarball/$LATEST_TARBALL" >> $GITHUB_STEP_SUMMARY + + - name: Setup environment variables (tarball) + if: ${{ matrix.install_method == 'tarball' }} + shell: bash + run: | + ROCM_PATH=/therock-tarball/install + echo "ROCM_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PLATFORM=amd" >> $GITHUB_ENV + echo "HIP_DEVICE_LIB_PATH=$ROCM_PATH/lib/llvm/amdgcn/bitcode" >> $GITHUB_ENV + echo "PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH" >> $GITHUB_ENV + + - name: CMake configure + shell: bash + run: | + cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DROCM_ROOT="$ROCM_PATH" -DCMAKE_BUILD_RPATH="$ROCM_PATH/lib" -Wno-dev 2> >(tee cmake_error.log >&2) + + - name: CMake configure error summary + if: ${{ !cancelled() }} + shell: bash + run: | + if [ ! -f cmake_error.log ]; then + exit 0 + fi + + echo "## CMake Configure" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Count warnings and errors + WARNINGS=$(grep -ci "warning" cmake_error.log || true) + ERRORS=$(grep -ci "error" cmake_error.log || true) + + echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY + echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| Warnings | $WARNINGS |" >> $GITHUB_STEP_SUMMARY + echo "| Errors | $ERRORS |" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Show details if there are warnings/errors + if [ -s cmake_error.log ]; then + echo "
CMake error log" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + cat cmake_error.log >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + else + echo "Clean configure - no warnings or errors" >> $GITHUB_STEP_SUMMARY + fi + + - name: CMake build + shell: bash + run: | + cmake --build build -j + + - name: Upload build artifacts + if: success() + uses: actions/upload-artifact@v4 + with: + name: rocm-examples-build-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }} + path: build/ + + - name: Run tests + shell: bash + run: | + ctest --test-dir build --output-on-failure 2>&1 | tee ctest_output.log + + - name: Test summary + if: ${{ !cancelled() }} + shell: bash + run: | + if [ ! -f ctest_output.log ]; then + exit 0 + fi + + # Generate summary + echo "## Test summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Parse test result + SUMMARY=$(grep "tests passed" ctest_output.log) + echo "**$SUMMARY**" >> $GITHUB_STEP_SUMMARY + + # Count passed/failed + FAILED=$(grep -c "Failed" ctest_output.log || true) + + # Show failed tests if any + if [ "$FAILED" -gt 0 ]; then + echo "
Failed tests output" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + # Extract failed test output + awk '/^[[:space:]]*Start[[:space:]]+[0-9]+:/ {found=0; next} /\*\*\*/ && !/Passed/ {found=1} found' ctest_output.log >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + fi diff --git a/.github/workflows/ci_therock.yml b/.github/workflows/ci_therock.yml new file mode 100644 index 000000000..1f9367b64 --- /dev/null +++ b/.github/workflows/ci_therock.yml @@ -0,0 +1,239 @@ +name: Build ROCm Examples + +on: + push: + branches: [ amd-staging, amd-mainline, release/** ] + paths: + - 'Applications/**' + - 'HIP-Basic/**' + - 'HIP-Doc/**' + - 'Libraries/**' + - 'Programming-Guide/**' + - 'Tools/**' + - 'Tutorials/**' + - 'Common/**' + - 'CMakeLists.txt' + - 'Makefile' + - '.github/workflows/**' + pull_request: + branches: [ amd-staging, amd-mainline, release/** ] + paths: + - 'Applications/**' + - 'HIP-Basic/**' + - 'HIP-Doc/**' + - 'Libraries/**' + - 'Programming-Guide/**' + - 'Tools/**' + - 'Tutorials/**' + - 'Common/**' + - 'CMakeLists.txt' + - 'Makefile' + - '.github/workflows/**' + workflow_dispatch: + inputs: + gpu_config: + description: "GPU configuration" + required: true + default: gfx1100 + type: string + install_method: + description: "Installation method" + required: true + default: wheel + type: choice + options: [wheel, tarball] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +env: + DEBIAN_FRONTEND: noninteractive + +jobs: + setup: + name: "Setup CI" + runs-on: ubuntu-latest + outputs: + gpu_configs: ${{ steps.config.outputs.gpu_configs }} + install_methods: ${{ steps.config.outputs.install_methods }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure CI + id: config + env: + GPU_CONFIG: ${{ github.event.inputs.gpu_config }} + INSTALL_METHOD: ${{ github.event.inputs.install_method }} + run: python3 .github/build_tools/configure_ci.py + + build: + name: "TheRock - ${{ matrix.gpu_config.gpu_target }} - ${{ matrix.install_method }}" + needs: [setup] + runs-on: [self-hosted, Linux, "${{ matrix.gpu_config.therock_family }}"] + container: + # Base image with Python venv, GLFW, Vulkan SDK pre-installed + # ROCm installation delegated to workflow (wheel or tarball) + image: ghcr.io/sshi-amd/rocm-examples-base:ubuntu22.04-rocm + options: + --group-add video + --device /dev/kfd + --device /dev/dri + --security-opt seccomp=unconfined + strategy: + fail-fast: false + matrix: + install_method: ${{ fromJson(needs.setup.outputs.install_methods) }} + gpu_config: ${{ fromJson(needs.setup.outputs.gpu_configs) }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install TheRock Python wheel + if: ${{ matrix.install_method == 'wheel' }} + shell: bash + run: | + pip install --no-cache-dir --index-url https://rocm.nightlies.amd.com/v2/${{ matrix.gpu_config.therock_family }}/ \ + "rocm[libraries,devel]" + + - name: Wheel sanity check + if: ${{ matrix.install_method == 'wheel' }} + id: sanity-check + shell: bash + run: | + ROCM_VERSION=$(rocm-sdk version) + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "## ROCm Version: $ROCM_VERSION" >> $GITHUB_STEP_SUMMARY + rocm-sdk init + rocm-sdk test + + - name: Setup environment variables (wheel) + if: ${{ matrix.install_method == 'wheel' }} + shell: bash + run: | + ROCM_PATH=$(rocm-sdk path --root) + echo "ROCM_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PLATFORM=amd" >> $GITHUB_ENV + echo "HIP_DEVICE_LIB_PATH=$ROCM_PATH/lib/llvm/amdgcn/bitcode" >> $GITHUB_ENV + echo "PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH" >> $GITHUB_ENV + + - name: Install TheRock tarball + if: ${{ matrix.install_method == 'tarball' }} + id: install-tarball + shell: bash + run: | + LATEST_TARBALL=$(curl -s https://rocm.nightlies.amd.com/tarball/ \ + | grep -oE "therock-dist-linux-${{ matrix.gpu_config.therock_family }}-[0-9]+\.[0-9]+\.\w+\.tar\.gz" \ + | sort -V \ + | tail -1) + mkdir /therock-tarball && cd /therock-tarball + wget "https://rocm.nightlies.amd.com/tarball/$LATEST_TARBALL" + mkdir install + tar -xzf "$LATEST_TARBALL" -C install + + ROCM_VERSION=$(echo $LATEST_TARBALL | grep -oE "[0-9]+\.[0-9]+\.\w+") + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "## ROCm Version: $ROCM_VERSION" >> $GITHUB_STEP_SUMMARY + echo "## Tarball link: https://rocm.nightlies.amd.com/tarball/$LATEST_TARBALL" >> $GITHUB_STEP_SUMMARY + + - name: Setup environment variables (tarball) + if: ${{ matrix.install_method == 'tarball' }} + shell: bash + run: | + ROCM_PATH=/therock-tarball/install + echo "ROCM_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PATH=$ROCM_PATH" >> $GITHUB_ENV + echo "HIP_PLATFORM=amd" >> $GITHUB_ENV + echo "HIP_DEVICE_LIB_PATH=$ROCM_PATH/lib/llvm/amdgcn/bitcode" >> $GITHUB_ENV + echo "PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH" >> $GITHUB_ENV + + - name: CMake configure + shell: bash + run: | + cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DROCM_ROOT="$ROCM_PATH" -DCMAKE_BUILD_RPATH="$ROCM_PATH/lib" -Wno-dev 2> >(tee cmake_error.log >&2) + + - name: CMake configure error summary + if: ${{ !cancelled() }} + shell: bash + run: | + if [ ! -f cmake_error.log ]; then + exit 0 + fi + + echo "## CMake Configure" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Count warnings and errors + WARNINGS=$(grep -ci "warning" cmake_error.log || true) + ERRORS=$(grep -ci "error" cmake_error.log || true) + + echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY + echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| Warnings | $WARNINGS |" >> $GITHUB_STEP_SUMMARY + echo "| Errors | $ERRORS |" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Show details if there are warnings/errors + if [ -s cmake_error.log ]; then + echo "
CMake error log" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + cat cmake_error.log >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + else + echo "Clean configure - no warnings or errors" >> $GITHUB_STEP_SUMMARY + fi + + - name: CMake build + shell: bash + run: | + cmake --build build -j + + - name: Upload build artifacts + if: success() + uses: actions/upload-artifact@v4 + with: + name: rocm-examples-build-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }} + path: build/ + + - name: Run tests + shell: bash + run: | + ctest --test-dir build --output-on-failure 2>&1 | tee ctest_output.log + + - name: Test summary + if: ${{ !cancelled() }} + shell: bash + run: | + if [ ! -f ctest_output.log ]; then + exit 0 + fi + + # Generate summary + echo "## Test summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Parse test result + SUMMARY=$(grep "tests passed" ctest_output.log) + echo "**$SUMMARY**" >> $GITHUB_STEP_SUMMARY + + # Count passed/failed + FAILED=$(grep -c "Failed" ctest_output.log || true) + + # Show failed tests if any + if [ "$FAILED" -gt 0 ]; then + echo "
Failed tests output" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + # Extract failed test output + awk '/^[[:space:]]*Start[[:space:]]+[0-9]+:/ {found=0; next} /\*\*\*/ && !/Passed/ {found=1} found' ctest_output.log >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "
" >> $GITHUB_STEP_SUMMARY + fi diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index a77ba6457..8581ef2d4 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,6 +12,10 @@ on: - amd-mainline - 'release/rocm-rel*' +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + env: DEBIAN_FRONTEND: noninteractive CLANG_FORMAT: /usr/lib/llvm-18/bin/clang-format diff --git a/Dockerfiles/sles-15.7-rocm.Dockerfile b/Dockerfiles/sles-15.7-rocm.Dockerfile new file mode 100644 index 000000000..b91603703 --- /dev/null +++ b/Dockerfiles/sles-15.7-rocm.Dockerfile @@ -0,0 +1,72 @@ +FROM registry.suse.com/suse/sle15:15.7 + +ARG VULKAN_SDK_VERSION=1.4.335.0 +ARG GLFW_VERSION=3.4 + +# GPU_TARGET and THEROCK_FAMILY are set at workflow runtime, not in the base image +ENV VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION} + +RUN zypper -qni update -y && \ + zypper -qni install -y \ + awk \ + unzip \ + xz \ + cmake \ + gcc \ + gcc-c++ \ + wget \ + git \ + curl \ + python313 \ + libdw-devel \ + Mesa-libGL-devel \ + wayland-devel \ + libxkbcommon-devel \ + libXcursor-devel \ + libXi-devel \ + libXinerama-devel \ + libXrandr-devel && \ + zypper clean -a + +# Build GLFW from source (not available in SLES repos) +WORKDIR /tmp +RUN wget https://github.com/glfw/glfw/releases/download/${GLFW_VERSION}/glfw-${GLFW_VERSION}.zip && \ + unzip glfw-${GLFW_VERSION}.zip && \ + cmake -S glfw-${GLFW_VERSION} -B glfw-${GLFW_VERSION}/build \ + -DGLFW_BUILD_EXAMPLES=OFF \ + -DGLFW_BUILD_TESTS=OFF \ + -DGLFW_BUILD_DOCS=OFF && \ + cmake --build glfw-${GLFW_VERSION}/build --target install && \ + rm -rf /tmp/glfw-${GLFW_VERSION}* + +# Install Vulkan SDK +ENV VULKAN_SDK=/opt/vulkan-sdk/${VULKAN_SDK_VERSION}/x86_64 +RUN mkdir -p /opt/vulkan-sdk && \ + wget https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \ + tar -xvf vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz -C /opt/vulkan-sdk && \ + rm vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz + +ENV PATH="${VULKAN_SDK}/bin:${PATH}" +ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib" +ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d" +ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig" + +ENV HIP_PLATFORM=amd + +# ============================================================================ +# Python virtual environment (ready for ROCm wheel or tarball installation) +# ROCm installation is delegated to the CI workflow to support both methods +# ============================================================================ + +# Create virtual environment with base packages +RUN python3.13 -m venv /opt/venv && \ + /opt/venv/bin/pip install --upgrade pip && \ + /opt/venv/bin/pip install pyyaml cmake + +# Set up virtual environment in PATH +ENV PATH="/opt/venv/bin:${PATH}" +ENV VIRTUAL_ENV="/opt/venv" + +WORKDIR /workspace + +CMD ["/bin/bash"] diff --git a/Dockerfiles/ubuntu-22.04-rocm.Dockerfile b/Dockerfiles/ubuntu-22.04-rocm.Dockerfile new file mode 100644 index 000000000..a4542998e --- /dev/null +++ b/Dockerfiles/ubuntu-22.04-rocm.Dockerfile @@ -0,0 +1,42 @@ +FROM ubuntu:22.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# GPU_TARGET and THEROCK_FAMILY are set at workflow runtime, not in the base image + +# Install system dependencies +RUN apt-get update -qq && \ + apt-get install -y \ + git \ + wget \ + curl \ + xz-utils \ + build-essential \ + python3.11 \ + python3.11-venv \ + libdw-dev \ + libglfw3-dev \ + libvulkan-dev \ + glslang-tools \ + libtiff-dev \ + libopencv-dev && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# ============================================================================ +# Python virtual environment (ready for ROCm wheel or tarball installation) +# ROCm installation is delegated to the CI workflow to support both methods +# ============================================================================ + +ENV VIRTUAL_ENV=/opt/venv +RUN python3.11 -m venv ${VIRTUAL_ENV} +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" + +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir pyyaml cmake + +ENV HIP_PLATFORM=amd + +WORKDIR /workspace + +CMD ["/bin/bash"]