llama.cpp/scripts/hip
thelittlefireman fd4b137e38
CI: add Hip occupancy check and small static analysis report (#32365)
* ci: check for occupancy regressions vs master in HIP quality check

Add scripts/hip/gcn-cdna-occupancy-check.py, which compares per-kernel
occupancy between two GGML_HIP_EXPORT_METRICS build logs and fails when
a kernel drops occupancy. Wire it into the HIP quality check workflow:
the baseline (master) is built with the same target and flags, then
compared against the PR build.

Assisted-by: Hermes Agent

* ci: reuse spill-check build and cache master baseline for occupancy check

The PR-side metrics.log is shared with the VGPR spill check, so the
occupancy comparison adds no extra PR build. The master baseline metrics
log is cached by master-push runs and restored on PRs; it is only
rebuilt as a fallback when the master tip has no cached baseline.

* ci: report occupancy and spill changes as a markdown artifact

Extend gcn-cdna-occupancy-check.py to also compare per-kernel VGPR and
SGPR spills, and add a --report option that writes a markdown report
with all regressions and improvements. The workflow uploads the report
as an artifact on PRs, even when the check fails.

* ci: split metrics check and markdown report into separate scripts

gcn-cdna-metrics-check.py compares per-kernel occupancy and spills and
can dump all deltas as TSV; gcn-cdna-metrics-report.py generates the
markdown report from that dump. The workflow runs both on PRs and
uploads the report as an artifact.

* ci: consolidate HIP kernel metrics checks using Clang YAML remarks

Merge VGPR threshold, occupancy/spill comparison, and Markdown reporting
into one script with unchanged checking rules and output formats. Parse
per-kernel optimization records instead of interleaved text diagnostics.
Add unit tests and update the CI baseline cache to contain YAML records.

* ci: preserve comparison kernel selection and fix Python indentation

Count only kernels with occupancy or spill remarks, as before the YAML
migration. Add a regression test for VGPR-only records and fix flake8.

* ci: fix Python type checking for HIP metrics scripts

Cast metric entries to lists before appending and check the dynamic
module spec and loader are available before executing the tests.
Preserve existing checks and reports.

* ci: add blocking and warning HIP kernel regression rules

Preserve the VGPR limit and its exemptions, block spill increases and
occupancy drops with increasing VGPRs, and warn on occupancy-only drops.
Collect all findings and generate the report before failing CI.

Request device optimization records explicitly and bypass ccache during
metrics builds; print YAML diagnostics to investigate missing kernel
resource remarks in ROCm 7.2.1.

* ci: preserve device-only HIP optimization records

Do not enable host remarks: Clang writes host and device optimization
records to the same output path. Filter the device records to kernel
resource usage and validate the compiler output before expensive builds.
Invalidate old baseline caches and avoid reporting a missing TSV.

* ci: include HIP runtime in metrics probe

Assisted-by: ChatGPT

* ci: build only ggml-hip for kernel metrics and propagate build errors

Assisted-by: ChatGPT

* ci: match HIP baseline to merge commit and publish job summary

Assisted-by: ChatGPT

* ci: trust the HIP CI checkout directory before resolving baseline

Assisted-by: ChatGPT

* ci: cache HIP baseline metrics in HF buckets

Assisted-by: ChatGPT

* ci: publish HIP metrics report to logs and job summary

Assisted-by: ChatGPT

* Ci: hip auto clean every 30 days

Assisted-by: ChatGPT

* Update .github/workflows/hip-quality-check.yml

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>

* ci: fix conflits and rebase

Assisted-by: ChatGPT

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
2026-11-26 14:50:32 +02:00
..
gcn-cdna-metrics.py CI: add Hip occupancy check and small static analysis report (#32365) 2026-11-26 14:50:32 +02:00
test_gcn_cdna_metrics.py CI: add Hip occupancy check and small static analysis report (#32365) 2026-11-26 14:50:32 +02:00