Repository navigation
fix(hrr): regenerate the generated files and API matrix, and test they stay current - #13500
danielbolsson wants to merge 1 commit into
Conversation
…y stay current The matrix header still listed hipMallocHost and hipFreeHost as NOOP after they became real handlers, so Unit_HRR_ApiMatrix_T2_Roundtrip failed on a GPU. CLR also gained hipKernelSetAttributeForDevice without the HRR generated files being rerun, so it was never captured, and the matrix baseline had drifted. Regenerate hrr_api_args.h, both generated shims, the matrix header and its baseline. A new unit test in hrr-generator-rules regenerates each into a scratch directory and fails when a checked-in copy differs, so the default suite now catches this drift; the matrix tests that did were hidden. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Daniel Olsson <daniel.olsson@amd.com>
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
andraghetti
left a comment
There was a problem hiding this comment.
The staleness test is a good guard. Two points inline; the first blocks. This also overlaps #13472 (same hipKernelSetAttributeForDevice slot, with the v9 bump), which I approved today. Could one land first and the other rebase on it?
| HRR_API_HIPREGISTERVAR = 554, | ||
| HRR_API_HIPUNREGISTERFATBINARY = 555, | ||
| HRR_API_COUNT = 556 | ||
| HRR_API_HIPKERNELSETATTRIBUTEFORDEVICE = 547, |
There was a problem hiding this comment.
This moves the nine compiler IDs up by one while HRR_VERSION stays 8, so a v8 archive recorded on develop decodes __hipRegisterFatBinary (549) as __hipPushCallConfiguration. I thought this needs the v9 bump, as in #13472?
| "observable_class.ERROR_STUB": 4, | ||
| "observable_class.NOOP": 200, | ||
| "observable_class.REAL": 340, | ||
| "observable_class.NOOP": 221, |
There was a problem hiding this comment.
mangupta
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @mangupta)
[SUGGESTION] Duplicates the hipKernelSetAttributeForDevice slot that the already-approved PR #13472 adds
This PR and #13472 both add hipKernelSetAttributeForDevice at ID 547 and regenerate the same generated files. Whichever merges second will conflict on hrr_api_args.h, both generated shims, the matrix header and the baseline. The regeneration may also be done twice with different version handling, since only #13472 includes the v9 bump.
Suggested fix: Land #13472 first, then rebase this PR so it only adds the staleness test and the matrix/baseline corrections. Rerun the generators on the rebased tree so the new test passes.
| HRR_API_HIPKERNELSETATTRIBUTEFORDEVICE = 547, | ||
| HRR_API_HIPPOPCALLCONFIGURATION = 548, | ||
| HRR_API_HIPPUSHCALLCONFIGURATION = 549, | ||
| HRR_API_HIPREGISTERFATBINARY = 550, | ||
| HRR_API_HIPREGISTERFUNCTION = 551, | ||
| HRR_API_HIPREGISTERMANAGEDVAR = 552, | ||
| HRR_API_HIPREGISTERSURFACE = 553, | ||
| HRR_API_HIPREGISTERTEXTURE = 554, | ||
| HRR_API_HIPREGISTERVAR = 555, | ||
| HRR_API_HIPUNREGISTERFATBINARY = 556, | ||
| HRR_API_COUNT = 557 |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @mangupta)
[BLOCKING] New API ID inserted before compiler IDs shifts on-disk IDs without a format version bump
The change inserts HRR_API_HIPKERNELSETATTRIBUTEFORDEVICE at 547. That moves all nine compiler-table IDs up by one: __hipPopCallConfiguration goes from 547 to 548, and so on through __hipUnregisterFatBinary, which goes from 555 to 556. HRR_API_COUNT goes from 556 to 557. The archive format version is not changed. These IDs are written to capture archives by hrr_cap::writer::write_event_raw and used to index hrr_playback_dispatch and hrr_api_min_payload_size during replay. An archive recorded before this change will therefore be decoded with the wrong handler and the wrong minimum payload size for every compiler-table event.
Suggested fix: Bump the HRR archive format version, for example HRR_VERSION 8 to 9 as in #13472, together with the regenerated enum, so old archives are rejected or translated instead of being misdecoded. The alternative is to have the generator give new runtime APIs IDs that do not renumber existing ones. Coordinate with #13472 so only one of the two PRs claims the slot and the bump, and rebase the other on it.
| "observable_class.ERROR_STUB": 4, | ||
| "observable_class.NOOP": 200, | ||
| "observable_class.REAL": 340, | ||
| "observable_class.NOOP": 221, | ||
| "observable_class.REAL": 320, | ||
| "observable_class.UNREPLAYABLE": 12, | ||
| "payload_loss.BIG_STRUCT_BY_VALUE": 8, | ||
| "payload_loss.CONST_STRUCT_PTR_IN": 44, | ||
| "payload_loss.any": 52, | ||
| "payload_loss.in_faithful": 33, | ||
| "payload_loss.in_faithful": 24, | ||
| "replay_class.COMPILER_NOOP": 7, | ||
| "replay_class.CUSTOM": 1, | ||
| "replay_class.ERROR_STUB": 4, | ||
| "replay_class.GENERATED": 228, | ||
| "replay_class.MANUAL": 98, | ||
| "replay_class.NOOP": 200, | ||
| "replay_class.GENERATED": 205, | ||
| "replay_class.MANUAL": 101, | ||
| "replay_class.NOOP": 221, | ||
| "replay_class.SPECIAL": 6, |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @mangupta)
[IMPORTANT] Regenerated matrix and baseline record about 20 APIs that playback refuses by name as NOOP
The regenerated baseline makes the matrix more permissive: NOOP rises from 200 to 221, REAL falls from 340 to 320, and in_faithful falls from 33 to 24. In hrr_api_matrix_expectations.h, about 20 existing APIs flip from 0 to 1 in the column that this PR uses as the NOOP flag (see the hipMallocHost/hipFreeHost fix). These include the hipExternalMemory and hipExternalSemaphore APIs, hipExecutionCtx*, hipGreenCtxCreate, hipLibraryGetGlobal, hipLibraryGetManaged and hipGraphicsMapped. These look like the APIs that #12785 made playback refuse as unreplayable. They are recorded as NOOP only because classify_replay does not read PLAYBACK_ONLY_UNREPLAYABLE_APIS yet. The new staleness test then locks this misclassification in as the expected output.
Suggested fix: Before regenerating, make classify_replay read PLAYBACK_ONLY_UNREPLAYABLE_APIS so these APIs are classified UNREPLAYABLE. Otherwise, keep their previous expectations and document that the follow-up to #12785 will update the baseline. Check Unit_HRR_ApiMatrix_* on a GPU against the regenerated header before merging.
| import yaml # noqa: F401 | ||
| HAVE_YAML = True | ||
| except ImportError: | ||
| HAVE_YAML = False | ||
|
|
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @mangupta)
[SUGGESTION] Matrix staleness check silently skips when PyYAML is missing, so the drift this PR fixes can recur unnoticed
test_api_matrix_header_matches_the_derived_manifest is decorated with skipUnless(HAVE_YAML). The drift this PR fixes is the hipMallocHost/hipFreeHost NOOP mismatch in hrr_api_matrix_expectations.h. If the default CI environment has no PyYAML, that check is skipped and the suite still passes, so the same matrix drift would go undetected again. Only the gen_hrr_api_args.py half would still be enforced.
Suggested fix: Ensure the CI job that runs hrr-generator-rules installs PyYAML. Alternatively, make the skip fail when a CI environment variable is set, so it cannot silently pass there.
…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.
|
Superseded by #13472, which now carries this PR's content: the regenerated API matrix expectations and |
…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.
JIRA ID : AIRUNTIME-2937
Generated HRR files on
developwere stale, which madeUnit_HRR_ApiMatrix_T2_Roundtripfail on a GPU (hipMallocHost/hipFreeHostexpected NOOP, replay runs the real handler). The same drift lefthipKernelSetAttributeForDeviceuncaptured.hrr_api_args.h, the playback and capture shims, the matrix header and its baseline.test_generated_files_current.pytohrr-generator-rules: it regenerates each file into a scratch dir and fails if the checked-in copy differs. The matrix tests that caught this are hidden, so the default suite did not.Tested on gbt350 (MI350X, GPUs 4,5) against develop 461c501 plus this change:
ApiMatrix_T0..T4andManifestWellFormedpass; default integration run 133 passed, 1 skipped;hrr-generator-rules18/18. The new test fails on unmodified develop.🤖 Generated with Claude Code