Skip to content

CI: Hip quality review easy: add Hip occupancy check and small static analysis report - #32365

Merged
ggerganov merged 18 commits into
ggml-org:masterfrom
thelittlefireman:hip-occupancy-check
Nov 26, 2026
Merged

ggerganov merged 18 commits into
ggml-org:masterfrom
thelittlefireman:hip-occupancy-check

Conversation

@thelittlefireman

@thelittlefireman thelittlefireman commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Help HIP PR review:

  • Extend idea of gcn-cdna-vgpr-check.py script to compare occupancy from a PR to master to avoid massive occupancy regression introduce by PR.
  • Archive a small static analysis report

Additional information

This will be useful for faster HIP PR review.

Requirements

@github-actions github-actions Bot added the devops improvements to build systems and github actions label Nov 15, 2026
@thelittlefireman thelittlefireman changed the title CI: Hip quality: add Hip occupancy check CI: Hip quality review easy: add Hip occupancy check and small static analysis report Nov 15, 2026
@thelittlefireman

Copy link
Copy Markdown
Contributor Author

@IMbackK, @CISC
Could you take look at this ? :)
It still in draft because it's full vibe coding... but could you take a look at : https://github.com/ggml-org/llama.cpp/actions/runs/44631913593

The idea is to speed up review of Cuda/ROCm changes by generating a small static report in CI and a blocking/warning feature based on custom rules.
We have more and more and more PR every day, and it's hard to review and follow each. I think a small automatic help would be welcome 🥹

From my small experience I only have set the following rules:

RULES = {
    'vgpr_limit': 'blocking',
    'vgpr_spill_increase': 'blocking',
    'sgpr_spill_increase': 'blocking',
    'occupancy_vgpr_increase': 'blocking',
    'occupancy_drop': 'warning',
}
  • vgpr_limit: VGPR counter is >= 256, star spilling : blocked
  • vgpr_spill_increase : VGPR spill increase compare to master : blocked
  • sgpr_spill_increase : SGPR spill increase compare to master : blocked
  • occupancy_vgpr_increase: Number of VGPR registers increase AND occupancy decrease : blocked
  • occupancy_drop: when occupancy decrease, only a warning, (sometime even when occupancy decreases a little performance could be better)

The idea is to get minimal false positive and minimal true negative.

@CISC

CISC commented Nov 20, 2026

Copy link
Copy Markdown
Member

I'll try to take a look when time permits, quick note though; avoid GHA cache (this workflow is blocked from it anyway), you can use our HF Buckets cache though, see ccache-buckets action for more info.

@thelittlefireman

Copy link
Copy Markdown
Contributor Author

I'll try to take a look when time permits, quick note though; avoid GHA cache (this workflow is blocked from it anyway), you can use our HF Buckets cache though, see ccache-buckets action for more info.

thanks, done ;)

@IMbackK

IMbackK commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

TIL -fsave-optimization-record=yaml that would have made the previous script mutch less of a pain...

@IMbackK
IMbackK marked this pull request as ready for review November 23, 2026 16:39
@IMbackK
IMbackK requested a review from a team as a code owner November 23, 2026 16:39
@IMbackK

IMbackK commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

looks ok to me generally for inclusion and i ack the rules

ill approve after a test & @thelittlefireman could you rebase so that the current master code is checked?

@thelittlefireman

Copy link
Copy Markdown
Contributor Author

looks ok to me generally for inclusion and i ack the rules

ill approve after a test & @thelittlefireman could you rebase so that the current master code is checked?

Done for the rebase

@thelittlefireman

thelittlefireman commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@IMbackK i made test on our branch dpp you can check the report result her:

https://github.com/thelittlefireman/llama.cpp/actions/runs/45286247842/job/138083213165

https://github.com/ggml-org/tmp/actions/runs/45513298804/job/138866243368?pr=37

I've note that i should ignore sgpr spill on fattn.

edit: i think you cannot see report, logs and artifacts as you are not maintainer in my repo, i Will try to find a way.

thelittlefireman added a commit to thelittlefireman/llama.cpp that referenced this pull request Nov 24, 2026
Backport only the CI changes for the tmp integration test.

Assisted-by: ChatGPT
@IMbackK

IMbackK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

That run failed in the werror check

@thelittlefireman

Copy link
Copy Markdown
Contributor Author

@IMbackK IMbackK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hopefully not too many false positives/ noise, but lets give it a try.

Comment thread .github/workflows/hip-quality-check.yml Resolved
Comment thread .github/workflows/hip-quality-check.yml Resolved
@IMbackK

IMbackK commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Johannes's fattn refactor changed the symbol names, could you rebase and import the new names?

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
…heck

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.
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.
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.
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.
Count only kernels with occupancy or spill remarks, as before the YAML
migration. Add a regression test for VGPR-only records and fix flake8.
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.
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.
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.
@thelittlefireman

Copy link
Copy Markdown
Contributor Author

Johannes's fattn refactor changed the symbol names, could you rebase and import the new names?

Done, could we merge ?

@IMbackK IMbackK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, From my side.

@ggerganov
ggerganov merged commit fd4b137 into ggml-org:master Nov 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops improvements to build systems and github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants