Skip to content
Merged
428 changes: 428 additions & 0 deletions .github/scripts/run_rocjitsu_hipblaslt_race_check.sh

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions .github/scripts/tests/therock_configure_ci_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,20 @@ def test_retrieve_projects_runs_ci_for_workflow_paths(self, mock_get_modified):
{"is_pull_request": True, "base_ref": "HEAD^"}
)

# Changes to the shared TheRock CI machinery intentionally expand the
# product matrix to every project. The rocjitsu marker must still follow
# the hipBLASLt subtree through dependency folding and attach to exactly
# one final row; otherwise a workflow-only PR could launch duplicate
# instrumentation jobs for unrelated projects.
rocjitsu_rows = [
project for project in projects if project["run_rocjitsu_race_check"]
]
self.assertGreaterEqual(len(projects), 3)
self.assertEqual(len(rocjitsu_rows), 1)
self.assertIn(
"tensilelite",
rocjitsu_rows[0]["projects_to_test"].split(","),
)
self.assertEqual(test_type, "quick")

def test_parse_test_labels_single_project(self):
Expand All @@ -290,6 +303,23 @@ def test_retrieve_projects_with_test_label(self, mock_get_modified):

self.assertGreater(len(projects), 0)
self.assertIn("BLAS", str(projects))
self.assertFalse(
any(project["run_rocjitsu_race_check"] for project in projects)
)
self.assertEqual(test_type, "standard")

@patch("therock_configure_ci.get_modified_paths")
def test_retrieve_projects_hipblaslt_label_enables_rocjitsu(
self, mock_get_modified
):
mock_get_modified.return_value = []

pr_labels_json = '{"labels": [{"name": "test:hipblaslt"}]}'
projects, test_type = therock_configure_ci.retrieve_projects(
{"is_pull_request": True, "base_ref": "HEAD^", "pr_labels": pr_labels_json}
)

self.assertTrue(any(project["run_rocjitsu_race_check"] for project in projects))
self.assertEqual(test_type, "standard")

@patch("therock_configure_ci.get_modified_paths")
Expand Down
38 changes: 38 additions & 0 deletions .github/scripts/tests/therock_matrix_test.py
Comment thread
newling marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,44 @@ def test_collect_projects_to_run_without_additional_option(self):
"hipsparselt",
blas_entry["projects_to_test"].split(","),
)
self.assertTrue(blas_entry["run_rocjitsu_race_check"])

def test_rocjitsu_race_check_does_not_run_for_rocblas_only(self):
project_to_run = therock_matrix.collect_projects_to_run(["projects/rocblas"])
self.assertEqual(len(project_to_run), 1)
self.assertFalse(project_to_run[0]["run_rocjitsu_race_check"])

def test_rocjitsu_race_check_does_not_run_for_provider_rows(self):
# These rows exercise the names that motivated the explicit selection
# marker. In particular, `hipblasltprovider` must not match merely
# because it contains the `hipblaslt` substring.
provider_subtrees = [
"dnn-providers/hipblaslt-provider",
"dnn-providers/hip-kernel-provider",
]

for subtree in provider_subtrees:
with self.subTest(subtree=subtree):
project_to_run = therock_matrix.collect_projects_to_run([subtree])
self.assertGreater(len(project_to_run), 0)
self.assertFalse(
any(
project["run_rocjitsu_race_check"] for project in project_to_run
)
)

def test_rocjitsu_race_check_follows_hipblaslt_into_merged_row(self):
project_to_run = therock_matrix.collect_projects_to_run(
["projects/hipblaslt", "projects/miopen"]
)
matching_rows = [
row for row in project_to_run if row["run_rocjitsu_race_check"]
]
self.assertEqual(len(matching_rows), 1)
self.assertIn(
"tensilelite",
matching_rows[0]["projects_to_test"].split(","),
)

def test_collect_projects_to_run_hipthreads(self):
subtrees = ["projects/hipthreads"]
Expand Down
4 changes: 4 additions & 0 deletions .github/scripts/therock_configure_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ def retrieve_projects(args):
if mapped_project == project:
label_subtrees.append(subtree)
break # Only need one representative subtree per project
if "test:hipblaslt" in pr_labels:
# The generic BLAS representative may be a different subtree.
# Preserve the explicit hipBLASLt request for rocjitsu selection.
label_subtrees.append("projects/hipblaslt")

# Combine file-based detection with label-based selection
subtrees = list(set(subtrees + label_subtrees))
Expand Down
13 changes: 13 additions & 0 deletions .github/scripts/therock_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,19 @@
"projects/hipblaslt": "sparselt",
}

