feat(agc): toggle runtime switches in alternating phases of one run #8160

Merged
Celegans12 merged 1 commit from upstream-pr/8160 into main 2026-10-27 08:34:50 +00:00
Celegans12 commented 2026-10-20 00:56:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-20T00:56:48Z.


What

Comparing a driver switch across two runs mixes its effect with the drift between the runs (camera position, streaming, GPU clocks), which on Ghost of Yōtei (PPSA26344) is often larger than the effect itself. This lets one run alternate two settings in phases, so neighbouring phases see nearly the same scene.

  • APS5_AB=<seconds>:<switch>[+<switch>...] alternates phase A (switches as the environment sets them) and phase B (the listed switches toggled together). Phases change at a flip packet, after the draw pipeline drained, under the GPU mutex, at the first flip at least <seconds> after the phase began. APS5_AB_START (flip count or <n>s) delays the first phase; APS5_AB_SETTLE (default 2 s) marks when reports stop mixing both settings. Each change prints an [ab] line through ProfileOutput.
  • The switches are a fixed table in RuntimeSwitches, one relaxed atomic each, starting as the environment sets it. A name is listed only when every read of it is exact under either value at any moment. The first is APS5_NO_BARRIER_BATCH: each elision is decided per barrier from the covered access, which is tracked either way.
  • Any other name, a duplicate or a malformed value fails the first flip. Without APS5_AB nothing changes.

#8161, stacked on this one, adds tools/ab_split.py to split the periodic reports by phase.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 4b1a9a3b2f, -DBUILD_TESTING=ON: the new tests and 5 neighbours (barrier batch, flip, flip compute, profile output, env reference) 7/7 with --repeat until-fail:3; full ctest not run.
  • New agc_runtime_switches and agc_runtime_switches_refused (parsing and refusals, the phase schedule, switch values and [ab] lines across A, B, A). They don't build on main; with phase B not toggling, the first fails.
  • Validation layer: no VUID- errors in agc_driver_flip or agc_driver_flip_compute.
  • On our Yōtei tree (same registry, more switches) every speed change this week was decided this way. With APS5_AB=60:APS5_NO_OWNED_PROOFS, presents per 10 s climbed from 5.5 to 8.6 across the A phases, yet B minus neighbouring A stayed at -0.61 ± 0.06 (SE, 9 pairs). A change two separate runs had put at -9 % measured -0.09 ± 0.15 in one A/B run.
  • Linux (WSL, gcc 13.3, lavapipe), CI's job on the merge with current main: the same tests and #8161's 8/8.
  • Not tested: AMD, Intel.

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
  • Fixes: none
  • Unblocks: PPSA26344 #675
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4929455946 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8160). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-20T00:56:48Z. --- ### What Comparing a driver switch across two runs mixes its effect with the drift between the runs (camera position, streaming, GPU clocks), which on Ghost of Yōtei (PPSA26344) is often larger than the effect itself. This lets one run alternate two settings in phases, so neighbouring phases see nearly the same scene. - `APS5_AB=<seconds>:<switch>[+<switch>...]` alternates phase A (switches as the environment sets them) and phase B (the listed switches toggled together). Phases change at a flip packet, after the draw pipeline drained, under the GPU mutex, at the first flip at least `<seconds>` after the phase began. `APS5_AB_START` (flip count or `<n>s`) delays the first phase; `APS5_AB_SETTLE` (default 2 s) marks when reports stop mixing both settings. Each change prints an `[ab]` line through ProfileOutput. - The switches are a fixed table in `RuntimeSwitches`, one relaxed atomic each, starting as the environment sets it. A name is listed only when every read of it is exact under either value at any moment. The first is `APS5_NO_BARRIER_BATCH`: each elision is decided per barrier from the covered access, which is tracked either way. - Any other name, a duplicate or a malformed value fails the first flip. Without `APS5_AB` nothing changes. #8161, stacked on this one, adds `tools/ab_split.py` to split the periodic reports by phase. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 4b1a9a3b2f, -DBUILD_TESTING=ON: the new tests and 5 neighbours (barrier batch, flip, flip compute, profile output, env reference) 7/7 with `--repeat until-fail:3`; full ctest not run. - New `agc_runtime_switches` and `agc_runtime_switches_refused` (parsing and refusals, the phase schedule, switch values and `[ab]` lines across A, B, A). They don't build on `main`; with phase B not toggling, the first fails. - Validation layer: no `VUID-` errors in `agc_driver_flip` or `agc_driver_flip_compute`. - On our Yōtei tree (same registry, more switches) every speed change this week was decided this way. With `APS5_AB=60:APS5_NO_OWNED_PROOFS`, presents per 10 s climbed from 5.5 to 8.6 across the A phases, yet B minus neighbouring A stayed at -0.61 ± 0.06 (SE, 9 pairs). A change two separate runs had put at -9 % measured -0.09 ± 0.15 in one A/B run. - Linux (WSL, gcc 13.3, lavapipe), CI's job on the merge with current `main`: the same tests and #8161's 8/8. - Not tested: AMD, Intel. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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] Fixes: none - [x] Unblocks: PPSA26344 #675 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62, Windows 11 - [x] AI-assisted: yes
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!8160
No description provided.