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
39 changes: 39 additions & 0 deletions .github/scripts/therock_configure_ci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
This script determines which build flag and tests to run based on SUBTREES

Required environment variables:
- SUBTREES
"""

import json
from therock_matrix import monorepo_map
from typing import Mapping
import os

SUBTREES = os.getenv("SUBTREES", "")


def set_github_output(d: Mapping[str, str]):
"""Sets GITHUB_OUTPUT values.
See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs
"""
print(f"Setting github output:\n{d}")
step_output_file = os.environ.get("GITHUB_OUTPUT", "")
if not step_output_file:
print("Warning: GITHUB_OUTPUT env var not set, can't set github outputs")
return
with open(step_output_file, "a") as f:
f.writelines(f"{k}={v}" + "\n" for k, v in d.items())


def run():
subtrees = SUBTREES.split("\n")
projects = []
for subtree in subtrees:
if subtree in monorepo_map:
projects.append(monorepo_map.get(subtree))
set_github_output({"projects": json.dumps(projects)})


if __name__ == "__main__":
run()
9 changes: 9 additions & 0 deletions .github/scripts/therock_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
This dictionary is used to map specific file directory changes to the corresponding build flag and tests
"""
monorepo_map = {
"projects/rocprim": {
"cmake_options": "-DTHEROCK_ENABLE_PRIM=ON -DTHEROCK_ENABLE_ALL=OFF",
"project_to_test": "test_rocprim",
}
}
34 changes: 34 additions & 0 deletions .github/workflows/therock-ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: TheRock CI
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is shared with therock-ci.yml so https://github.com/ROCm/rocm-libraries/actions shows two actions with the same name:
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack! good catch, will update in one of the PRs


on:
workflow_call:
inputs:
cmake_options:
type: string
project_to_test:
type: string

permissions:
contents: read

jobs:
therock-build-linux:
name: Build Linux Packages
permissions:
contents: read
id-token: write
uses: ROCm/TheRock/.github/workflows/build_linux_packages.yml@866f163742246445138d7addff8a4010e86bddee
with:
amdgpu_families: "gfx94X-dcgpu"
expect_failure: false
extra_cmake_options: "-DTHEROCK_USE_EXTERNAL_ROCM_LIBRARIES=ON -DTHEROCK_ROCM_LIBRARIES_SOURCE_DIR=rocm-libraries ${{ inputs.cmake_options }}"

therock-test-linux:
name: "Test"
needs: [therock-build-linux]
uses: ./.github/workflows/therock-test-packages.yml
with:
project_to_test: ${{ inputs.project_to_test }}
amdgpu_families: "gfx94X-dcgpu"
test_runs_on: "linux-mi300-1gpu-ossci-rocm"
platform: "linux"
50 changes: 22 additions & 28 deletions .github/workflows/therock-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ jobs:
name: "Setup"
runs-on: ubuntu-24.04
outputs:
jobs: ${{ steps.jobs.outputs.jobs }}
projects: ${{ steps.projects.outputs.projects }}
steps:
# Checkout the mono-repo which includes the PR.
- name: Checkout rocm-libraries Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: rocm-libraries

- name: Checkout TheRock Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"
path: "TheRock"
ref: a742718b33993332131863885a621fceef6f9b48
# # will be needed for `patch_monorepo.py` but necessary now
# - name: Checkout TheRock Repository
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# with:
# repository: "ROCm/TheRock"
# path: "TheRock"
# ref: 0730cccf8b98e012d64750f26032bd760360fa45

- name: Generate a token
id: generate-token
Expand Down Expand Up @@ -77,32 +78,25 @@ jobs:
--pr "${{ github.event.pull_request.number }}" \
--config "rocm-libraries/.github/repos-config.json"

- name: Determine jobs to run
id: jobs
- name: Determine projects to run
id: projects
env:
SUBTREES: ${{ steps.detect.outputs.subtrees }}
run: |
python ./TheRock/build_tools/github_actions/monorepo_configure_ci.py
python rocm-libraries/.github/scripts/therock_configure_ci.py