ROCJITSU_RACE_CHECK_SUBTREES = {
"projects/hipblaslt",
}


def collect_projects_to_run(subtrees):
subtrees = list(subtrees)
platform = os.getenv("PLATFORM")
projects = set()
# Record why the BLAS row was selected before dependency folding loses the
# original subtree identity. Workflows consume this marker after the matrix
# is assembled to attach instrumentation to the final merged product row.
run_rocjitsu_race_check = bool(ROCJITSU_RACE_CHECK_SUBTREES.intersection(subtrees))
# Work on per-call deep copies so module-level state stays immutable across calls.
local_project_map = copy.deepcopy(project_map)
local_additional_options = copy.deepcopy(additional_options)
Expand Down Expand Up @@ -268,6 +277,10 @@ def collect_projects_to_run(subtrees):
project_map_data["projects_to_test"] = list(
set(project_map_data["projects_to_test"])
)
project_map_data["run_rocjitsu_race_check"] = (
run_rocjitsu_race_check
and "tensilelite" in project_map_data["projects_to_test"]
)

cmake_flag_options = " ".join(project_map_data["cmake_options"])
projects_to_test_options = ",".join(project_map_data["projects_to_test"])
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/therock-ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
type: string
test_type:
type: string
run_rocjitsu_race_check:
type: boolean
default: false
amdgpu_families:
type: string
test_runs_on:
Expand All @@ -33,6 +36,16 @@ on:
permissions:
contents: read

# Each Linux matrix row follows the MultiArch/MI455 pattern. One build job
# provides artifacts to two consumers:
#
# therock-build-linux
# - therock-test-linux: blocking package validation
# - rocjitsu-race-check-linux: advisory instrumentation
#
# Both consumers use artifacts from the build. The rocjitsu job uses
# `continue-on-error`, so its failure stays visible without failing this Linux
# workflow. ROCm/rocm-libraries#10072 verifies this behavior.
jobs:
therock-build-linux:
name: Build (${{ inputs.amdgpu_families }})
Expand Down Expand Up @@ -183,3 +196,16 @@ jobs:
secrets:
MIOPEN_CI_WEBHOOK_URL: ${{ secrets.MIOPEN_CI_WEBHOOK_URL }}
HIPDNN_CI_WEBHOOK_URL: ${{ secrets.HIPDNN_CI_WEBHOOK_URL }}

rocjitsu-race-check-linux:
name: rocjitsu race check (${{ inputs.amdgpu_families }})
needs: [therock-build-linux]
# The matrix boolean records that projects/hipblaslt selected this row. The
# `tensilelite` token confirms that this is the hipBLASLt library row, not a
# provider row containing a name such as `hipblasltprovider`.
if: ${{ inputs.run_rocjitsu_race_check && inputs.build_runs_on != '' && (startsWith(inputs.amdgpu_families, 'gfx94') || startsWith(inputs.amdgpu_families, 'gfx950')) && contains(inputs.projects_to_test, 'tensilelite') }}
uses: ./.github/workflows/therock-rocjitsu-race-check-linux.yml
with:
therock_ref: ${{ inputs.therock_ref }}
build_runs_on: ${{ inputs.build_runs_on }}
Comment thread
newling marked this conversation as resolved.
Resolved
amdgpu_families: ${{ inputs.amdgpu_families }}
1 change: 1 addition & 0 deletions .github/workflows/therock-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ jobs:
cmake_options: ${{ matrix.projects.cmake_options }}
projects_to_test: ${{ matrix.projects.projects_to_test }}
test_type: ${{ needs.setup.outputs.test_type }}
run_rocjitsu_race_check: ${{ matrix.projects.run_rocjitsu_race_check }}
amdgpu_families: ${{ matrix.target_bundle.amdgpu_family }}
test_runs_on: ${{ matrix.target_bundle.test_machine }}
build_runs_on: ${{ needs.setup.outputs.linux_build_runs_on }}
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/therock-rocjitsu-race-check-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# This reusable workflow is a narrow post-build instrumentation job for
# hipBLASLt. It fetches BLAS artifacts from the just-finished TheRock build and
# runs two small workloads under rocjitsu's race detector. The workloads run
# entirely under CPU-side emulation, so the workflow uses the CPU build runner
# instead of consuming GPU test capacity.

name: TheRock rocjitsu race check Linux

on:
workflow_call:
inputs:
therock_ref:
type: string
required: true
build_runs_on:
type: string
required: true
amdgpu_families:
type: string
required: true

permissions:
contents: read

