Skip to content

fix(tools): count skipped frame replay bytes exactly - #28844

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/replay-exact-skipped-bytes
Dec 6, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/replay-exact-skipped-bytes

Conversation

@JJenkx

@JJenkx JJenkx commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What

Replay results now include the exact number of skipped bytes. A single skipped 4 KiB page rounds to 0.0 in the older skipped_mib field, so some incomplete runs could count as healthy. The report checks the exact count in new results and saved assessments. It retains the rounded field for older results.

Tested

  • Plyxen independently applied the diff to main 63b98e5bf8 on Windows 11. The Release replay tool built with no format warning, three replay CTests and 64 Python cases passed, and reverting the reporter reproduced the exact-count failures. The native CTests exercised the replay executable. Plyxen's test report

  • Baejoe ran both focused Python suites on Windows 11 x64 (MSYS2 UCRT64 Python 3.14.10) at 68697da8fa8f. All 42 tests passed, including the three Windows-only cases. In two saved bundles, exact zero stayed healthy and 4,096 skipped bytes were flagged by the PR reporter. Both reporters left the saved inputs unchanged. Baejoe's test report

  • Linux x86_64 Release build of agc_frame_replay.

  • The focused Python replay suite passed 39 tests with 3 skipped. Coverage includes a skipped 4 KiB page, a saved assessment with a skipped page, exact zero, legacy results and invalid exact counts.

  • Conventions check against e3cd13806921 passed.

Checklist

  • Based on current main and checked for overlapping open PRs
  • One topic per PR
  • Code follows the comment conventions
  • Unimplemented paths retain their existing behavior
  • No investigation files or images added
  • Third-party dependencies unchanged
  • Generic behavior
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (replay diagnostics and report eligibility)
  • AI-assisted: yes

Summary by CodeRabbit

  • New Features
    • Replay summaries now include the exact number of skipped bytes alongside the existing MiB value.
  • Bug Fixes
    • Skipped-memory issues are consistently flagged in replay results and comparison reports, including results with exact byte counts.
  • Documentation
    • Clarified how reports handle exact skipped-byte counts and legacy results that only include rounded MiB values.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Skipped-memory reporting

Layer / File(s) Summary
Emit exact skipped-byte count
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
Replay JSON adds skipped_bytes from replay.skipped.bytes and retains skipped_mib.
Validate and report skipped memory
tools/frame_replay_report.py, tools/tests/test_frame_replay_report.py, docs/dev/BUILD.md
Report processing validates skipped_bytes as an unsigned 64-bit integer and records a skipped-memory issue when either skipped-memory field is truthy. Comparison processing applies the same checks to saved assessments. Tests cover positive, absent, zero, and invalid values. Documentation describes exact byte reporting and the legacy MiB fallback.

Suggested reviewers: mjnhbg3, chitters2004, mcarkade

Change: Bug fix

Merge Risk: Minimal · up to 68697

Replay reports now count a skipped 4 KiB page exactly instead of letting it round to zero. Older results still work through the legacy field. No merge-blocking risk was found.

Security architecture risk: Minimal · up to 68697

The report now excludes runs that skipped memory even when the rounded count was zero. Older results remain readable, but a rounded zero still cannot establish that no memory was skipped. The change affects comparison eligibility, not which captures can run.

Security review details

Security Blast Radius

  • observed — The inspected change affects native result serialization and which trials contribute to comparison reports. It does not change native input handling, replay execution, or the native exit decision.

Trust Boundaries and Controls

  • observed — The exact counter is a validation and eligibility input, not proof of result provenance. A positive count can disqualify a trial, but zero cannot clear existing diagnostics or override process-outcome checks.

Data and control flow

  • observed — Fresh stdout is validated before its native result is accepted. For saved assessments, the report recomputes the skipped-memory diagnostic on a copy before selecting healthy trials and forming pairs.

Resilience and Maintainability Implications

  • observed — A malformed exact count becomes a diagnostic without accepting the fresh native result. In a saved comparison, it rejects the entire render rather than dropping only the affected row. Rendering leaves the supplied report unchanged, so a valid replacement can be rendered without undoing a partial update.

Rollout and rollback

  • inferred — The updated reporter, not the replay executable, decides whether the exact count disqualifies a trial. Operators can re-render saved assessments that contain the count without rerunning captures. Legacy artifacts need no migration, but obtaining exact evidence for a run that recorded only rounded MiB requires a new replay with the updated producer. Reverting the reporter to the merge-base implementation removes the exact-byte check even if the producer still emits the field.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Pylint (4.1.4)

Pylint used default settings because repository settings are unavailable in automated reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 045a4a89-c5ee-43c6-9112-dfdae38de0a5
Commits

Reviewing files that changed from the base of the PR and between e3cd138 and 68697da.

Files selected for processing: 4

  • core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
  • docs/dev/BUILD.md
  • tools/frame_replay_report.py
  • tools/tests/test_frame_replay_report.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

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

Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 68697da8fa8fe295ef471668beb52ce62bed63e5 against base main (fd6e0ff2e13cb5b96092c98940231de6aa1ff9e3). No merged preview was run. I inspected the prepared diff and relevant Python and documentation ranges. The pinned reader could not read FrameReplay.cpp because it attempted to write its call log in the read-only run directory. I ran no tests or build; the test and build results in the PR description are author-reported.

Commands run:

find files -type f -maxdepth 3 -print
sed -n '1,180p' description.md
sed -n '1,180p' commits.md
cat manifest.json
cat files.json
sed -n '1,260p' diff.patch
python3 repo_read.py search '_record_skipped_memory' tools/frame_replay_report.py
python3 repo_read.py search 'skipped_bytes|skipped_mib' tools/frame_replay_report.py
sed -n '1,310p' files/tools/frame_replay_report.py
sed -n '430,510p' files/tools/frame_replay_report.py
sed -n '1,175p' files/tools/tests/test_frame_replay_report.py
sed -n '270,310p' files/docs/dev/BUILD.md

Results

Check Result Note
Diff and changed-line review passed All additions are visible in the diff.
Python and documentation context passed Relevant sections inspected.
Pinned C++ source context not run Reader logging was blocked by read-only storage.
Tests and build not run PR description reports them; I did not run them.

Negative control

Not run. I made no test changes and did not execute the reported Python suite.

Findings

Blocking

None verified in the inspected diff and Python/documentation context.

Non-blocking

None.

Sources

The parser validates skipped_bytes as a nonnegative unsigned 64-bit integer and flags a nonzero exact count or legacy skipped_mib value. Saved assessments receive the same skipped-memory check before trial health is computed. Parser at the reviewed head · Saved assessment handling

The added tests cover a skipped 4 KiB page, a saved assessment, exact zero, legacy results, and invalid exact counts. Tests at the reviewed head

Not verified

core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp was not present under files/, although the manifest marks it included, and the pinned reader could not access it because of the read-only log path. I therefore verified only the C++ JSON format and argument changes shown in the diff, not their surrounding types or callers. docs/dev/BUILD.md, tools/frame_replay_report.py, and tools/tests/test_frame_replay_report.py were inspected at the relevant changed and caller ranges; their full text was not read. files.json lists no rule-excluded files. No tests, build, hardware run, or conventions check were performed in this review.

To get this to a good state

Nothing is required.

@JJenkx

JJenkx commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

I checked the C++ context that the pinned reader could not open. The existing Skipped::bytes member is a std::uint64_t. The replay result derives both fields from that same counter. The exact JSON field passes an unsigned long long to %llu. I verified that the checksummed Linux Release binary from this PR contains that format field. Counter Result serialization

I also applied the exact PR diff to current main e8f09d2877c4 in an isolated checkout. The patch applied cleanly, and the Python replay suite reported 39 passes and three Windows-only skips. This check exercised the reporter and saved evidence paths.

