Skip to content

[DRAFT/TEST] Validate PR #2398 fix on rocmlir-gen.cpp#2399

Draft
bogdan-petkovic wants to merge 9 commits into
developfrom
users/bpetkovi/test-cpp-static-checks-on-rocmlir-gen
Draft

[DRAFT/TEST] Validate PR #2398 fix on rocmlir-gen.cpp#2399
bogdan-petkovic wants to merge 9 commits into
developfrom
users/bpetkovi/test-cpp-static-checks-on-rocmlir-gen

Conversation

@bogdan-petkovic
Copy link
Copy Markdown
Contributor

Motivation

Verify that PR #2398 (build TableGen headers before clang-tidy) fixes
the missing .h.inc failure class that PR #2310 hit. This branch is
based on the PR #2398 branch and touches rocmlir-gen.cpp, the only
C++ file PR #2310 modified, with a benign comment change so that
clang-tidy-diff runs on the file and is forced to parse the full
TU (Rock dialect headers + transitively included .inc files).

Test Plan

Watch the cpp-static-checks job:

DRAFT: do not merge.

@bogdan-petkovic bogdan-petkovic self-assigned this Jun 2, 2026
@bogdan-petkovic bogdan-petkovic changed the base branch from develop to users/bpetkovi/fix-cpp-static-check-missing-inc June 2, 2026 19:06
@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot added the modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review label Jun 2, 2026
@rocmlir-pr-reviewer
Copy link
Copy Markdown

⚠️ This PR modifies the Claude-review CI security perimeter

The following files in this PR control whether and how the
claude-review workflow protects its LLM Gateway secrets at
runtime (see .github/workflows/CLAUDE_AUTO_REVIEW.md):

  • .github/workflows/ci.yml

Before applying the claude-review label on this PR, please:

  1. Audit the diff in these paths line-by-line. A malicious or
    accidental change could disable the --allowedTools
    restriction, the overlay step, the sanitizer, or the
    review/post job split -- any of which would expose the
    secrets in env to the PR-modified workflow.
  2. If the changes are legitimate and you want a Claude review,
    do NOT apply the claude-review label. Instead, run via
    Actions → Claude Auto Review → Run workflow and enter
    this PR's number. The dispatch path runs from the trusted,
    code-owner-approved version of the workflow on
    develop, so a malicious PR-side
    modification cannot affect the run.

(This banner is automated. The modifies-ci-paths label
will be removed automatically if a future push removes the
perimeter modifications. The Layer-3 in-workflow guard will
additionally fail the claude-review label-triggered run
on this PR if the label is applied while perimeter changes
are present.)

@bogdan-petkovic bogdan-petkovic changed the base branch from users/bpetkovi/fix-cpp-static-check-missing-inc to develop June 2, 2026 20:22
bogdan-petkovic and others added 5 commits June 2, 2026 20:24
git restore-mtime walks the full commit graph to find the last commit
that touched each path. With the external/llvm-project subtree this
expands to ~100k+ commits and takes well over 15 minutes on the GHA
runner.

--first-parent restricts the walk to the mainline, which is sufficient
for the rocMLIR working copy. --skip-missing tolerates index entries
not touched by any first-parent commit so the step does not error out.

Co-authored-by: Cursor <cursoragent@cursor.com>
Benign comment touch in:
- RockOps.td  -> exercises TableGen-generated .inc regeneration plus
                 cascading rebuilds (Rock dialect headers consumed
                 transitively by many TUs).
- rocmlir-gen.cpp -> exercises clang-tidy on a TU that includes locally
                     generated .inc headers; recompiles a single .o.

Expectations on CI with the now-seeded cache:
- "Cache CMake build directory" -> exact-match HIT (no fallback).
- "Build TableGen-generated headers" -> ninja rebuilds only the
  .td-derived .inc files and downstream objects (target <= 1-2 min,
  vs. 7m39s on the cold seeding run).

Co-authored-by: Cursor <cursoragent@cursor.com>
git restore-mtime --first-parent could not locate ~128k files (almost
entirely external/llvm-project/**) because subtree updates enter the
history through the second parent of merge commits and are invisible
to --first-parent. --skip-missing left those files at the
actions/checkout default ("now"), so ninja saw the entire LLVM source
tree as newer than the cached .o files and rebuilt everything.

Fix: pre-touch every tracked file to a fixed old timestamp first, then
run git-restore-mtime --first-parent. Files on the mainline (rocMLIR
proper, including PR-touched .cpp/.td/.yml) get their accurate commit
time; files invisible to --first-parent stay at the old floor, which
is older than the cached build artifacts -> ninja keeps the cache.

Also pass --quiet to suppress the ~128k WARNING lines.

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous run revealed that ninja was not rebuilding *anything*
even for files explicitly modified by the PR ("Build TableGen
headers" finished in ~2s for an .td-changing commit). Root cause:

On pull_request events actions/checkout@v4 checks out the test-merge
ref (refs/pull/N/merge). HEAD's first parent is the base branch and
its second parent is the PR HEAD, so the PR's commits do NOT lie on
HEAD's first-parent line. Combined with the fact that
git-restore-mtime uses `git whatchanged` (which skips merge commit
diffs without `-m`), this means every PR-modified file inherits the
last develop commit's timestamp that touched it -- always older than
the cached .o that was built from that develop commit. ninja keeps
the stale .o; clang-tidy parses the old .inc headers, masking real
issues introduced by .td changes.

Fix: after git-restore-mtime, run `git diff --name-only BASE...HEAD`
and touch every file in the result. `touch` (no -d) sets mtime to
"now", which is guaranteed newer than any cached build artifact, so
ninja rebuilds exactly the PR-modified set and the TableGen-derived
.inc headers used by clang-tidy.

The remaining staleness window for develop-side real merges that
touch C++ files is left as a known limitation; in practice the
develop CI re-seeds the cache after every merge so the window is
bounded to a single run.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2399      +/-   ##
===========================================
+ Coverage    79.50%   82.09%   +2.58%     
===========================================
  Files          100      119      +19     
  Lines        31016    42672   +11656     
  Branches      4819     7082    +2263     
===========================================
+ Hits         24659    35028   +10369     
- Misses        4245     5053     +808     
- Partials      2112     2591     +479     
Flag Coverage Δ
gfx950 81.78% <ø> (?)
mfma 81.91% <ø> (+2.40%) ⬆️
navi4x 81.87% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mlir/tools/rocmlir-gen/rocmlir-gen.cpp 86.31% <ø> (+4.58%) ⬆️

... and 116 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant