feat(agc): configure trace event buffers #5808

Merged
Ondra97 merged 1 commit from upstream-pr/5808 into main 2026-10-14 14:10:28 +00:00
Ondra97 commented 2026-10-14 11:50:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T11:50:55Z.


What

#5786 reports that Hades II's queue-worker trace buffer fills about 3.3 seconds into a 30-second window, leaving most worker slices out of the trace. Add APS5_TRACE_EVENTS=<count> to size the queue-worker and presenter buffers from 1 through 4,194,304 events. The default remains 262,144; invalid values throw before the thread binds. Document the memory cost and add capacity and validation regressions.

Shader preparation retains its explicitly sized buffers, the GPU range limit stays unchanged, and summary-only sessions allocate no event buffers. This addresses the configurable-capacity part of #5786; per-thread drop reasons and cutoff markers remain open.

Tested

Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0, Release, bundled dependencies. Full build passed after rebase on 344afad05. Four focused CTest cases passed in 1.34 s: agc_performance_trace, agc_profile_output, agc_driver_draw_cache_reuse, and agc_driver_prepared_graphics. GPU tests required Vulkan. Conventions and whitespace checks passed.

The capacity regression retains 262,145 slices, bounds the next append, and preserves totals past the limit. Parser tests cover the unchanged default, minimum, maximum, larger values, malformed values, and integer overflow.

Visible VLC v0.4 homebrew runs (PPSA85300, public release), with a 5:5 seconds window. Counts were read from the resulting compressed trace files:

Driver Requested events Queue-worker events Presenter events trace_dropped
main 23be5a02b075 16 19,272 7,019 false
this change 16 16 16 true
final head 1effd67b7012 3,145,728 19,613 6,910 false

Every run used APS5_NO_DRAW_SRT_ENTRIES=1 to isolate tracing from the VLC draw-cache issue addressed by #5791. The executable was relinked locally, runtime libraries were copied and SHA-256 verified, and runs were intentionally stopped after 20 s. The changed 16-event capture used aa84bef8b43d; the trace implementation and capacity tests are identical in the final head. The larger-buffer capture carries commit=1effd67b7012 and dirty=false, from the final host build. Hades II, Linux, and other GPUs were not run; no speed improvement is claimed.

Before starting, checked current open-PR heads and shared implementations. Refreshed 449 open PR file lists before publication; #5046 and #5047 add batch IDs to traces and #5238 documents shader-address tracing, with no implementation of configurable event capacity.

Checklist

  • 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: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.14 (Windows driver 32.0.16.1714), Windows 11 Pro 10.0.26300
  • AI-assisted: yes, Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4857418990 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-14T11:50:55Z. --- ### What #5786 reports that Hades II's queue-worker trace buffer fills about 3.3 seconds into a 30-second window, leaving most worker slices out of the trace. Add `APS5_TRACE_EVENTS=<count>` to size the queue-worker and presenter buffers from 1 through 4,194,304 events. The default remains 262,144; invalid values throw before the thread binds. Document the memory cost and add capacity and validation regressions. Shader preparation retains its explicitly sized buffers, the GPU range limit stays unchanged, and summary-only sessions allocate no event buffers. This addresses the configurable-capacity part of #5786; per-thread drop reasons and cutoff markers remain open. ### Tested Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0, Release, bundled dependencies. Full build passed after rebase on `344afad05`. Four focused CTest cases passed in 1.34 s: `agc_performance_trace`, `agc_profile_output`, `agc_driver_draw_cache_reuse`, and `agc_driver_prepared_graphics`. GPU tests required Vulkan. Conventions and whitespace checks passed. The capacity regression retains 262,145 slices, bounds the next append, and preserves totals past the limit. Parser tests cover the unchanged default, minimum, maximum, larger values, malformed values, and integer overflow. Visible VLC v0.4 homebrew runs (PPSA85300, [public release](https://github.com/ZiZc3/VLC/releases/tag/v0.4)), with a `5:5` seconds window. Counts were read from the resulting compressed trace files: | Driver | Requested events | Queue-worker events | Presenter events | `trace_dropped` | |---|---:|---:|---:|---| | main `23be5a02b075` | 16 | 19,272 | 7,019 | false | | this change | 16 | 16 | 16 | true | | final head `1effd67b7012` | 3,145,728 | 19,613 | 6,910 | false | Every run used `APS5_NO_DRAW_SRT_ENTRIES=1` to isolate tracing from the VLC draw-cache issue addressed by #5791. The executable was relinked locally, runtime libraries were copied and SHA-256 verified, and runs were intentionally stopped after 20 s. The changed 16-event capture used `aa84bef8b43d`; the trace implementation and capacity tests are identical in the final head. The larger-buffer capture carries `commit=1effd67b7012` and `dirty=false`, from the final host build. Hades II, Linux, and other GPUs were not run; no speed improvement is claimed. Before starting, checked current open-PR heads and shared implementations. Refreshed 449 open PR file lists before publication; #5046 and #5047 add batch IDs to traces and #5238 documents shader-address tracing, with no implementation of configurable event capacity. ### Checklist - [x] 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: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.14 (Windows driver 32.0.16.1714), Windows 11 Pro 10.0.26300 - [x] AI-assisted: yes, Codex
MarcZX10 commented 2026-10-14 13:12:57 +00:00 (Migrated from github.com)

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