therock-build-linux:
name: Build Linux Packages
needs: setup
if: ${{ needs.setup.outputs.jobs != '[]' }}
therock-ci-linux:
name: TheRock CI Linux
permissions:
contents: read
id-token: write
uses: ROCm/TheRock/.github/workflows/build_linux_packages.yml@a742718b33993332131863885a621fceef6f9b48
with:
amdgpu_families: "gfx94X-dcgpu"
expect_failure: false
extra_cmake_options: "-DTHEROCK_USE_EXTERNAL_ROCM_LIBRARIES=ON -DTHEROCK_ROCM_LIBRARIES_SOURCE_DIR=rocm-libraries -DTHEROCK_ENABLE_PRIM=ON -DTHEROCK_ENABLE_ALL=OFF"

therock-test-linux:
name: "rocPRIM math-lib test"
needs: therock-build-linux
uses: ROCm/TheRock/.github/workflows/test_rocprim.yml@a742718b33993332131863885a621fceef6f9b48
needs: setup
if: ${{ needs.setup.outputs.projects != '[]' }}
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.setup.outputs.projects) }}
uses: ./.github/workflows/therock-ci-linux.yml
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: "gfx94X-dcgpu"
test_runs_on: "linux-mi300-1gpu-ossci-rocm"
platform: "linux"
cmake_options: ${{ matrix.projects.cmake_options }}
project_to_test: ${{ matrix.projects.project_to_test }}
69 changes: 69 additions & 0 deletions .github/workflows/therock-test-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: TheRock Test Packages

on:
workflow_call:
inputs:
project_to_test:
type: string
amdgpu_families:
type: string
test_runs_on:
type: string
platform:
type: string

permissions:
contents: read

jobs:
# BLAS tests
test_hipblaslt:
name: "hipBLASLt math-lib"
if: ${{ inputs.project_to_test == 'test_hipblaslt' }}
uses: ROCm/TheRock/.github/workflows/test_hipblaslt.yml@866f163742246445138d7addff8a4010e86bddee
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: ${{ inputs.amdgpu_families }}
test_runs_on: ${{ inputs.test_runs_on }}
platform: ${{ inputs.platform }}

test_rocblas:
name: "rocBLAS math-lib"
if: ${{ inputs.project_to_test == 'test_rocblas' }}
uses: ROCm/TheRock/.github/workflows/test_rocblas.yml@866f163742246445138d7addff8a4010e86bddee
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: ${{ inputs.amdgpu_families }}
test_runs_on: ${{ inputs.test_runs_on }}
platform: ${{ inputs.platform }}

# PRIM tests
test_rocprim:
name: "rocPRIM math-lib"
if: ${{ inputs.project_to_test == 'test_rocprim' }}
uses: ROCm/TheRock/.github/workflows/test_rocprim.yml@866f163742246445138d7addff8a4010e86bddee
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: ${{ inputs.amdgpu_families }}
test_runs_on: ${{ inputs.test_runs_on }}
platform: ${{ inputs.platform }}

test_rocthrust:
name: "rocTHRUST math-lib"
if: ${{ inputs.project_to_test == 'test_rocthrust' }}
uses: ROCm/TheRock/.github/workflows/test_rocthrust.yml@866f163742246445138d7addff8a4010e86bddee
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: ${{ inputs.amdgpu_families }}
test_runs_on: ${{ inputs.test_runs_on }}
platform: ${{ inputs.platform }}

test_hipcub:
name: "hipCUB math-lib"
if: ${{ inputs.project_to_test == 'test_hipcub' }}
uses: ROCm/TheRock/.github/workflows/test_hipcub.yml@866f163742246445138d7addff8a4010e86bddee
with:
artifact_run_id: "${{ github.run_id }}"
amdgpu_families: ${{ inputs.amdgpu_families }}
test_runs_on: ${{ inputs.test_runs_on }}
platform: ${{ inputs.platform }}
Loading