AI-assisted: yes.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 19557 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp L1763

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1835 docs/dev/BUILD.md
PR 11435 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
docs/dev/BUILD.md
PR 15136 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
docs/dev/BUILD.md
PR 15456 docs/dev/BUILD.md
PR 16793 docs/dev/BUILD.md
PR 18208 docs/dev/BUILD.md
PR 18210 docs/dev/BUILD.md
PR 19562 docs/dev/BUILD.md
PR 19610 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
docs/dev/BUILD.md
PR 19628 docs/dev/BUILD.md
PR 19635 docs/dev/BUILD.md
PR 19645 docs/dev/BUILD.md
PR 19670 docs/dev/BUILD.md
PR 19720 docs/dev/BUILD.md
PR 21222 docs/dev/BUILD.md
PR 21939 docs/dev/BUILD.md
PR 22004 docs/dev/BUILD.md
PR 22029 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
PR 22434 docs/dev/BUILD.md
PR 22594 docs/dev/BUILD.md
PR 22647 docs/dev/BUILD.md
PR 23196 docs/dev/BUILD.md
PR 24402 docs/dev/BUILD.md
PR 26131 docs/dev/BUILD.md
PR 26173 docs/dev/BUILD.md
PR 27133 docs/dev/BUILD.md
PR 28536 docs/dev/BUILD.md
PR 28857 core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
docs/dev/BUILD.md
PR 29119 docs/dev/BUILD.md
PR 29120 docs/dev/BUILD.md
PR 29123 docs/dev/BUILD.md

@github-actions github-actions Bot added docs agc libSceAgc* labels Dec 4, 2026
@JJenkx

JJenkx commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

I followed up on the overlap report by reading the shared-file diffs for all 24 listed heads. The three changes that touch the same native JSON output in FrameReplay.cpp are #11435 (16aa59fde801), #15136 (7028c55d7eb0), and #19557 (1b2570f65d5f). The macOS replay changes in #19610 affect mapping and platform setup. The documentation changes in the listed PRs also leave the replay evidence paragraph edited here alone.

For each of the three serializer changes, I checked a local source preview that adds skipped_bytes and its matching integer argument immediately after skipped_mib. Each preview retained the other PR's output fields and calculations. Those previews were source checks. The four files in #28844 also apply cleanly to main e3cd13806921, and the three targeted Python tests passed there, including the saved-assessment check and invalid exact-count rejection.

I also checked the newer #28857 head 4f6513d066 against 68697da8fa8f on main c4101d6da4cc. Its changes to the two shared files apply in either order and produce byte-identical source and documentation. The Python replay tools passed 39 tests with three Windows-only skips in the combined source check.

AI-assisted: yes.

@Baejoe

Baejoe commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Independent check on Windows 11 x64 with MSYS2 UCRT64 Python 3.14.10 at PR head 68697da8fa8f. The test_frame_replay_report and test_frame_replay_compare suites passed all 42 tests, including the three Windows-only tests.

I ran frame_replay_sweep.py on the same two synthetic saved bundles using the parent reporter (e3cd13806921) and the PR reporter. Both bundles reported skipped_mib: 0.0. The parent counted the candidate with skipped_bytes: 4096 as healthy (1/1). The PR flagged it as an evidence issue (0/1), and the candidate with skipped_bytes: 0 stayed healthy (1/1) in both runs. Both runs left the saved inputs unchanged.

Scope: Python reporting and saved bundles. AI-assisted: yes.

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

Verified on Windows 11: Python 3.13.7 for the report tool, WinLibs GCC 15.2.0 r7 (Release) for agc_frame_replay. I applied the diff of 68697da8fa to main 63b98e5bf8.

  • test_frame_replay_report, test_frame_replay_compare and test_frame_capture_minimize_replay: 64 tests, OK.
  • Negative control, with only frame_replay_report.py reverted: test_exact_skipped_page_disqualifies_an_otherwise_healthy_run fails ([] != ['native replay skipped memory ranges'] for skipped_bytes=4096, skipped_mib=0.0), and so do the four invalid-count subtests of test_invalid_exact_skip_count_fails_native_result_validation.
  • agc_frame_replay builds with the new printf argument, with no format warning. agc_driver_frame_replay_submits, _shader_output and _run_report, which run the tool, pass.

Not run: Linux, a real replay with skipped ranges.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 4782a79 into boykopovar:main Dec 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants