Skip to content
Open
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
153 changes: 93 additions & 60 deletions .github/qualify-rocm/FEED.md

Large diffs are not rendered by default.

103 changes: 68 additions & 35 deletions .github/qualify-rocm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ any of them does.

The design follows [lemonade-sdk/llama.cpp](https://github.com/lemonade-sdk/llama.cpp/tree/lemonade/.github/qualify-rocm)
so both repositories behave the same way and feed the same dashboard. Test ids
are this repository's own, numbered from T0.1 and T1.1; they do not share
meanings with llama.cpp's.
are shared with lemonade-sdk/llama.cpp and lemonade-sdk/llamacpp-rocm: an id
means the same check in every repository that runs it, and is never reused for a
different check. This repository does not run T0.10 (retired in llama.cpp),
T0.13 (llamacpp-rocm's rocBLAS kernel check) or T1.5 (llama.cpp's reasoning
pass). T0.14, T1.6 and T1.7 mean the same as in llama.cpp, which runs them too.

## Why this exists

Expand Down Expand Up @@ -59,9 +62,11 @@ sd-server against that driver copy instead crashes it with an access violation
| Tier 0 — static checks | standard GitHub runners (`ubuntu-24.04`, `windows-2025`) | yes, affected ROCm version only |
| Tier 1 — GPU inference | self-hosted Strix Halo (gfx1151) machines, Windows and Linux | yes, affected ROCm version only |

Both tiers run on every trigger — the nightly schedule, manual runs and pull
requests. The one exception is that Tier 1 is skipped for a pull request opened
from a fork, so code from outside this repository never runs on the self-hosted
Both tiers run on every pull request and manual run, and on every release run
that builds ROCm; a release run whose release already holds every ROCm version
builds and qualifies none (see [Release runs with nothing new](#release-runs-with-nothing-new)).
The one exception is that Tier 1 is skipped for a pull request opened from a
fork, so code from outside this repository never runs on the self-hosted
machines.

Each tier runs one job per published archive — two operating systems by three
Expand All @@ -74,10 +79,12 @@ Vulkan, CUDA, Metal), publish as normal. The release job then exits non-zero so
the gap is noticed.

A version ships only when, for both of its archives, Tier 0 and Tier 1 both
reported and neither failed, and the final-archive check (T0.12) passed. Unlike
reported and neither failed, and the final-archive check (T0.11) passed. As in
lemonade-sdk/llama.cpp, a Tier 1 that never reported — the GPU runner was
offline, or ROCm failed to install — blocks the version rather than letting it
ship untested. A `warn` never blocks.
The release job waits for Tier 1, so while the GPU runners are offline the whole
release waits too.

On a pull request nothing is published at all, so there is no aggregate step to
pass judgement. Each job therefore fails on its own as soon as a check fails —
Expand All @@ -100,11 +107,11 @@ been packaged.
| T0.7 | no build-machine folder left in the Linux binaries' library search path (RUNPATH): only `$ORIGIN` | yes |
| T0.8 | `sd-server` still accepts the flags Lemonade launches it with | yes |
| T0.9 | `sd-server` reports the upstream commit this run pinned | yes |
| T0.10 | the ROCm libraries the archive needs exist in the ROCm a user installs | yes |
| T0.11 | the bundled HIP runtime is byte-identical to that ROCm version's own copy | yes |
| T0.12 | the finished archive reads back intact and is the one the build job produced and the qualify jobs tested | yes |
| T0.11 | the finished archive reads back intact and is the one the build job produced and the qualify jobs tested | yes |
| T0.12 | the ROCm libraries the archive needs exist in the ROCm a user installs | yes |
| T0.14 | the bundled HIP runtime is byte-identical to that ROCm version's own copy | yes |

T0.12 comes from `check_final.py`, which runs in the release job on the archives
T0.11 comes from `check_final.py`, which runs in the release job on the archives
about to be uploaded. It compares each archive's SHA-256 with the one its build
job recorded, so the bytes that ship are the bytes every other check and Tier 1
ran on. The release job never repacks or merges an archive; it uploads it under
Expand All @@ -125,20 +132,20 @@ for one 512x512 image over the same OpenAI-style endpoint Lemonade calls.
|---|---|---|
| T1.1 | the server starts and serves its web page | yes |
| T1.2 | the GPU actually did the work | yes |
| T1.3 | the GPU sd-server found is the gfx target this runner validates | yes |
| T1.4 | the image is a PNG of the requested size that decodes and is not blank | yes |
| T1.5 | the same request again gives identical bytes | no |
| T1.3 | the image is a PNG of the requested size that decodes and is not blank | yes |
| T1.4 | the same request again gives identical bytes | no |
| T1.6 | the running server loaded the bundled HIP runtime from the archive and every other ROCm library from the user's ROCm install | yes |
| T1.7 | the GPU sd-server found is the gfx target this runner validates | yes |

**T1.2 is the one that matters.** Every other check in this tier passes
perfectly well when the GPU was never used at all — the image is simply slower
to arrive. How it avoids being fooled is described below.

T1.3 is what makes a record say `hardware_validated`. Only gfx1151 has test
T1.7 is what makes a record say `hardware_validated`. Only gfx1151 has test
hardware today; the target comes from the workflow, so adding a runner with
another GPU is one more Tier 1 leg, not a change to the scripts.

T1.5 is recorded but never blocks a release. On the gfx1151 runners sd-server
T1.4 is recorded but never blocks a release. On the gfx1151 runners sd-server
is in fact bit-for-bit repeatable, so a difference is worth a look, but GPUs do
not promise it and treating it as a release gate would block good builds.

Expand Down Expand Up @@ -241,7 +248,7 @@ archive's libraries available?" depends entirely on what the user installed.
Checking against the ROCm used to *build* the archive would always pass — those
are the exact files it was compiled against. `install_rocm.py` therefore
installs the components an end user gets (the kernels for their GPU) rather
than the components a build needs (compilers), and T0.10, T0.11 and Tier 1 all
than the components a build needs (compilers), and T0.12, T0.14 and Tier 1 all
verify against that. Everything goes into a throwaway virtual environment under
the runner's temporary directory; nothing is installed system-wide.

Expand All @@ -258,21 +265,47 @@ release we support provides (Ubuntu 24.04, glibc 2.39). The check passes today
and would fail if the build job's runner image moved to a newer Linux without
that decision being made deliberately.

### Nightlies with nothing new
### Release runs with nothing new

The release tag is `master-<upstream commit count>-<fork commit>`, so it only
changes when upstream stable-diffusion.cpp or this repository changes. A nightly
first checks whether the release for its tag already holds every backend family
and `checksums.txt`; if it does, the whole run is skipped, and only a
`last_check` of `"unchanged"` is written to the feed. If the release is missing
anything — say ROCm 10.2 was withheld the night before — the nightly rebuilds,
re-qualifies, and uploads only the archives that are missing. An archive already
in a release is never replaced, because Lemonade may already be pinned to it.
`checksums.txt` is rebuilt from GitHub's own digests on every run. When the run
re-qualifies an archive that is still withheld, its qualification record is
replaced with the new one (an archive whose build produced no report this run
keeps its previous record); the record of an archive that shipped is never
touched.
changes when upstream stable-diffusion.cpp or this repository changes. A release
run (the nightly, or a manual run with `create_release`) first checks whether the
release for its tag already holds every backend family, its notes, and a
`checksums.txt` that lists each of its archives with GitHub's SHA-256 digest
and nothing else; if it does, the whole run is skipped, and only a `last_check`
of `"unchanged"` is written to the feed. If only every ROCm version is there —
say the Metal build failed the night before — the run rebuilds the other
families but builds and qualifies no ROCm archive, and again only `last_check`
changes in the feed. If a ROCm version is missing — say ROCm 10.2 was
withheld — the run rebuilds and re-qualifies every ROCm version, and uploads
only the archives that are missing; its feed rows for the versions already in
the release say `already_published`.
An archive already in a release is never replaced, because Lemonade may already
be pinned to it. A run that does not release (a pull request, or a manual run
without `create_release`) always builds and qualifies everything. A family this
run dropped, or a ROCm version that did not re-qualify, fails the release job
only when the release does not already hold it from an earlier run.

Each archive's qualification record is uploaded just before the archive. A
withheld archive's record, which says why it was withheld, is uploaded once and
kept on later runs of the same tag, so its digest does not change; the feed has
each run's verdict. Only when a later run ships that archive is its
record replaced; the record of an archive that shipped is never touched. (A
record that says its archive qualified, left by an archive upload that failed,
is replaced too.) `checksums.txt` is rebuilt from GitHub's own digests on every
run, and replaced only when it changes: when an archive was added, or when an
earlier run uploaded an archive but stopped before rewriting `checksums.txt`.
A release whose `checksums.txt` does not match its archives counts as
incomplete, so the next release run rebuilds the non-ROCm families (and ROCm
too if a version is missing) and rewrites it. A run that fills a gap therefore
changes the digests of `checksums.txt` and of the filled archive's record:
anything pinning those for that tag must refresh its pins. The release notes
are written last, from the assets the release really holds, even when the
upload failed part way. A release whose notes were never written, which has
only the one-line summary, counts as incomplete, so the next release run writes
them. Two release runs on the same tag take turns, but GitHub keeps only one
waiting: a third cancels the waiting run's release job, which then uploads
nothing; its feed rows are still published.

## Running by hand

Expand Down Expand Up @@ -331,30 +364,30 @@ The release job's records are also published, pass or fail, to the
`qualification-data` branch by `publish_qualification.py`, so a dashboard can
follow the history of every run without reading each release. An archive whose
build failed gets a placeholder row, so a missing archive shows up as a failure
rather than a gap, and a nightly skipped for lack of changes is recorded too.
rather than a gap, and a release run with nothing new to build is recorded too.
The layout and every field are described in [FEED.md](FEED.md).

## Files

| File | Role |
|---|---|
| `tier0_static.py` | Tier 0 checks T0.1–T0.11 |
| `check_final.py` | T0.12, in the release job |
| `tier1_gpu.py` | Tier 1 checks T1.1–T1.6 |
| `tier0_static.py` | Tier 0 checks T0.1–T0.9, T0.12 and T0.14 |
| `check_final.py` | T0.11, in the release job |
| `tier1_gpu.py` | Tier 1 checks T1.1–T1.4, T1.6 and T1.7 |
| `install_rocm.py` | installs a user-style ROCm runtime for Tier 0 and Tier 1 |
| `binfmt.py` | reads gfx targets, imports, RUNPATH and glibc out of ELF and PE files |
| `archive.py` | unpacks an archive the way a user's unzip would |
| `report.py` | the fragment and record format every tier writes |
| `aggregate.py` | merges fragments per archive and decides which ROCm versions ship |
| `release_assets.py` | which assets make up each backend family; used to drop incomplete families and to skip unchanged nightlies |
| `release_assets.py` | which assets make up each backend family; used to drop incomplete families and to skip what a release already holds |
| `release_notes.py` | renders the release notes from the attached assets |
| `publish_qualification.py` | writes the `qualification-data` feed |

## Out of scope

- **Performance.** Tracked downstream against these same artifacts; a second
set of numbers here would split the history.
- **Image quality.** T1.4 covers "the output is a real picture", which is what
- **Image quality.** T1.3 covers "the output is a real picture", which is what
catches a backend producing NaNs or a blank image. Judging whether an image
is *good* is a separate problem needing a different kind of test.
- **Other backends.** CPU, Vulkan, CUDA and Metal archives get the release
Expand Down
20 changes: 10 additions & 10 deletions .github/qualify-rocm/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

Within one archive, both tiers must have reported and neither may have failed:
- the static checks (Tier 0) must be present and must pass. The release
job's own final-archive check (T0.12) is filed under Tier 0 too, but on its
job's own final-archive check (T0.11) is filed under Tier 0 too, but on its
own it does not count as Tier 0 having reported: the Tier 0 job must have.
- the GPU checks (Tier 1) must be present and must pass. Unlike
- the GPU checks (Tier 1) must be present and must pass. As in
lemonade-sdk/llama.cpp, a missing Tier 1 blocks: an offline GPU runner
withholds the ROCm version rather than shipping it untested.
- with --require-final, the final-archive check (T0.12) must be present too,
- with --require-final, the final-archive check (T0.11) must be present too,
so an archive whose bytes were never compared with the tested ones cannot
ship.
Each build covers 20 or more gfx targets and only one of them has test
Expand Down Expand Up @@ -98,15 +98,15 @@ def published_name(tag, os_name, rocm_version):
def tier_reported(record, tier):
"""Whether a tier's own job reported on this archive.

The release job's final-archive check (T0.12) is filed under tier0 too, so a
The release job's final-archive check (T0.11) is filed under tier0 too, so a
tier0 bucket holding nothing else means the Tier 0 job itself never ran.
The gate, the job summary and the feed all use this one rule.
"""
bucket = record.get("tiers", {}).get(tier)
if not bucket:
return False
if tier == "tier0":
return bool({t.get("id") for t in bucket.get("tests", [])} - {"T0.12"})
return bool({t.get("id") for t in bucket.get("tests", [])} - {"T0.11"})
return True


Expand All @@ -122,8 +122,8 @@ def decide(record, require_final=False):
elif tiers[tier]["status"] == report.STATUS_FAIL:
reasons.append(f"{tier}=fail")

if require_final and "T0.12" not in tier0_ids:
reasons.append("T0.12 missing")
if require_final and "T0.11" not in tier0_ids:
reasons.append("T0.11 missing")

return not reasons, reasons

Expand Down Expand Up @@ -213,7 +213,7 @@ def main():
parser.add_argument("--rocm-versions", default=None,
help="the ROCm versions this run builds, e.g. 10.0,10.1,10.2")
parser.add_argument("--require-final", action="store_true",
help="block an archive the release job's final-archive check (T0.12) did not run on")
help="block an archive the release job's final-archive check (T0.11) did not run on")
parser.add_argument("--fail-on-no-promote", action="store_true")
args = parser.parse_args()

Expand Down Expand Up @@ -330,8 +330,8 @@ def main():
handle.write(f"blocked_rocm_versions={' '.join(blocked)}\n")

if blocked:
print(f"::error::ROCm {', '.join(blocked)} did not qualify and will be "
"dropped from this release. Other ROCm versions and every other "
print(f"::error::ROCm {', '.join(blocked)} did not qualify, so this run "
"does not upload them. Other ROCm versions and every other "
"backend are unaffected.")
if args.fail_on_no_promote and blocked:
sys.exit(1)
Expand Down
8 changes: 4 additions & 4 deletions .github/qualify-rocm/check_final.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Runs inside the release job, after the family completeness check, which is the
only place this question can be answered:

T0.12 final archive integrity -- the final archive opens, reads back intact
T0.11 final archive integrity -- the final archive opens, reads back intact
(every entry's CRC-32 is checked), still contains sd-server and the
file holding the GPU code, and is the archive the build job produced
and the qualify jobs tested: its SHA-256 must match the one the build
Expand All @@ -16,7 +16,7 @@
and uploads it under the same name, never repacking or merging anything into
it. If any step in between ever changed the bytes -- a re-pack, a merge, a
corrupted transfer -- the SHA-256 would no longer match and the archive's ROCm
version would be withheld. (lemonade-sdk/llama.cpp calls the same check T0.11,
version would be withheld. (lemonade-sdk/llama.cpp runs the same check, also T0.11,
in check_post_merge.py.)

The file is opened inside the check, so an archive that cannot be read is
Expand Down Expand Up @@ -71,7 +71,7 @@ def check_integrity(path, os_name, expected_sha):


def main():
parser = argparse.ArgumentParser(description="Final release-archive check (T0.12)")
parser = argparse.ArgumentParser(description="Final release-archive check (T0.11)")
parser.add_argument("--archive", required=True)
parser.add_argument("--meta", required=True)
parser.add_argument("--run-id", default=os.environ.get("GITHUB_RUN_ID"))
Expand All @@ -85,7 +85,7 @@ def main():
artifact=os.path.basename(args.archive), os_name=info["os"],
rocm_version=info["rocm_version"], sdcpp_tag=info.get("tag"),
upstream_sha=info.get("upstream_sha"), run_id=args.run_id, run_attempt=args.run_attempt))
tier.run("T0.12", "final archive integrity",
tier.run("T0.11", "final archive integrity",
lambda: check_integrity(args.archive, info["os"], info.get("sha256")))
tier.write(args.output)
tier.print_summary()
Expand Down
Loading
Loading