Repository navigation
fix(hrr): replay pitched host copies over exactly the copied rect - #12521
Conversation
Archive format unchanged: an older archive keeps the flat blob, which is shorter than the footprint, so replay reports it as not validated.
Replay read the flat blob with the recorded pitch and position; a short or missing blob now skips the copy instead.
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Skipped D2H validations are not consistently counted, allowing some unvalidated archives to pass.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Improves HRR replay fidelity for pitched host-memory copies.
Changes:
- Captures complete pitched host footprints.
- Replays D2H copies into pitched scratch buffers and compares copied rows only.
- Adds pitched D2H/H2D integration coverage.
| File | Description |
|---|---|
projects/hrr/tests/integration/hrr_pitched_d2h_test.cc |
Adds pitched-copy integration tests. |
projects/hrr/tests/integration/CMakeLists.txt |
Registers the new tests. |
projects/hrr/playback/hip_playback.cpp |
Implements pitched replay and validation. |
projects/hrr/DESIGN.md |
Documents pitched-copy behavior. |
projects/clr/hipamd/src/hrr/hip_capture.cpp |
Captures pitched host footprints. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A pitched D2H check whose destination rect overflows size_t, or whose expected blob is shorter than the copy, now counts as attempted and so shows up as skipped in the summary. An archive where every check is skipped then fails the replay instead of passing with nothing validated. Unit_HRR_PitchedD2HShortBlobs cuts one blob, then all seven, and checks the summary and the exit code. Also drops a duplicated bullet in DESIGN.md. Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
A pitched host blob spans the host buffer from the copy's base pointer through its last copied byte, so it also covered the bytes before the first copied row and the padding between rows and slices. Those were read and written to the archive although the copy never touched them: they can hold unrelated data, and an unmapped gap such as a guard page between rows made a valid copy fault only when capture was on. The blob keeps the footprint layout, but only the copied rows are read from the host buffer and every other byte is zero. Replay substitutes H2D sources with the recorded pitches and compares D2H checks row by row, so it never reads those bytes. This covers every pitched host blob: hipMemcpy2D, hipMemcpy3D and the driver 2D/3D copies, both directions. The pitched test now salts the device window per copy, since the host fill no longer makes the expected blobs distinct, and checks that the D2H and H2D blobs hold zero around the copied rows. Co-Authored-By: Claude <noreply@anthropic.com>
hipMemcpy3DAsync, hipMemcpy2DAsync and hipMemcpyParam2DAsync on the null stream are still asynchronous, but the capture skipped the sync for a null stream and could hash the host rows before the copy landed. The driver 3D path already synchronised every async copy; the others now do too. hipMemcpyParam2DAsync also skips the D2H blob when the sync fails, rather than snapshotting anyway. Co-Authored-By: Claude <noreply@anthropic.com>
hipMemset can return before the fill lands, and the non-blocking stream the async copy runs on does not wait for the null stream, so on some parts the fill overwrote the copied window. Synchronise after it, which replay then repeats too. Compare the buffers through byte_diff(), which names the first differing offset: comparing the vectors made Catch2 print every byte as a char, which is not valid UTF-8 and broke the log reader. Co-Authored-By: Claude <noreply@anthropic.com>
|
Done in dd59783: I'll mark the first criterion on AIRUNTIME-2565 done when this merges. |
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
Adds Unit_HRR_DenseOffsetD2HRoundtrip over a hipDrvMemcpy3D of one row at an offset and a hipMemcpy3D into packed slices after the first. Capture must record the host destination from its base pointer through the last copied byte with zero before the first copied byte, and replay must compare the contiguous run in place at that offset: an edit before it is not reported and an edit of its last byte fails exactly that check. Co-Authored-By: Claude <noreply@anthropic.com>
A pitched host blob spanned the host rect from its base pointer through the last copied byte, zero between rows. Its cost grew with the pitch, not with the bytes copied: two rows 1 GiB apart allocated, hashed and wrote 1 GiB. Capture now packs the copied rows end to end, width*height*depth bytes, and sets HRR_FILE_FLAG_PACKED_HOST_RECTS in the events.bin header. With the flag, replay gives the host side of each pitched copy a dense layout and keeps the device side as recorded. Archives without the flag replay as before. Unit_HRR_SparsePitchRoundtrip copies four rows 16 MiB apart and requires 192-byte blobs. The existing pitched tests now expect packed blobs, and clear the flag to check that legacy replay skips them. Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
A v6 reader ignores HRR_FILE_FLAG_PACKED_HOST_RECTS in the file header and replays a packed blob with the recorded pitch, reading past its end. The version is what keeps such a reader out. #12778 also moves to 7 and picks this up from develop.
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
TheRock Submodule Bump ActivityNewest first
|


Motivation
Replay of pitched host copies ignored pitch and offsets in two ways.
Technical Details
events.binmarks such an archive withHRR_FILE_FLAG_PACKED_HOST_RECTSin the reserved field of its file header.replay_pitched_d2h, serves all of these plus hipMemcpy2D. The geometry read from the archive is overflow-checked.hrr_pitched_d2h_test.cc:Issue Tracking
JIRA ID: AIRUNTIME-2564
Test Plan
HIP_HRR_CAPTURE_ENABLED: HRR unit tests and the fullhrr-integration-testsbinary.HIP_HRR_D2H_EXACT=1.developwithout the fix.Test Result
Submission Checklist