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
5 changes: 2 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Local VCS/worktree state is not needed inside the image. Without it
# setup_env.py cannot resolve the rocm-libraries pin, so the build script
# passes it as the ROCM_LIBRARIES_REF build arg.
# Local VCS/worktree state is not needed inside the image. setup_env.py reads
# rocm-pin.json from the build context for the ROCm and rocm-libraries pins.
.git
**/.git

Expand Down
5 changes: 2 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ updates:
patterns:
- "*"

# rocm-libraries and aiter. Dependabot takes one entry per ecosystem and
# directory, so both submodules share this entry and its title form:
# "chore(deps): bump <submodule> from <old> to <new>".
# aiter submodule. rocm-libraries is pinned alongside ROCm in rocm-pin.json
# and updated by .github/workflows/bump-rocm-pin.yml.
- package-ecosystem: "gitsubmodule"
directory: "/"
cooldown:
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/bump-rocm-pin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT

name: bump-rocm-pin

on:
workflow_dispatch:
inputs:
rocm_version:
description: 'Optional ROCm nightly version (e.g. 10.3.0a20261123); blank or latest bumps each arch independently from Quartz.'
required: false
type: string
default: ''
archs:
description: 'Optional comma-separated archs to update (e.g. gfx942,gfx950); blank updates all archs in rocm-pin.json.'
required: false
type: string
default: ''

permissions:
contents: read

concurrency:
group: bump-rocm-pin
cancel-in-progress: false

jobs:
bump:
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'

- name: Resolve per-arch ROCm pins from Quartz
id: resolve
env:
REQUESTED_VERSION: ${{ inputs.rocm_version || '' }}
REQUESTED_ARCHS: ${{ inputs.archs || '' }}
run: |
python3 tools/bump_rocm_pin.py \
--rocm-version "${REQUESTED_VERSION}" \
--archs "${REQUESTED_ARCHS}" \
--body-file "${RUNNER_TEMP}/bump-rocm-pin-body.md" \
--github-output "${GITHUB_OUTPUT}"

