feat(agc): report which trace threads dropped events and where their buffers filled #5813

Merged
eliyarson merged 1 commit from upstream-pr/5813 into main 2026-10-14 17:10:19 +00:00
eliyarson commented 2026-10-14 11:57:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-14T11:57:10Z.


What

Refs #5786. Depends on #5808, which adds APS5_TRACE_EVENTS; this branch is #5808's commit plus one commit, and only the second is new here.

trace_dropped says that a trace lost data, but not which thread, from when, or whether the summary numbers are affected. When it is true, the summary line now also carries trace_dropped_threads, one entry per affected thread name:

  • events_full_after_s: seconds from the window's first present to the start of the first lost slice. Absent for gpu, and absent whenever that slice starts outside the line's span of presents.
  • events_lost: slices not recorded (absent when 0). In APS5_TRACE_SUMMARY_EVERY lines it counts the buffer's losses since it started.
  • totals_full: the thread's totals table overflowed, so the summary numbers are incomplete. A thread with only events_lost has complete totals.

Threads that share a name, such as the shader prepare threads, share one entry: losses are summed, the earliest fill is kept, and totals_full is true if any of them is.

The Chrome trace gets a trace buffer full instant event on the thread where its buffer filled.

trace_dropped is set on the same conditions as before, and when nothing drops the output is byte-identical. #5808's parser, bounds and buffer sizes are unchanged; sizing the shader prepare buffers from APS5_TRACE_EVENTS is left for a follow-up after #5808 lands.

Overlap: #5046 edits the same lines of PerformanceTrace.hpp; whichever lands second needs a rebase. #4969 and #5453 also touch docs/dev/BUILD.md, different sections.

Tested

Linux x86-64 (CachyOS, kernel 7.2.2), RTX 3080 Ti, NVIDIA 610.57.04.

  • agc_performance_trace (new cases: per-thread entries, same-named threads merged, the interval-line bounds of events_full_after_s, lost-event counts, totals overflow, the buffer-full event), ctest -R '^agc_|trace' on #5808's head 1effd67b7 plus this commit (518 tests, all pass except agc_driver_stencil_ref_export, skipped as on main), tools/check_conventions.py.

  • Hades II, title screen, APS5_TRACE_SECONDS=150:30, on the earlier revision of this PR (its own capacity setting instead of #5808's; the drop reporting is the same apart from the merge by name):

    • default buffer: "trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":27.47,"events_lost":24059,"totals_full":false}}, and the trace buffer full marker sits at that point of the queue-0 track.
    • APS5_TRACE_EVENTS=4194304: "trace_dropped":false, no trace_dropped_threads, queue-0 track recorded to the end of the window (293,343 slices).

    The title screen fills the buffer late; in the hub (#5786) the default buffer fills after about 3.3 s.

  • Not tested: Windows, other GPUs; no game run on the rebased branch.

Checklist

  • Based on #5808, which is based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #5808
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 Ti, driver 610.57.04, Linux (CachyOS)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4857491438 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5813). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T11:57:10Z. --- ### What Refs #5786. Depends on #5808, which adds `APS5_TRACE_EVENTS`; this branch is #5808's commit plus one commit, and only the second is new here. `trace_dropped` says that a trace lost data, but not which thread, from when, or whether the summary numbers are affected. When it is true, the summary line now also carries `trace_dropped_threads`, one entry per affected thread name: - `events_full_after_s`: seconds from the window's first present to the start of the first lost slice. Absent for `gpu`, and absent whenever that slice starts outside the line's span of presents. - `events_lost`: slices not recorded (absent when 0). In `APS5_TRACE_SUMMARY_EVERY` lines it counts the buffer's losses since it started. - `totals_full`: the thread's totals table overflowed, so the summary numbers are incomplete. A thread with only `events_lost` has complete totals. Threads that share a name, such as the shader prepare threads, share one entry: losses are summed, the earliest fill is kept, and `totals_full` is true if any of them is. The Chrome trace gets a `trace buffer full` instant event on the thread where its buffer filled. `trace_dropped` is set on the same conditions as before, and when nothing drops the output is byte-identical. #5808's parser, bounds and buffer sizes are unchanged; sizing the shader prepare buffers from `APS5_TRACE_EVENTS` is left for a follow-up after #5808 lands. Overlap: #5046 edits the same lines of `PerformanceTrace.hpp`; whichever lands second needs a rebase. #4969 and #5453 also touch `docs/dev/BUILD.md`, different sections. ### Tested Linux x86-64 (CachyOS, kernel 7.2.2), RTX 3080 Ti, NVIDIA 610.57.04. - `agc_performance_trace` (new cases: per-thread entries, same-named threads merged, the interval-line bounds of `events_full_after_s`, lost-event counts, totals overflow, the buffer-full event), `ctest -R '^agc_|trace'` on #5808's head `1effd67b7` plus this commit (518 tests, all pass except `agc_driver_stencil_ref_export`, skipped as on `main`), `tools/check_conventions.py`. - Hades II, title screen, `APS5_TRACE_SECONDS=150:30`, on the earlier revision of this PR (its own capacity setting instead of #5808's; the drop reporting is the same apart from the merge by name): - default buffer: `"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":27.47,"events_lost":24059,"totals_full":false}}`, and the `trace buffer full` marker sits at that point of the queue-0 track. - `APS5_TRACE_EVENTS=4194304`: `"trace_dropped":false`, no `trace_dropped_threads`, queue-0 track recorded to the end of the window (293,343 slices). The title screen fills the buffer late; in the hub (#5786) the default buffer fills after about 3.3 s. - Not tested: Windows, other GPUs; no game run on the rebased branch. ### Checklist - [x] Based on #5808, which is based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #5808 - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080 Ti, driver 610.57.04, Linux (CachyOS) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-14 13:12:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T13:12:59Z.


I found an overlapping open PR: #5808 also adds APS5_TRACE_EVENTS to PerformanceTrace.hpp, but sets a different max and does not size the shader-prepare buffer. Your PR includes both the capacity setting and the drop diagnostics. Please coordinate with Ondra97 on which branch should carry the common capacity/parser behavior, and declare a dependency or rebase the second branch as appropriate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169183146 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5813#issuecomment-6169183146). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T13:12:59Z. --- I found an overlapping open PR: #5808 also adds `APS5_TRACE_EVENTS` to `PerformanceTrace.hpp`, but sets a different max and does not size the shader-prepare buffer. Your PR includes both the capacity setting and the drop diagnostics. Please coordinate with Ondra97 on which branch should carry the common capacity/parser behavior, and declare a dependency or rebase the second branch as appropriate.
eliyarson commented 2026-10-14 13:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-14T13:22:07Z.


Thanks @MarcZX100. I've agreed with #5808 that it carries APS5_TRACE_EVENTS; I'm rebasing this PR on top of it so it only adds the per-thread drop details and marker, and will mark it Depends on #5808 once pushed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169359458 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5813#issuecomment-6169359458). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T13:22:07Z. --- Thanks @MarcZX100. I've agreed with #5808 that it carries `APS5_TRACE_EVENTS`; I'm rebasing this PR on top of it so it only adds the per-thread drop details and marker, and will mark it `Depends on #5808` once pushed.
adriadam10 commented 2026-10-14 14:15:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T14:15:59Z.


Checked on current main: the only conflict was adjacency in tests/PerformanceTrace.cpp (BatchIds from #5046 next to FullBufferEvents); I kept both and rebased onto main (this branch still carries #5808's commit, so it lands after #5808). agc_performance_trace passes on the rebased tree, the new cases fail to build without the change, and lost/firstLost are published safely (first loss time stored before the release store of the count). The BUILD.md text matches the code. Merging once #5808 is in and the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170457028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5813#issuecomment-6170457028). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T14:15:59Z. --- Checked on current `main`: the only conflict was adjacency in `tests/PerformanceTrace.cpp` (`BatchIds` from #5046 next to `FullBufferEvents`); I kept both and rebased onto `main` (this branch still carries #5808's commit, so it lands after #5808). `agc_performance_trace` passes on the rebased tree, the new cases fail to build without the change, and `lost`/`firstLost` are published safely (first loss time stored before the release store of the count). The `BUILD.md` text matches the code. Merging once #5808 is in and the full Build is green.
adriadam10 commented 2026-10-14 16:58:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T16:58:55Z.


#5808 is merged, and this branch conflicted with main again; I rebased it, which dropped #5808's commit and left only this one. agc_performance_trace passes on the rebased tree, the new cases fail to build without the change, and lost/firstLost are published safely (first loss time stored before the release store of the count). The BUILD.md text matches the code. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6173732207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5813#issuecomment-6173732207). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T16:58:55Z. --- #5808 is merged, and this branch conflicted with `main` again; I rebased it, which dropped #5808's commit and left only this one. `agc_performance_trace` passes on the rebased tree, the new cases fail to build without the change, and `lost`/`firstLost` are published safely (first loss time stored before the release store of the count). The `BUILD.md` text matches the code. Merging once the full Build is green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5813
No description provided.