One overlap to coordinate before merge: open PR #5813 also adds APS5_TRACE_EVENTS in PerformanceTrace.hpp, with a different accepted range and shader-prepare sizing, alongside the per-thread drop reporting. This PR is the capacity-only piece; #5813 includes that same setting while completing the diagnostics requested in #5786. Please compare with Eli and agree which PR carries the shared parser/capacity behavior; the second branch will need a rebase or an explicit dependency.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169182538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169182538). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T13:12:57Z. --- One overlap to coordinate before merge: open PR #5813 also adds `APS5_TRACE_EVENTS` in `PerformanceTrace.hpp`, with a different accepted range and shader-prepare sizing, alongside the per-thread drop reporting. This PR is the capacity-only piece; #5813 includes that same setting while completing the diagnostics requested in #5786. Please compare with Eli and agree which PR carries the shared parser/capacity behavior; the second branch will need a rebase or an explicit dependency.
eliyarson commented 2026-10-14 13:22:05 +00:00 (Migrated from github.com)

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


@Ondra97 I opened #5813 for the same issue a few minutes after this, without having seen it. Since this one came first and is the capacity-only piece, I'll let it carry APS5_TRACE_EVENTS: I'm rebasing #5813 on top of this branch, dropping my parser, bounds and capacity tests, and marking it Depends on #5808. #5813 will then only add the per-thread drop details (trace_dropped_threads, the trace buffer full marker) and, if it fits your parser without changes, the shader-prepare buffer following the setting at an eighth. Thanks @MarcZX100 for spotting it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169358798 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169358798). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T13:22:05Z. --- @Ondra97 I opened #5813 for the same issue a few minutes after this, without having seen it. Since this one came first and is the capacity-only piece, I'll let it carry `APS5_TRACE_EVENTS`: I'm rebasing #5813 on top of this branch, dropping my parser, bounds and capacity tests, and marking it `Depends on #5808`. #5813 will then only add the per-thread drop details (`trace_dropped_threads`, the `trace buffer full` marker) and, if it fits your parser without changes, the shader-prepare buffer following the setting at an eighth. Thanks @MarcZX100 for spotting it.
Ondra97 commented 2026-10-14 13:23:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T13:23:01Z.


Thanks, I compared both patches. I propose landing #5808 as the capacity-only change first, then rebasing #5813 on it for the drop diagnostics.

The 4,194,304-event limit accommodates the roughly 2.5 million events reported in #5786 while bounding the event buffer to 128 MiB per thread. Buffers are allocated before the capture window opens, and formatting requires additional memory, so I chose a conservative upper bound. Allowing small capacities also makes buffer exhaustion easy to reproduce in runtime checks.

I kept shader-prepare buffers at their existing explicit size so increasing queue-worker capture capacity does not also increase allocations across shader workers. Extending that behavior and raising the maximum to 512 MiB per thread can be reviewed separately.

This keeps the capacity change small and independently reviewable, while #5813 adds the complementary per-thread loss reporting and cutoff markers.

@eliyarson, would this merge order work for you?

AI-assisted: yes. — Codex

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169376581 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169376581). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-14T13:23:01Z. --- Thanks, I compared both patches. I propose landing #5808 as the capacity-only change first, then rebasing #5813 on it for the drop diagnostics. The 4,194,304-event limit accommodates the roughly 2.5 million events reported in #5786 while bounding the event buffer to 128 MiB per thread. Buffers are allocated before the capture window opens, and formatting requires additional memory, so I chose a conservative upper bound. Allowing small capacities also makes buffer exhaustion easy to reproduce in runtime checks. I kept shader-prepare buffers at their existing explicit size so increasing queue-worker capture capacity does not also increase allocations across shader workers. Extending that behavior and raising the maximum to 512 MiB per thread can be reviewed separately. This keeps the capacity change small and independently reviewable, while #5813 adds the complementary per-thread loss reporting and cutoff markers. @eliyarson, would this merge order work for you? AI-assisted: yes. — Codex
Ondra97 commented 2026-10-14 13:27:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T13:27:39Z.


Thanks @eliyarson, that works for me — our comments crossed. For shader-prepare sizing in #5813, please keep the parser unchanged and ensure the one-eighth share remains at least one event for accepted capacities below eight.

AI-assisted: yes. — Codex

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169469043 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169469043). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-14T13:27:39Z. --- Thanks @eliyarson, that works for me — our comments crossed. For shader-prepare sizing in #5813, please keep the parser unchanged and ensure the one-eighth share remains at least one event for accepted capacities below eight. AI-assisted: yes. — Codex
eliyarson commented 2026-10-14 13:36:43 +00:00 (Migrated from github.com)

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


@Ondra97 Thanks. I took the shader-prepare sizing out of #5813 for now: it is #5808 plus one commit with only the drop details, and your parser and sizes are untouched. I'll propose the eighth share, kept at no less than one event, in a separate PR once #5808 is in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169645201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169645201). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T13:36:43Z. --- @Ondra97 Thanks. I took the shader-prepare sizing out of #5813 for now: it is #5808 plus one commit with only the drop details, and your parser and sizes are untouched. I'll propose the eighth share, kept at no less than one event, in a separate PR once #5808 is in.
adriadam10 commented 2026-10-14 13:41:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:41:14Z.


Checked the build and the scoped ctest (agc_performance_trace passes; the new CapacitySettings case fails to build without the change), the parser edge cases (empty, 0, signs, spaces, max+1, overflow) and the docs against the code; shader prepare keeps its 32,768-event buffers. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169744605 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5808#issuecomment-6169744605). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T13:41:14Z. --- Checked the build and the scoped ctest (`agc_performance_trace` passes; the new `CapacitySettings` case fails to build without the change), the parser edge cases (empty, 0, signs, spaces, max+1, overflow) and the docs against the code; `shader prepare` keeps its 32,768-event buffers. 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!5808
No description provided.