Skip to content

fix(hrr): regenerate sources for hipKernelSetAttributeForDevice - #13472

Merged
danielbolsson merged 4 commits into
developfrom
users/danielbolsson/hrr-regen-kernel-set-attribute-for-device-d16b
Oct 15, 2026
Merged

danielbolsson merged 4 commits into
developfrom
users/danielbolsson/hrr-regen-kernel-set-attribute-for-device-d16b

Conversation

@danielbolsson

@danielbolsson danielbolsson commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

JIRA ID : AIRUNTIME-2937

Motivation

#13004 re-added hipKernelSetAttributeForDevice to HipDispatchTable on develop without regenerating the HRR sources. The checked-in capture and playback dispatch sources, hrr_api_args.h and the API matrix expectations no longer match the HIP headers, so the Generated sources check added in #13256 fails on develop. This PR regenerates them.

While regenerating, the API matrix turned out to carry further drift: the checked-in hrr_api_matrix_expectations.h and api_classes_baseline.json were hand-maintained rather than regenerated, so a number of expectations no longer matched the derived classification. In particular hipMallocHost / hipFreeHost were committed as NOOP while the generator derives them MANUAL / REAL (they are listed in MANUAL_PLAYBACK_APIS), which made Unit_HRR_ApiMatrix_T2_Roundtrip fail on a real GPU. That drift and the missing guard are folded in here from #13500, which this PR supersedes.

Technical Details

  • Generated sources: re-run gen_hrr_api_args.py --check-hrr-coverage. Nothing in them is edited by hand.
  • Classification of the new API:
    • Capture records it through a generated shim.
    • Playback is a no-op. Its hipKernel_t argument is one of the opaque types playback cannot turn back into a live object (_UNTRANSLATED_PLAYBACK_TYPES), so playback_defaults_to_noop applies without listing it anywhere. Its sibling hipKernelSetAttribute is a no-op for the same reason.
    • The API matrix lists it under unreachable, group absent-from-sdk-headers. The SDK headers the matrix workloads compile against do not declare it, so no workload can call it.
  • API matrix: derive_manifest.py --update-baseline, then check_matrix.py --emit-cxx. The baseline gains one runtime API, one generated capture and one no-op replay, and the derived expectations and baseline counts are re-derived from source rather than hand-edited. Re-running both steps on this tree is a no-op; on unmodified develop they change the checked-in files, which is the drift this fixes.
  • HRR_VERSION goes from 8 to 9. The new runtime slot takes the first compiler API ID and shifts the compiler IDs up by one, so a v8 reader would decode those events as the wrong API. The version history in DESIGN.md and the generator's header comment record v9.
  • New guard: projects/hrr/tools/tests/test_generated_files_current.py regenerates hrr_api_args.h, both generated dispatch sources and the API matrix expectations into a scratch directory and fails if the checked-in copies differ. The matrix tests that caught the drift above are not part of the default suite, so this makes staleness fail loudly in CI instead.

Issue Tracking

Fixes the Generated sources failure on #13256 that comes from develop. Supersedes #13500.