- name: Open or update bump PR
Comment thread
SamuelReeder marked this conversation as resolved.
Resolved
if: steps.resolve.outputs.changed == 'true'
env:
# Setting repository secret ROCM_PIN_BUMP_TOKEN (a PAT or GitHub App
# token) lets the pushed branch trigger pull_request CI checks
# automatically; otherwise GITHUB_TOKEN opens/updates the PR.
GH_TOKEN: ${{ secrets.ROCM_PIN_BUMP_TOKEN || secrets.GITHUB_TOKEN }}
PR_TITLE: ${{ steps.resolve.outputs.title }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
branch="chore/bump-rocm-pin"
body_file="${RUNNER_TEMP}/bump-rocm-pin-body.md"

remote="https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git"
# Skip pushing when the open bump branch already carries this exact
# pin, so repeated runs do not trigger redundant GPU CI or overwrite
# manual fix-up commits on the bump PR.
if git fetch --quiet "${remote}" "refs/heads/${branch}" 2>/dev/null; then
if git show FETCH_HEAD:rocm-pin.json 2>/dev/null | cmp -s - rocm-pin.json; then
echo "Branch ${branch} already has this exact rocm-pin.json; skipping push."
exit 0
fi
fi

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "${branch}"
git add rocm-pin.json
git commit -m "${PR_TITLE}"
git push --force "${remote}" "HEAD:refs/heads/${branch}"

pr_number=$(gh pr list --repo "${REPO}" --head "${branch}" --state open --json number --jq '.[0].number // empty')
if [ -n "${pr_number}" ]; then
gh api -X PATCH "repos/${REPO}/pulls/${pr_number}" \
-f title="${PR_TITLE}" \
-F body=@"${body_file}" >/dev/null
echo "Updated PR #${pr_number}"
else
pr_url=$(gh pr create --repo "${REPO}" --base main --head "${branch}" \
--title "${PR_TITLE}" \
--body-file "${body_file}")
echo "Created ${pr_url}"
pr_number="${pr_url##*/}"
fi

# Enable squash auto-merge so the bump PR merges as soon as required
# checks and CODEOWNER approval pass (main ruleset blocks direct push).
if ! gh pr merge "${pr_number}" --repo "${REPO}" --auto --squash; then
echo "::warning::Could not enable auto-merge on PR #${pr_number}; merge manually after review."
fi
22 changes: 18 additions & 4 deletions .github/workflows/check-deserialize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ on:
- 'src/dnn_benchmarking/graph/**'
- 'tools/check_deserialize.py'
- '.github/workflows/check-deserialize.yml'
- 'rocm-pin.json'
- 'setup_env.py'
push:
branches: [main]
paths:
- 'graphs/**'
- 'src/dnn_benchmarking/graph/**'
- 'tools/check_deserialize.py'
- '.github/workflows/check-deserialize.yml'
- 'rocm-pin.json'
- 'setup_env.py'

permissions:
contents: read
Expand Down Expand Up @@ -49,14 +53,24 @@ jobs:

# No GPU required: from_json + validate + build_operation_graph only
# assemble and finalize the backend operation-graph descriptor, no
# plan build or kernel execution. The check imports only
# hipdnn_frontend, so --no-aiter skips the AITER build, which needs a
# ROCm version file that this runner does not have.
# plan build or kernel execution. ROCm PyTorch and rocm-libraries come
# from rocm-pin.json, or the ROCM_VERSION repository variable when set.
# The arch is gfx942, not gfx90a: Quartz reports failed gfx90a ROCm tests
# on most nightlies, and this build does not run on a GPU. The check
# imports only hipdnn_frontend, so --no-aiter skips the AITER build.
- name: Build hipDNN (no GPU)
env:
PIP_NO_CACHE_DIR: "1"
ROCM_VERSION: ${{ vars.ROCM_VERSION }}
run: |
python setup_env.py --gpu-arch gfx90a --workspace .ci-workspace -y --no-aiter
python setup_env.py --gpu-arch gfx942 --workspace .ci-workspace -y --no-aiter \
${ROCM_VERSION:+--rocm-version "$ROCM_VERSION"}

- name: Log the ROCm build
run: |
python -c 'import json, sys; r = json.load(open(sys.argv[1])); print("ROCm", r["rocm_version"], "built", r["build_date"], "from TheRock", r["therock_commit"], "rocm-libraries", r.get("rocm_libraries_commit"), "(" + r["source"] + "), untested:", r["untested"])' \
.ci-workspace/.venv/dnn-bench-rocm-build.json |
tee -a "$GITHUB_STEP_SUMMARY"

- name: Check opgraph-level graph deserialization
run: |
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,25 @@ jobs:
python-version: '3.12'

# No --gpu-arch: detected from the runner's own GPU, so this job works
# on any GPU runner label.
# on any GPU runner label. ROCm PyTorch and rocm-libraries come from
# rocm-pin.json, or the ROCM_VERSION repository variable when set
# (including 'latest' for live Quartz selection).
- name: Full rocm-mode build
env:
PIP_NO_CACHE_DIR: "1"
ROCM_VERSION: ${{ vars.ROCM_VERSION }}
run: |
python setup_env.py \
--workspace .ci-gpu-workspace \
${ROCM_VERSION:+--rocm-version "$ROCM_VERSION"} \
-y

- name: Log the ROCm build
run: |
python -c 'import json, sys; r = json.load(open(sys.argv[1])); print("ROCm", r["rocm_version"], "built", r["build_date"], "from TheRock", r["therock_commit"], "rocm-libraries", r.get("rocm_libraries_commit"), "(" + r["source"] + "), untested:", r["untested"])' \
.ci-gpu-workspace/.venv/dnn-bench-rocm-build.json |
tee -a "$GITHUB_STEP_SUMMARY"

# activate (not $VENV/python) for the ROCM_PATH/LD_LIBRARY_PATH that
# conftest.py's plugin discovery needs. No -m filter: gpu tests run here.
- name: Install test extras and run full suite on hardware
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ credentials.*

# default --profiling-output-dir
profiling-output/

# setup_env.py sparse-clones rocm-libraries at the commit pinned in rocm-pin.json
/rocm-libraries/
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "rocm-libraries"]
path = rocm-libraries
url = https://github.com/ROCm/rocm-libraries.git
branch = develop
[submodule "aiter"]
path = aiter
url = https://github.com/ROCm/aiter.git
Expand Down
22 changes: 16 additions & 6 deletions dockerfiles/Dockerfile.dnn-benchmark-performance-linux
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ FROM ${BASE_IMAGE} AS builder

ARG DEVICE_TARGET=gfx942
ARG FETCHCONTENT_GIT_SSL_NO_VERIFY=false
ARG ROCM_TORCH_INDEX_URL=https://nightly.repo.amd.com/rocm/whl-next/
# The build context has no .git (see .dockerignore), so setup_env.py cannot
# resolve the rocm-libraries submodule pin itself. The build script passes it
# (`git rev-parse HEAD:rocm-libraries`); empty => setup warns and builds the
# moving .gitmodules branch.
ARG ROCM_LIBRARIES_REF=""

ENV DEBIAN_FRONTEND=noninteractive \
HIP_PLATFORM=amd \
Expand Down Expand Up @@ -41,6 +35,13 @@ WORKDIR ${WORKSPACE_DIR}

COPY . .

# The ROCm wheel version, rocm-libraries commit, and optional torch index URL.
# Empty => setup_env.py reads them from rocm-pin.json in the build context.
# Declared here, not at the stage top, so a new pin or index keeps the apt layer.
ARG ROCM_TORCH_INDEX_URL=""
ARG ROCM_VERSION=""
ARG ROCM_LIBRARIES_REF=""

RUN --mount=type=cache,target=/root/.cache/pip <<'EOF'
set -eu

Expand Down Expand Up @@ -71,6 +72,9 @@ fi
if [ -n "${ROCM_LIBRARIES_REF}" ]; then
set -- "$@" --rocm-libraries-ref "${ROCM_LIBRARIES_REF}"
fi
if [ -n "${ROCM_VERSION}" ]; then
set -- "$@" --rocm-version "${ROCM_VERSION}"
fi

python3.12 setup_env.py "$@"

Expand Down Expand Up @@ -190,6 +194,12 @@ RUN useradd --create-home --user-group --groups video dnnbench && \
chown dnnbench:dnnbench "${WORKSPACE_DIR}"
USER dnnbench

# The ROCm wheel version that the builder stage installed, when the build
# named one. The results also record it, with its TheRock build date and
# commit (environment.rocm_build_version, rocm_build_date, therock_commit).
ARG ROCM_VERSION=""
LABEL com.amd.dnn-benchmark.rocm-version="${ROCM_VERSION}"

# One-shot benchmark CLI, not a long-running service.
HEALTHCHECK NONE

Expand Down
74 changes: 68 additions & 6 deletions dockerfiles/build-dnn-benchmark-performance-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail
container_command="docker"
device_target="gfx942"
tag=""
rocm_version=""
rocm_libraries_ref=""
build_args=()

usage() {
Expand All @@ -16,12 +18,20 @@ Options:
--container-command CMD Container command. Default: docker
--device-target TARGET ROCm PyTorch GPU architecture. Default: gfx942
--tag TAG Image tag. Default: dnn-benchmark-performance:<device-target>
--rocm-version VERSION ROCm wheel version to install ('latest' for the
newest usable Quartz nightly, or a specific version
such as 10.3.0a20261123). Default: rocm-pin.json.
--rocm-libraries-ref SHA Full 40-character rocm-libraries commit to build.
Default: matched to --rocm-version (from
rocm-pin.json by default, or from TheRock for
'latest' / explicit versions).
-h, --help Show this help.

Examples:
./build-dnn-benchmark-performance-image.sh
./build-dnn-benchmark-performance-image.sh --container-command podman
./build-dnn-benchmark-performance-image.sh --device-target gfx950
./build-dnn-benchmark-performance-image.sh --rocm-version 10.3.0a20261117
EOF
}

Expand All @@ -42,6 +52,16 @@ while [[ $# -gt 0 ]]; do
tag="$2"
shift 2
;;
--rocm-version)
[[ $# -ge 2 ]] || { echo "--rocm-version requires a value" >&2; exit 2; }
rocm_version="$2"
shift 2
;;
--rocm-libraries-ref)
[[ $# -ge 2 ]] || { echo "--rocm-libraries-ref requires a value" >&2; exit 2; }
rocm_libraries_ref="$2"
shift 2
;;
-h|--help)
usage
exit 0
Expand Down Expand Up @@ -71,17 +91,59 @@ fi
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd -- "${script_dir}/.." && pwd)"

# The image build context excludes .git, so resolve the pinned rocm-libraries
# commit here; setup_env.py otherwise falls back to a moving branch.
rocm_libraries_ref="$(git -C "${repo_root}" rev-parse HEAD:rocm-libraries 2>/dev/null || true)"
if [[ -z "${rocm_libraries_ref}" ]]; then
echo "WARNING: could not resolve the rocm-libraries submodule commit; the image will build its moving branch." >&2
fi
# Resolve the ROCm build and matching rocm-libraries commit here, using the
# same rule as setup_env.py: rocm-pin.json by default (no network or host git
# required), or Quartz + TheRock when --rocm-version is 'latest' or another
# version.
resolved="$(python3 - "${repo_root}/setup_env.py" "${device_target}" "${rocm_version}" "${rocm_libraries_ref}" <<'PY'
import argparse
import importlib.util
import sys

spec = importlib.util.spec_from_file_location("setup_env", sys.argv[1])
setup_env = importlib.util.module_from_spec(spec)
spec.loader.exec_module(setup_env)
device_target, rocm_version, rocm_libraries_ref = sys.argv[2:]
if rocm_libraries_ref:
try:
rocm_libraries_ref = setup_env._commit_sha(rocm_libraries_ref)
except argparse.ArgumentTypeError as exc:
print(f"ERROR: --rocm-libraries-ref: {exc}", file=sys.stderr)
sys.exit(2)
if rocm_version:
try:
rocm_version = setup_env._rocm_version(rocm_version)
except argparse.ArgumentTypeError as exc:
print(f"ERROR: --rocm-version: {exc}", file=sys.stderr)
sys.exit(2)
pin = setup_env.read_rocm_pin(device_target)
if not rocm_version or rocm_version == pin.rocm_version:
build = pin
elif rocm_version == "latest":
build = setup_env.select_quartz_nightly("linux", device_target)
else:
build = setup_env.describe_rocm_version(rocm_version, "", "linux", device_target)
if not rocm_libraries_ref:
if build.rocm_libraries_commit:
rocm_libraries_ref = build.rocm_libraries_commit
elif build.therock_commit:
rocm_libraries_ref = setup_env.resolve_therock_rocm_libraries_commit(
build.therock_commit
)
else:
rocm_libraries_ref = pin.rocm_libraries_commit or ""
print(build.rocm_version, build.index_url, rocm_libraries_ref)
PY
)"
read -r rocm_version rocm_index_url rocm_libraries_ref <<<"${resolved}"
echo "ROCm ${rocm_version} from ${rocm_index_url} (rocm-libraries ${rocm_libraries_ref})"

DOCKER_BUILDKIT="${DOCKER_BUILDKIT:-1}" "${container_command}" build \
-f "${script_dir}/Dockerfile.dnn-benchmark-performance-linux" \
--build-arg "DEVICE_TARGET=${device_target}" \
--build-arg "ROCM_LIBRARIES_REF=${rocm_libraries_ref}" \
--build-arg "ROCM_VERSION=${rocm_version}" \
--build-arg "ROCM_TORCH_INDEX_URL=${rocm_index_url}" \
-t "${tag}" \
"${build_args[@]}" \
"${repo_root}"
4 changes: 4 additions & 0 deletions docs/results-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ The CLI collects these values one time, at suite start.
| `cuda_version` | string | The `cuda` value of `torch/version.py` for a CUDA PyTorch. `null` for a ROCm PyTorch. |
| `cudnn_version` | string | cuDNN version. Set only for a CUDA PyTorch that the process has already imported. |
| `hipdnn_version` | string | `hipdnn_frontend.__version__`. |
| `rocm_build_version` | string | The ROCm wheel version that `setup_env.py` installed in `--torch-mode rocm`, for example `10.3.0a20261123`. The tool reads it from `dnn-bench-rocm-build.json` in the venv of the running Python (`sys.prefix`). `null` when the venv has no such record: ROCm came from somewhere else, or setup did not install ROCm PyTorch. See [setup.md](setup.md#rocm-nightly-selection). |
| `rocm_build_date` | string | `YYYYMMDD` build date of that ROCm build, from `rocm-pin.json` or its Quartz `status.json`. `null` without a record, or when Quartz has no `status.json` for the version. |
| `therock_commit` | string | The full TheRock commit of that ROCm build, from `rocm-pin.json` or its Quartz `status.json`. `null` in the same cases as `rocm_build_date`. |
| `rocm_build_untested` | array of strings | The Quartz test suites (`rocm`, `pytorch`) that report no result for the GPU architecture of that ROCm build. `[]` when both suites tested it. `null` when setup read no Quartz `status.json` (for example `rocm-pin.json` or an unknown `--rocm-version`). See [setup.md](setup.md#rocm-nightly-selection). |
| `python_version` | string | Python version. |
| `torch_version` | string | `__version__` of `torch/version.py`. |
| `amdsmi_available` | bool | `true` when amdsmi loads. Without amdsmi, `gpu_hbm_gb`, `gpu_pcie_link`, `amdgpu_driver_version`, `gpu_power_cap_w`, `gpu_max_sclk_mhz`, `gpu_compute_partition` and all clock values are `null`. |
Expand Down
Loading
Loading