jobs:
rocjitsu-race-check-linux:
name: rocjitsu race check (${{ inputs.amdgpu_families }})
# This job is advisory. Failures remain visible, but continue-on-error keeps
# the calling Linux workflow successful. ROCm/rocm-libraries#10072 verifies
# this behavior.
# TODO(AIHPBLAS-3605): Remove after the check is reliably green.
continue-on-error: true
runs-on: ${{ inputs.build_runs_on }}
timeout-minutes: 90
container:
# Use a plain Ubuntu image without ROCm preinstalled. The ROCm runtime,
# compiler, hipBLASLt, and TensileLite all come from TheRock artifacts
# fetched below, so this job tests the PR-produced payload.
image: ghcr.io/rocm/no_rocm_image_ubuntu24_04@sha256:4150afe4759d14822f0e3f8930e1124f26e11f68b5c7b91ec9a02b20b1ebbb98
options: --ipc host
--user 0:0
--ulimit memlock=-1:-1
--security-opt seccomp=unconfined
defaults:
run:
shell: bash
env:
VENV_DIR: ${{ github.workspace }}/.venv
ARTIFACT_RUN_ID: ${{ github.run_id }}
OUTPUT_ARTIFACTS_DIR: ./build
ROCM_PATH: ${{ github.workspace }}/build
AMDGPU_FAMILIES: ${{ inputs.amdgpu_families }}
ROCJITSU_SOURCE_DIR: ${{ github.workspace }}/rocm-systems/emulation/rocjitsu
ROCJITSU_BUILD_DIR: ${{ github.workspace }}/rocjitsu-build
RACE_REPORT_DIR: ${{ github.workspace }}/race-reports
# The driver uses these values for its two timeout commands. Both are
# shorter than the job timeout, so reports can still upload after a
# workload timeout.
RACE_TIMEOUT_SECONDS: "180"
TENSILELITE_TIMEOUT_SECONDS: "420"
Comment thread
newling marked this conversation as resolved.
Resolved
steps:
# The job needs three inputs in one workspace:
# 1. TheRock actions/scripts to fetch the exact artifacts from this run.
# 2. This rocm-libraries checkout for the race-check driver script.
# 3. rocm-systems source for rocjitsu until rocjitsu is packaged as a
# complete runnable artifact.
- name: Checkout TheRock repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: "ROCm/TheRock"
ref: ${{ inputs.therock_ref }}

- name: Checkout rocm-libraries repository for scripts
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: rocm-libraries
sparse-checkout: .github/scripts
sparse-checkout-cone-mode: true

- name: Checkout rocm-systems for rocjitsu
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: ROCm/rocm-systems
# Pin the source used by every target in the workflow run.
ref: bded72bb7d1fc7e25620dcf35e2cd11eade08b26
path: rocm-systems
sparse-checkout: |
emulation/rocjitsu
shared/machine-readable-isa/isa
sparse-checkout-cone-mode: true

# The pinned base image already provides CA certificates, CMake, Git, and
# Ninja. Install only the remaining host development files needed for the
# local rocjitsu source build. ROCm runtime pieces come from TheRock
# artifacts.
- name: Install rocjitsu build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
libdrm-dev

# Pull the BLAS runtime and test payload from the current TheRock build.
# This is what keeps the check aligned with the exact hipBLASLt and
# TensileLite artifacts produced by the PR, rather than an image-local or
# previously installed ROCm tree.
- name: Run setup test environment workflow
timeout-minutes: 15
uses: ./.github/actions/setup_test_environment
with:
ARTIFACT_RUN_ID: ${{ env.ARTIFACT_RUN_ID }}
ARTIFACT_GROUP: ${{ inputs.amdgpu_families }}
OUTPUT_ARTIFACTS_DIR: ${{ env.OUTPUT_ARTIFACTS_DIR }}
VENV_DIR: ${{ env.VENV_DIR }}
FETCH_ARTIFACT_ARGS: --blas --tests
Comment thread
newling marked this conversation as resolved.
Resolved

- name: Run rocjitsu race check
timeout-minutes: 75
run: bash rocm-libraries/.github/scripts/run_rocjitsu_hipblaslt_race_check.sh

# Upload even on failure. The report directory contains the per-workload
# stdout logs, rocjitsu sink files, race.log files, generated reduced
# TensileLite input/output, and timing.tsv; without this artifact a failed
# detector run is usually not actionable from the console log alone.
- name: Upload race reports
if: ${{ always() }}
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8 # v4.6.2
with:
name: rocjitsu-race-reports-${{ inputs.amdgpu_families }}
path: race-reports/
if-no-files-found: ignore
Loading