Test Plan

  • hrr_check_sources.py all --base-sha origin/develop (from ci(hrr): add the HRR CI workflow #13256), on this branch and on an unmodified develop.
  • pytest projects/hrr/tests/scripts and pytest projects/hrr/tools/tests.
  • Build CLR with HRR capture, then HRR playback, unit and integration tests, against an in-tree ROCr. Run the host-only unit tests.
  • On gbt350 (2x MI350X, gfx950, HIP_VISIBLE_DEVICES=4,5): the API matrix roundtrips T0-T5 and the full integration gate.

Test Result

  • hrr_check_sources.py: generated sources, API-ID compatibility (8 to 9) and the API matrix all pass. On develop the generated-sources and API-matrix checks fail on this API alone.
  • pytest projects/hrr/tests/scripts: 138 passed.
  • pytest projects/hrr/tools/tests: 18 passed, including the two new staleness tests.
  • Build: ROCr, CLR with HRR capture, and HRR playback, unit and integration tests (gfx950) all build, and both regenerated dispatch sources compile with the new API. The host-only unit tests pass (32 test cases), and the integration binary lists 127 test cases.
  • gbt350, HIP_VISIBLE_DEVICES=4,5 (2x MI350X, gfx950), results attributable to this commit (drovr-sync tree id matched): API matrix roundtrips T0-T4 pass (8 tests), T5 passes (1032 assertions), and the full integration gate reports 159 passed / 1 skipped / 0 failed. check_matrix.py --results reports fail=0 in every tier.
  • Two pre-existing conditions, reproduced without this change and not caused by it: check_matrix.py's analyzer exits 1 on two T5 coverage notes (hipArray3DCreate / hipArrayCreate neither exercised nor declared unreachable), and the host handler-tests report a 384-byte ASan leak inside ROCr (hsaKmtCreateEventCtx) with all 220 assertions passing.

Submission Checklist

#13004 appended hipKernelSetAttributeForDevice to HipDispatchTable
without regenerating the HRR sources, so the checked-in capture and
playback dispatch, hrr_api_args.h and the API matrix expectations no
longer match the headers.

Capture records it through a generated shim. Playback is a no-op: its
hipKernel_t argument cannot be translated back into a live kernel, the
same reason its sibling hipKernelSetAttribute is a no-op. The SDK
headers the matrix workloads build against do not declare it, so the
matrix lists it as unreachable with the other APIs absent from them.

The new runtime slot takes the first compiler API ID and shifts the
compiler IDs up by one, so HRR_VERSION goes from 8 to 9.

Signed-off-by: Daniel Olsson <Daniel.Olsson@amd.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:01
@danielbolsson
danielbolsson requested review from a team as code owners October 14, 2026 17:01

This comment was marked as off-topic.

@therock-pr-bot

therock-pr-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@andraghetti andraghetti 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.

The regeneration and the v9 bump look right: the new slot takes ID 547 and the nine compiler IDs move up by one. On MI350 at 6327b8f the full gate shows only the known baseline failures; T0–T2, T5, ManifestWellFormed and ReplayClassMarkers pass. Approving.

…n/hrr-regen-kernel-set-attribute-for-device-d16b
@danielbolsson danielbolsson self-assigned this Oct 15, 2026
@mangupta

Copy link
Copy Markdown
Contributor

🤖 AI-assisted pre-review (for @mangupta)

Re-reviewed the updated head (da05d0e90e4d) — no new findings at or above the posting threshold.

danielbolsson added a commit that referenced this pull request Oct 15, 2026
…ss guard

Carry PR #13500's content over the #13472 tree:
- tests/integration/hrr_api_matrix_expectations.h regenerated with
  derive_manifest.py + check_matrix.py --emit-cxx (48 corrected
  expectation lines; hipMallocHost/hipFreeHost expect=0 REAL since
  MANUAL_PLAYBACK_APIS replays them by hand)
- api_classes_baseline.json re-derived with derive_manifest.py
  --update-baseline (observable NOOP 201->221, REAL 340->320, etc.)
- tools/tests/test_generated_files_current.py from #13500: regenerates
  generated files into a scratch dir and fails if checked-in copies drift

Verified: generators are byte-identical to both PRs' committed content;
hrr_check_sources.py all --base-sha origin/develop passes.
…ss guard

Carry PR #13500's content over the #13472 tree:
- tests/integration/hrr_api_matrix_expectations.h regenerated with
  derive_manifest.py + check_matrix.py --emit-cxx (48 corrected
  expectation lines; hipMallocHost/hipFreeHost expect=0 REAL since
  MANUAL_PLAYBACK_APIS replays them by hand)
- api_classes_baseline.json re-derived with derive_manifest.py
  --update-baseline (observable NOOP 201->221, REAL 340->320, etc.)
- tools/tests/test_generated_files_current.py from #13500: regenerates
  generated files into a scratch dir and fails if checked-in copies drift

Verified: generators are byte-identical to both PRs' committed content;
hrr_check_sources.py all --base-sha origin/develop passes.
@danielbolsson
danielbolsson force-pushed the users/danielbolsson/hrr-regen-kernel-set-attribute-for-device-d16b branch from 0811ab7 to 421a44b Compare October 15, 2026 09:04
…aleness test

hipMallocHost and hipFreeHost have real playback handlers (MANUAL_PLAYBACK_APIS),
so DESIGN.md and the api_matrix.yaml comment no longer call them no-ops. The
README and tests/CMakeLists.txt comment now mention test_generated_files_current.py.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mangupta

Copy link
Copy Markdown
Contributor

🤖 AI-assisted pre-review (for @mangupta)

Re-reviewed the updated head (439eb5f229d2) — no new findings at or above the posting threshold.

@AlexXAmd AlexXAmd 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.

approve the CLR repo code change.

@danielbolsson
danielbolsson merged commit 362ea65 into develop Oct 15, 2026
596 of 608 checks passed
@danielbolsson
danielbolsson deleted the users/danielbolsson/hrr-regen-kernel-set-attribute-for-device-d16b branch October 15, 2026 16:49
danielbolsson added a commit that referenced this pull request Oct 15, 2026
…ss guard

Carry PR #13500's content over the #13472 tree:
- tests/integration/hrr_api_matrix_expectations.h regenerated with
  derive_manifest.py + check_matrix.py --emit-cxx (48 corrected
  expectation lines; hipMallocHost/hipFreeHost expect=0 REAL since
  MANUAL_PLAYBACK_APIS replays them by hand)
- api_classes_baseline.json re-derived with derive_manifest.py
  --update-baseline (observable NOOP 201->221, REAL 340->320, etc.)
- tools/tests/test_generated_files_current.py from #13500: regenerates
  generated files into a scratch dir and fails if checked-in copies drift

Verified: generators are byte-identical to both PRs' committed content;
hrr_check_sources.py all --base-sha origin/develop passes.
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants