perf(agc): wait on a flush only for writers over the image layers it stores #8887

Merged
SleglJan merged 5 commits from upstream-pr/8887 into main 2026-11-02 07:57:08 +00:00
SleglJan commented 2026-10-21 04:45:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-21T04:45:32Z.


What

FlushPending waits for the newest unfinished batch that writes in the flushed range (#6364), under the GPU mutex: it submits the open
batch, or finishes the in-flight ones up to that writer. Its write-backs, though, store only the pending layers the range overlaps, or
every pending layer when the image stores whole (DCC keys not uncompressed) or may widen a partial store. A writer elsewhere in the range
cannot be overwritten by those stores, so waiting for it only drains the queue.

The flush now asks for writers over the 64 KiB blocks of the layers it stores, the granularity of the write-back's own unit publishes:

  • an image with many separate pending runs is checked over their hull;
  • for an image that stores whole, that includes its pending layers outside the range, which the range check left out;
  • an image with DCC metadata and more than one mip is checked over all of its pending layers too: more than today's write-back stores for
    it, so the check stays sufficient if the write-back comes to store such an image whole (as #8707 proposes while another live image overlaps it);
  • when the flush publishes unit shadows, an address-based dispatch's heap lease over the range is still waited for: such a dispatch stamps
    its pages only at completion, so the publish could not tell its writes from fresh shadow units otherwise;
  • when the flush publishes unit shadows, it also waits for writers over the live shadowed units the publish selects (whole units, hulled beyond eight runs; 3bc40d969e, from imellag's review; rebuilt after every reap and finish, ec47dad254): a label or packet store deferred to a completion and a CPU write-back of a copied buffer stamp their blocks only when their batch is reaped, so the publish could not tell a unit under them from a fresh one either. The wait is conservative (it also covers a writer whose own stamp makes the publish drop the unit) and costs one registry lookup when no such unit lies in the range, plus one after each reap and finish in a flush that waits.

APS5_FLUSH_WAIT_WHOLE_RANGE=1 checks the whole range as before (row in docs/dev/ENVIRONMENT.md).

tests/execution/StorageFlushOrdering.cpp gains three cases, each with a GPU fill noted in the open batch:

  • a fill inside the flushed range but past the image's pending layer, which the flush no longer submits or waits for, while both the
    image's texel and the fill land;
  • a fill inside the pending layer, which it still waits for, so that the fill's block keeps its bytes and a texel in another block is
    stored;
  • a fill over a live shadowed unit outside the flushed image's layers, which a publishing flush waits for, while the fill's bytes stay and the unit the fill did not touch is published (3bc40d969e). The fill stamps when recorded, so the case can pin the wait, not the late-stamp race. It needs a write watch and an image whose write-back retiles into the unit shadow: the shadowed image is tiled (ec47dad254; at 3bc40d969e it was linear, so not block-tracked, and the case skipped on every device), and the case skips unless both of its 64 KiB units went into the shadow; lavapipe, which has no write watch, skips it earlier. No test reaches a unit shadowed during the flush's reap.

tests/Recorder.cpp gains agc_storage_flush_wait_mip_chain: a three-mip DCC image with uncompressed keys, flushed over its first unit,
completes the batch of a writer over its last pending unit. Its runner reports a device without host imports, or with an alignment that does
not divide 64 KiB, as Skipped (exit code 77). ANYPS5_TEST_HOST_IMPORT_ALIGNMENT (row in docs/dev/ENVIRONMENT.md) stands in for the
device's alignment in the recorder tests, so both skips can be exercised on one device; a value that is not a number or not a multiple of
the device's alignment fails the run.

Why it is safe

  • A write-back stores only the blocks of the layers it stores. A writer outside those blocks cannot be overwritten by it, and the skip
    decision for the stored blocks is unchanged.
  • The publish after the stores is the other way a flush can put bytes over a writer outside those blocks. A unit whose block a writer stamped since the retile is dropped, not published; writers that stamp only when their batch is reaped are waited for, an address-based dispatch by its heap lease over the whole range and the other two over the live units the publish selects (above). The edge that was left (the live units were read once, before the flush reaped) is closed by ec47dad254, as hardening: on the routes found, a completion that retiles a unit there does so through a nested flush whose hook runs a full Sync, which finishes the later batches first; the flush now rebuilds its wait set after every reap and finish and waits again when a later writer appears, so it no longer relies on that Sync.
  • Since #9685 the flush skips a drawn linear target's own earlier stores when it stores that target alone and the target has a host
    import; the per-layer check passes
    the same notes to each range, and APS5_FLUSH_WAIT_WHOLE_RANGE=1 is main's check including that skip. Not measured: the waits this
    change adds where two drawn linear targets, or a drawn target and a label or GPU fill, share one 64 KiB block; main checks the
    target's exact bytes there, this change its rounded block.
  • Checked in shadow on 007 First Light (PPSA11386), in a run from boot through about 10 minutes of gameplay, on a local tree with a local
    diagnostic (the title with a local patch for #6172). The check it evaluated is this change without the DCC mip clause and without the wait over live shadowed units (3bc40d969e, rebuilt after every reap in ec47dad254), both of which only add waits:
    • For each wait the flush does today, the diagnostic evaluated this change's check before the wait and classified the wait:
      • skipped (no submit, no wait): 12,743;
      • reap-only (completes finished batches, no submit and no wait): 22;
      • wait for an older writer than today: 95;
      • unchanged: 18,360.
    • After each wait it looked at every block the write-back kept. A kept block counts as depending on the wait when its newest stamp
      falls in the time this change would have skipped.
    • 0 such blocks in every class: 0 of the 41 keeps after skipped waits and 0 of the 1 after an older-writer wait.
    • The diagnostic is local and not in this PR.
  • With APS5_FLUSH_WAIT_WHOLE_RANGE=1 on the RTX 3080, agc_driver_storage_flush_ordering fails at its first new case (the writer
    outside the pending layers; the test stops there) and agc_storage_flush_wait_mip_chain fails, so the tests tell the two checks apart.
    The second flush ordering case waits under both checks.

Tested

  • Head 91cec4330f (2026-11-01): the same four commits rebased onto main f2d874c1fd; the one conflict was in the recorder tests' main(), where main now passes binaryTest to the Device constructor on the line this PR's TestConfigurationError catch follows, resolved by keeping both. On an AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4-arch3.1, Linux 7.2.10, CachyOS; power cap 243 W), -R '^agc': 1,148 passed, 17 skipped, 2 failed of 1,167, the failures agc_driver_tessellation (SEGFAULT; its output ends with the device setup's lines) and agc_idle_publish_wait ("the idle publish's bytes are wrong"); main f2d874c1fd built the same way on this device: 1,147 passed, 17 skipped, 2 failed of 1,166, the same two names and the same 17 skipped names; the one test this PR adds, agc_storage_flush_wait_mip_chain, is the count's difference. agc_driver_storage_flush_ordering passes, but its shadowed-unit case skips on this card ("the write-back did not retile both units into the unit shadow: the shadowed-unit case is skipped"), so this card does not exercise the shadowed-unit case; agc_storage_flush_wait_mip_chain runs ("flush wait over a DCC mip chain: ok"). On lavapipe (Mesa 26.2.4, LLVM 23.1.1, in the container of the 1f15e200f7 entry below, -j16): 1,035 passed, 90 skipped, 42 failed of 1,167, the 40 that main 0836dfdf4f fails there (40 of 1,143, same names) plus agc_driver_f64_fma_denormal_modes and agc_driver_f64_div_scale_denormal_modes, main's new tests from #13845 and #13846; main f2d874c1fd built the same way there fails the same 42 names of 1,166 with 90 skipped.
  • Head ec47dad254 (2026-10-31): on the RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS), agc_driver_storage_flush_ordering passes with the shadowed-unit case run, and fails with "storage flush ordering, shadowed unit under a writer outside the flushed image's layers: the flush did not wait for the writer over the shadowed unit it publishes" when the live units are left out of the wait set; -R '^agc': 1,055 passed, 10 skipped, 1 failed of 1,066, the failure agc_driver_mesh_barycentric_emulation as on main f759e165d9 below. On lavapipe the case skips (no write watch) and -R '^agc' gives 949 passed, 84 skipped and the same 33 failed of 1,066 as at 3bc40d969e.
  • Head ec47dad254 on macOS (imellag, 2026-10-31, comment): Apple M4 Pro, macOS 27.2,
    MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), x86-64 Release under Rosetta 2, the validation layer inserted on both sides. main does not build the
    driver on macOS on its own, so the base is imellag's support branch support/macos-boot-1030c 05bd71a66b (main 21a556f567 plus the open
    macOS PRs) and the change side that branch with ec47dad254 merged. Of the storage flush tests (#12070's pattern plus
    storage_flush_wait_mip_chain), the base passes 25 of 25 and this head 26 of 26, including agc_driver_storage_flush_ordering and
    agc_storage_flush_wait_mip_chain. The ordering test logged no skip line, so the shadowed-unit case appears to have run there; lavapipe
    skips it, so this is the first device off NVIDIA where it appears to have run. The only VUID- on the change side is
    VUID-VkDeviceCreateInfo-pProperties-04451 (2 lines, VK_KHR_portability_subset not enabled), from agc_storage_flush_wait_mip_chain,
    which imellag traces to the recorder tests' existing device setup, not to this change.
  • 007 First Light main menu, main without and with this change, the current measurement (2026-10-31), captured as the Performance report form describes:
    • A: main 809c7fa2df. B: main 809c7fa2df with ec47dad254 merged (a local merge commit). Two binaries with the same shader-cache
      version; one shader-cache seed, made on A by a run from an empty shader cache through the menu and the Resume into gameplay, serves
      both, with the NVIDIA driver cache frozen with it; every run starts warm from it.
    • The title with a local patch for #6172 (both sides), scripted pad input, no APS5_PROFILE_* switch, trace window 180 s from 1,320 s (APS5_TRACE_SECONDS=1320:180,
      APS5_TRACE_EVENTS=2097152, and APS5_TRACE_DIR, which only names the directory the trace and summary files are written to), the menu held for the whole run, main's
      defaults otherwise (the pipeline journal among them); the title's scope runs with swap off. Run order A1 B1 A2 B2 A3: A3 failed a
      validity rule declared before the series (six shader-disk-cache misses in the first 10 s of its boot, where every other measured run
      had none), and the series stopped there; a continuation declared before its runs then added A4 as A's extra, and B3. The table holds
      the first three valid runs of each side, as declared; A3 is left out. The title's output goes to a log file (the sandbox launcher
      redirects it), which the form advises against.
run commit FPS frame p50 / p90 ms GPU busy ms/present
A1 809c7fa2df 1.0056 989.8 / 1,118.2 152.3
B1 809c7fa2df + ec47dad254 1.0444 950.4 / 1,069.0 143.3
A2 809c7fa2df 1.0102 983.2 / 1,103.7 150.1
B2 809c7fa2df + ec47dad254 1.0356 961.4 / 1,082.7 147.6
A4 809c7fa2df 1.0360 952.7 / 1,072.0 145.2
B3 809c7fa2df + ec47dad254 1.0134 987.3 / 1,096.1 149.3
  • FPS (presents over the window's seconds): A 1.0056–1.0360, B 1.0134–1.0444; B/A of the means 1.0136; the ranges overlap (lowest B /
    highest A 0.9782, highest B / lowest A 1.0386). Frame p50: A 952.7–989.8 ms, B 950.4–987.3 ms; B/A of the means 0.9909; the ranges
    overlap (0.9602 and 1.0363 at the range ends). GPU busy per present A 145.2–152.3 ms, B 143.3–149.3 ms. On this main, the menu's
    FPS and frame time do not differ between A and B beyond the run-to-run spread: the ranges overlap. The +2.45 % in the earlier A/B
    below was measured on that earlier stack, not on main.
  • Queue 0's worker, ms per present, A → B, from the traces: Driver.Packet.draw 613–621 → 606–616; Driver.Draw.draw_enqueued 532–539 →
    525–535; Driver.Draw.shader_compile_and_link 72–76 → 72–74; Shader.DrawStage.capture_resources 28–29 → 28–29;
    Driver.Packet.dispatch 281–305 → 281–294; Vulkan.Dispatch 193–215 → 189–200; Driver.Packet as a whole 957–986 → 949–978.
  • This pair runs at 1.0056–1.0444 FPS, with Driver.Draw.draw_enqueued at 525–539 ms per present (both sides); the earlier stack's pair
    below ran at 2.740–2.840 FPS and 45–68 ms. Besides the base, that pair ran the title unpatched, with swap allowed for the title's
    scope, and before main's pipeline journal. Its figures stay below as that stack's record.
  • Summary lines (the B lines' commit field and trace name are a local merge commit's and are masked):
{"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1477,"ms":180981.917},"presents":182,"frame_ms":{"p50":989.775,"p90":1118.178,"p99":1227.940,"max":1243.984},"gpu_busy_ms_per_present":152.293,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.445,"queue worker 0x28":99.702,"queue worker 0x30":99.700,"queue worker 0x38":99.587},"top_phases_ms_per_frame":{"Driver.Packet":4942.752,"Driver.Packet.memory_wait":3455.741,"GpuMutex.wait.hook":931.380,"Resources.Complete":829.201,"Driver.Packet.dispatch":823.578,"Driver.Dispatch":778.522,"Graphics.Draw":614.258,"Driver.Packet.draw":613.440},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"}
{"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1532,"ms":180957.247},"presents":189,"frame_ms":{"p50":950.409,"p90":1068.995,"p99":1212.123,"max":1222.538},"gpu_busy_ms_per_present":143.266,"worker_busy_pct":{"queue worker 0x0":99.940,"queue worker 0x20":99.469,"queue worker 0x28":99.673,"queue worker 0x30":99.677,"queue worker 0x38":99.659},"top_phases_ms_per_frame":{"Driver.Packet":4759.304,"Driver.Packet.memory_wait":3357.369,"Resources.Complete":795.339,"GpuMutex.wait.hook":792.669,"Driver.Packet.dispatch":745.553,"Driver.Dispatch":699.782,"Graphics.Draw":609.515,"Driver.Packet.draw":606.285},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"}
{"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1500,"ms":180164.235},"presents":182,"frame_ms":{"p50":983.204,"p90":1103.687,"p99":1189.840,"max":1272.081},"gpu_busy_ms_per_present":150.148,"worker_busy_pct":{"queue worker 0x0":99.941,"queue worker 0x20":99.451,"queue worker 0x38":99.705,"queue worker 0x28":99.716,"queue worker 0x30":99.502},"top_phases_ms_per_frame":{"Driver.Packet":4920.512,"Driver.Packet.memory_wait":3429.062,"GpuMutex.wait.hook":958.287,"Resources.Complete":822.577,"Driver.Packet.dispatch":819.917,"Driver.Dispatch":776.828,"Graphics.Draw":625.272,"Graphics.Draw.draw_and_resource_release":621.681},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"}
{"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1514,"ms":180579.495},"presents":187,"frame_ms":{"p50":961.443,"p90":1082.719,"p99":1192.333,"max":1217.294},"gpu_busy_ms_per_present":147.574,"worker_busy_pct":{"queue worker 0x0":99.935,"queue worker 0x20":99.541,"queue worker 0x28":99.721,"queue worker 0x30":99.719,"queue worker 0x38":99.693},"top_phases_ms_per_frame":{"Driver.Packet":4798.805,"Driver.Packet.memory_wait":3345.299,"GpuMutex.wait.hook":891.196,"Resources.Complete":798.303,"Driver.Packet.dispatch":792.040,"Driver.Dispatch":744.340,"Graphics.Draw":610.334,"Driver.Packet.draw":607.700},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"}
{"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1527,"ms":180503.198},"presents":187,"frame_ms":{"p50":952.670,"p90":1072.002,"p99":1204.098,"max":1252.461},"gpu_busy_ms_per_present":145.248,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.494,"queue worker 0x28":99.710,"queue worker 0x30":99.540,"queue worker 0x38":99.625},"top_phases_ms_per_frame":{"Driver.Packet":4797.831,"Driver.Packet.memory_wait":3374.813,"GpuMutex.wait.hook":853.180,"Resources.Complete":805.548,"Driver.Packet.dispatch":760.867,"Driver.Dispatch":715.581,"Graphics.Draw":616.207,"Driver.Packet.draw":613.714},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"}
{"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1507,"ms":180583.865},"presents":183,"frame_ms":{"p50":987.271,"p90":1096.114,"p99":1214.466,"max":1249.924},"gpu_busy_ms_per_present":149.261,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.992,"queue worker 0x28":99.988,"queue worker 0x30":99.774,"queue worker 0x38":99.988},"top_phases_ms_per_frame":{"Driver.Packet":4917.724,"Driver.Packet.memory_wait":3445.697,"GpuMutex.wait.hook":985.527,"Resources.Complete":819.965,"Driver.Packet.dispatch":803.000,"Driver.Dispatch":755.687,"Graphics.Draw":620.804,"Graphics.Draw.draw_and_resource_release":617.459},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"}
  • Head 3bc40d969e (2026-10-30): agc_driver_storage_flush_ordering passes on the RTX 3080 and on lavapipe, with the new case skipped on both (above). On lavapipe (the container of the 1f15e200f7 entry below, 2026-10-31), -R '^agc' at 3bc40d969e and at 1f15e200f7, built side by side, gives 949 passed, 84 skipped and the same 33 failed of 1,066 on both; lavapipe has no write watch, so unit shadows are off there and the new wait never applies. The RTX 3080 ^agc run and the other runs below were not repeated on it.
  • Head 1f15e200f7 (2026-10-28): the flush commit rebased onto main f759e165d9 as a94e49393f (its added and removed lines are those of
    f0378179a2; the range-diff shows one changed context row of main's), plus 1f15e200f7 for the test's skip (oneandonlydean's review):
    • lavapipe (Mesa 26.2.4, LLVM 23.1.1) in the Arch Linux container: agc_storage_flush_wait_mip_chain Skipped with
      ANYPS5_TEST_HOST_IMPORT_ALIGNMENT=0 and with =131072, Passed unset, Failed with =abc and with =4095; -R '^agc': 949 passed,
      84 skipped, 33 failed of 1,066, and the 33 are main f759e165d9's own failures on this device (same set, same skips);
    • RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS): the same five cases give the same five results; -R '^agc' -j 8: 1,055 passed,
      10 skipped, 1 failed of 1,066; main f759e165d9 built the same way on it: 1,054 passed, 10 skipped, 1 failed of 1,065, the same ten
      skips and the same failure (agc_driver_mesh_barycentric_emulation, the pixel shader did not emulate barycentrics on both trees).
  • On the rebased head f0378179a2 (main 7e4f6e0440), 2026-10-25:
    • lavapipe (Mesa 26.2.4, LLVM 23.1.1) in an Arch Linux container on a second machine: agc_driver_storage_flush_ordering,
      agc_storage_flush_wait_mip_chain, agc_storage_writeback_blocks, every agc_driver_linear_target_* and
      agc_driver_linear_readback_label* test: 14 of 15 passed, and agc_driver_linear_target_direct_write_completion skipped itself on
      this device (it passes in the RTX 3080 run below);
    • RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS): agc_driver_storage_flush_ordering and agc_storage_flush_wait_mip_chain pass;
      full -R '^agc' -j 8 in a Release build: 1,005 of 1,012 passed, 7 skipped, none failed;
    • with APS5_FLUSH_WAIT_WHOLE_RANGE=1 on the RTX 3080: agc_driver_storage_flush_ordering and agc_storage_flush_wait_mip_chain fail,
      and agc_driver_linear_target_completion_stores (#9685's test that a drawn target stays pending across draws and labels without a
      submission) passes, so the switch keeps #9685's own-store skip.
  • The items below ran on the earlier heads named in each (017123e1d6 on 5d10ea9ea0; the menu runs on the 68323bae7 trees). From
    017123e1d6 to f0378179a2 the patch differs in one added line: the per-layer PendingWriterSerial call takes #9685's new overload with
    the flushed target's own store notes, for each stored range.
  • On lavapipe (Mesa 26.2.4, LLVM 23.1.1), in an Arch Linux container on a second machine, on 5d10ea9ea0:
    • a local commit with the flush ordering test alone (2514ee316c, not in this PR) fails agc_driver_storage_flush_ordering with
      "storage flush ordering, writer outside the image's pending layers: the flush submitted and waited for a writer its stores cannot
      overwrite";
    • this PR's commit with the DCC mip clause reverted (local 8c5d2eb303) fails agc_storage_flush_wait_mip_chain with "flush wait over a
      DCC mip chain: a flush of the first unit did not complete the batch of a writer over another pending unit, which a write-back of a DCC
      image with more than one mip may store", and passes the flush ordering test;
    • this PR's commit 017123e1d6 passes both.
  • Full ctest on an NVIDIA GeForce RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS) at 017123e1d6, -j 16: 1,763/1,766. The three
    failures are net_dontwait_blocking_send, _sendto and _sendmsg ("blocking send: peer never exhausted the send buffers"), libSceNet
    tests this change does not touch; main 5d10ea9ea0 fails them the same way when they run alone on this machine.
  • lavapipe in the same container, -R '^agc': base 5d10ea9ea0 fails 19 of 840 and this PR the same 19 of 841 (the one more test passes);
    they fail on lavapipe without this change.
  • Validation layers, as CONTRIBUTING asks: the storage flush ordering, DCC mip chain and storage write-back tests with
    VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V on the RTX 3080
    (Vulkan-ValidationLayers 1.4.363):
    • this commit passes 5/5, and main 5d10ea9ea0 4/4 (without the new test);
    • neither log reports the layer as not found;
    • neither has a validation message or a VUID-.
  • 007 First Light main menu, an earlier A/B within one binary (the switch), on the same local tree:
    • Tree: main 68323bae7 + #5799 #6868 #5372 #6918 #7643 #6679 + this change without the DCC mip clause (which does not apply in this
      menu, below) and without 3bc40d969e's wait over live shadowed units or ec47dad254's rebuild of it (the measurement on main above has them). The title ran as shipped.
    • A sets APS5_FLUSH_WAIT_WHOLE_RANGE=1; B runs this change. Same binary.
    • Warm shader cache, scripted pad input, APS5_PROFILE_DRAW=1, trace window 180 s from 1,320 s (APS5_TRACE_SECONDS=1320:180,
      APS5_TRACE_EVENTS=2097152).
    • Runs alternating A1 B1 A2 B2 A3 B3, plus A4. Another build ran on the machine during A2, after the menu was reached and before its window
      (19:47–19:57 against a window from about 20:02); A4 was added, and A2 matches the other A runs.
run FPS frame p50 ms GPU busy ms/present
A1 2.728 374.1 182.6
A2 2.726 368.1 183.3
A3 2.740 366.5 182.1
A4 2.713 368.9 182.9
B1 2.777 364.8 182.5
B2 2.894 356.8 169.1
B3 2.785 362.8 182.9
  • Queue 0's worker, ms per present, A1–A4 → B1–B3:
    • Driver.Packet.draw 217–219 → 187–191 (means 218.3 → 188.7, −13.6%);
    • Driver.Draw.draw_enqueued 66–69 → 48–49;
    • Driver.Draw.shader_compile_and_link 145–146 → 135–137;
    • Shader.DrawStage.capture_resources 29–30 → 21–23.
  • Queue 0's worker is about 100% busy in every run, and part of the saving reappears in dispatch time (Driver.Packet.dispatch
    127–129 → 129–132, Vulkan.Dispatch 59–70 → 70–75). So Driver.Packet as a whole goes 361–365 → 355–356 on B1 and B3, and the
    frame gain is small: +2.0% FPS (B1 +1.9%, B3 +2.1%) and −1.5% frame p50 for B1/B3 against the mean of A1–A4.
  • B2 ran in a different menu state (7% less GPU work per present) and is not averaged in: 2.894 FPS, p50 356.8 ms.
  • 007 gameplay, one run of this change (same tree, warm cache, scripted input, the title with a local patch for #6172): no faults, no
    Vulkan errors, the frames render correctly. Its frame rate is not compared: the window's GPU work per frame differs from the reference
    runs.
  • 007 First Light main menu, an earlier stack (measured 2026-10-21) without and with this change, captured as the Performance report form describes; the measurement on main above is the current one, this one stays as that stack's record:
    • A: main 68323bae7 + #5799 #6868 #5372 #6918 #7643 #6679 (local tree 984b9f06de). B: the same + this change (local tree bdf58c66fb).
      Two binaries. Measured on 984b9f06de / bdf58c66fb; the rebase changes no code in the change itself except a conservative clause for
      DCC images with more than one mip and its test, which does not apply in the measured window (below); 3bc40d969e then adds the wait over live shadowed units and ec47dad254 rebuilds it after every reap; the measurement on main above has both.
    • The title as shipped, warm shader cache, scripted pad input, no APS5_PROFILE_* switch, trace window 180 s from 1,320 s; runs
      alternating A1 B1 A2 B2 A3 B3. The title's output goes to a log file (the sandbox launcher redirects it), which the form advises against.
run commit FPS frame p50 / p90 ms GPU busy ms/present
A1 984b9f06de 2.740 368.5 / 411.4 183.2
B1 bdf58c66fb 2.794 359.6 / 403.4 181.7
A2 984b9f06de 2.740 366.7 / 411.2 182.6
B2 bdf58c66fb 2.820 357.8 / 403.2 182.5
A3 984b9f06de 2.772 363.3 / 406.5 182.7
B3 bdf58c66fb 2.840 357.1 / 399.5 182.1
  • +2.45% FPS (means 2.751 → 2.818; the two sides' ranges don't overlap) and −2.2% frame p50 (366.2 → 358.2 ms), at the same GPU work.
  • This A/B (the table, the phases below and the summary lines) was measured before 3bc40d969e and ec47dad254; the measurement on main above includes them.
  • Queue 0's worker, ms per present, A1–A3 → B1–B3, from the traces:
    • Driver.Packet.draw 216–219 → 180–187;
    • Driver.Draw.draw_enqueued 67–68 → 45–49;
    • Driver.Draw.shader_compile_and_link 144–146 → 131–136;
    • Shader.DrawStage.capture_resources 29–31 → 20–22;
    • Driver.Packet.dispatch 123–125 → 131–133;
    • Driver.Packet as a whole 357–361 → 348–354.
  • Summary lines:
{"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3545,"ms":180287.298},"presents":494,"frame_ms":{"p50":368.481,"p90":411.368,"p99":440.918,"max":457.484},"gpu_busy_ms_per_present":183.176,"worker_busy_pct":{"queue worker 0x0":99.847,"queue worker 0x20":99.427,"queue worker 0x38":99.989,"queue worker 0x30":99.812,"queue worker 0x28":99.993},"top_phases_ms_per_frame":{"Driver.Packet":1817.547,"Driver.Packet.memory_wait":1293.239,"Driver.Packet.dispatch":298.272,"Driver.Dispatch":272.260,"Driver.Packet.draw":219.875,"Driver.Draw":219.728,"GpuMutex.wait.hook":189.370,"Vulkan.Dispatch":148.536},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"}
{"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3575,"ms":180022.394},"presents":503,"frame_ms":{"p50":359.633,"p90":403.356,"p99":415.277,"max":426.827},"gpu_busy_ms_per_present":181.700,"worker_busy_pct":{"queue worker 0x0":99.802,"queue worker 0x20":99.806,"queue worker 0x28":99.968,"queue worker 0x30":99.972,"queue worker 0x38":99.963},"top_phases_ms_per_frame":{"Driver.Packet":1785.250,"Driver.Packet.memory_wait":1366.492,"Driver.Packet.dispatch":216.688,"GpuMutex.wait.hook":213.969,"Driver.Dispatch":195.161,"Driver.Packet.draw":188.917,"Driver.Draw":188.773,"Driver.Draw.shader_compile_and_link":138.836},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"}
{"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3507,"ms":180297.055},"presents":494,"frame_ms":{"p50":366.690,"p90":411.179,"p99":426.409,"max":434.570},"gpu_busy_ms_per_present":182.609,"worker_busy_pct":{"queue worker 0x0":99.872,"queue worker 0x20":99.417,"queue worker 0x38":99.810,"queue worker 0x28":99.830,"queue worker 0x30":99.832},"top_phases_ms_per_frame":{"Driver.Packet":1817.322,"Driver.Packet.memory_wait":1288.556,"Driver.Packet.dispatch":301.382,"Driver.Dispatch":276.384,"Driver.Packet.draw":220.862,"Driver.Draw":220.715,"GpuMutex.wait.hook":198.027,"Driver.Draw.shader_compile_and_link":148.835},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"}
{"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3613,"ms":180154.348},"presents":508,"frame_ms":{"p50":357.771,"p90":403.170,"p99":420.242,"max":439.099},"gpu_busy_ms_per_present":182.467,"worker_busy_pct":{"queue worker 0x0":99.825,"queue worker 0x20":99.790,"queue worker 0x30":99.775,"queue worker 0x38":99.824,"queue worker 0x28":99.836},"top_phases_ms_per_frame":{"Driver.Packet":1767.170,"Driver.Packet.memory_wait":1350.965,"Driver.Packet.dispatch":216.867,"GpuMutex.wait.hook":214.740,"Driver.Dispatch":194.306,"Driver.Packet.draw":186.990,"Driver.Draw":186.849,"Driver.Draw.shader_compile_and_link":134.694},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"}
{"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3519,"ms":180021.259},"presents":499,"frame_ms":{"p50":363.310,"p90":406.461,"p99":423.528,"max":438.563},"gpu_busy_ms_per_present":182.729,"worker_busy_pct":{"queue worker 0x0":99.861,"queue worker 0x20":99.473,"queue worker 0x28":99.874,"queue worker 0x38":99.858,"queue worker 0x30":99.876},"top_phases_ms_per_frame":{"Driver.Packet":1796.807,"Driver.Packet.memory_wait":1275.559,"Driver.Packet.dispatch":297.379,"Driver.Dispatch":272.796,"Driver.Packet.draw":217.249,"Driver.Draw":217.109,"GpuMutex.wait.hook":193.343,"Driver.Draw.shader_compile_and_link":146.354},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"}
{"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3609,"ms":180291.888},"presents":512,"frame_ms":{"p50":357.083,"p90":399.522,"p99":413.200,"max":418.523},"gpu_busy_ms_per_present":182.100,"worker_busy_pct":{"queue worker 0x0":99.781,"queue worker 0x20":99.618,"queue worker 0x28":99.841,"queue worker 0x38":99.837,"queue worker 0x30":99.842},"top_phases_ms_per_frame":{"Driver.Packet":1754.445,"Driver.Packet.memory_wait":1345.372,"Driver.Packet.dispatch":214.465,"GpuMutex.wait.hook":210.999,"Driver.Dispatch":192.722,"Driver.Packet.draw":181.815,"Driver.Draw":181.681,"Driver.Draw.shader_compile_and_link":133.776},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"}
  • Traces and tools/trace_digest.py output of all six: this release.
  • The DCC mip clause does not apply to the measured menu: a local counter on bdf58c66fb + the clause saw 317,481 flushes in a run of
    the same menu (40,777 in its 180 s trace window, 81.1 per present), none with a DCC image of more than one mip, so it changed no stored
    set and added no wait there.
  • APS5_TRACE_EVENTS=2097152 in these captures only sizes the per-thread trace buffer, so the window's events aren't dropped (trace_dropped
    is false in every summary line above): in the earlier stack's 180 s window queue 0's worker records about 1.25 million events and the draw
    committer 266,000–271,000, against the default of 262,144.

Overlap

Overlap (2026-10-28 00:21 CET, trial merges with git merge-tree of the 224 open PRs that touch the same files, out of 1,363 open, against this branch 1f15e200f7 and against main f759e165d9; 118 merge cleanly with this branch, 102 conflict with this branch only in files that already conflict with main, none conflicts with main and in further files with this branch, and four merge cleanly with main but not with this branch: #8707, #10743, #11485 and #12070):

  • #12070 (imellag, 2026-10-27, does not wait for a storage image's own stamped writes before flushing it; head e7e78cff0e) conflicts with this branch at ec47dad254 only in tests/execution/StorageFlushOrdering.cpp, where both add cases (git merge-tree, 2026-10-31; Recorder.hpp, Recorder.cpp and Texture.cpp auto-merge): it narrows which writers the flush waits for, this change which ranges; the order agreed on #8887 is this PR first, and #12070 lists Depends on: #8887.
  • #10743 (orezraey, 2026-10-24, per-layer storage views of a 2D array in one image; head 8be6c1abe8) merges cleanly with main; with this branch it conflicts in the declarations in Texture.hpp, adjacent lines.
  • #8707 (LeoFeitosa, 2026-10-20; head df7ef2598b) introduces StorageTexture::storesWhole() (DCC metadata with keys not uncompressed, or more than one mip while another live storage image overlaps the image) and uses it in writeBack, pendingUnitInside (the flush pretest), evictStale, skippedResultsInside and the clear hand-over. This change's "stores whole" rule in appendStoredLayers is the wider predicate (any DCC image with more than one mip), so either merge order keeps the flush's stored set covering what #8707's write-back stores. It now merges cleanly with main; with this branch it conflicts in one region each of Texture.hpp and Texture.cpp (appendStoredLayers next to storesWhole()) and of tests/Recorder.cpp (the full run's call of flushWaitMipChainTests next to that of dccMipWriteBackTests).
  • #11485 (QRMOE, 2026-10-26, uploads a storage image over several host imports on the GPU; head 1c01a02411) merges cleanly with main and conflicts with this branch only in tests/Recorder.cpp, where both add test functions after writeBackBlockTests and their calls in the full run; Texture.hpp and Texture.cpp auto-merge.
  • Of the PRs an earlier version of this section named, #7984, #6682, #6948, #6718 and #8857 are merged, #6820, #8858 and #6202 closed, #8246 now merges cleanly with this branch, and #6960 and #8874 conflict with main.
  • Besides #12070, no open PR changes which writer the flush waits for. Merged #9685 did: the flush now skips the flushed drawn target's own store notes (one flushed image, with a host import), and this change passes those notes to its per-layer check (above).

Checklist

  • Based on main f759e165d9 (the base it is rebased onto; main has moved on since); 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: no new paths
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source: none
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080, NVIDIA 615.78.08, Linux 7.2.10 (CachyOS); AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4-arch3.1), Linux 7.2.10 (CachyOS), at 91cec4330f; lavapipe (Mesa 26.2.4, LLVM 23.1.1) in an Arch
    Linux container, for the ^agc and targeted runs; AMD Radeon RX 9070 XT (driver 32.0.32015.7029, amdvlk64), Windows 11 Pro 10.0.22631, by @bunbeans2-arch at 1f15e200f7 merged onto main f7f03daf52: agc_driver_storage_flush_ordering 3 of 3 on that merge and on that main, validation layer inserted, no VUID- line (comment); Apple M4 Pro (MoltenVK 1.4.2, Vulkan SDK 1.4.363.0), macOS 27.2, x86-64 under Rosetta 2, by @imellag at ec47dad254 merged onto support/macos-boot-1030c 05bd71a66b: 26 of 26 storage flush tests, details under Tested (comment)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4946529375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8887). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-21T04:45:32Z. --- ### What `FlushPending` waits for the newest unfinished batch that writes in the flushed range (#6364), under the GPU mutex: it submits the open batch, or finishes the in-flight ones up to that writer. Its write-backs, though, store only the pending layers the range overlaps, or every pending layer when the image stores whole (DCC keys not uncompressed) or may widen a partial store. A writer elsewhere in the range cannot be overwritten by those stores, so waiting for it only drains the queue. The flush now asks for writers over the 64 KiB blocks of the layers it stores, the granularity of the write-back's own unit publishes: - an image with many separate pending runs is checked over their hull; - for an image that stores whole, that includes its pending layers outside the range, which the range check left out; - an image with DCC metadata and more than one mip is checked over all of its pending layers too: more than today's write-back stores for it, so the check stays sufficient if the write-back comes to store such an image whole (as #8707 proposes while another live image overlaps it); - when the flush publishes unit shadows, an address-based dispatch's heap lease over the range is still waited for: such a dispatch stamps its pages only at completion, so the publish could not tell its writes from fresh shadow units otherwise; - when the flush publishes unit shadows, it also waits for writers over the live shadowed units the publish selects (whole units, hulled beyond eight runs; 3bc40d969e, from imellag's review; rebuilt after every reap and finish, ec47dad254): a label or packet store deferred to a completion and a CPU write-back of a copied buffer stamp their blocks only when their batch is reaped, so the publish could not tell a unit under them from a fresh one either. The wait is conservative (it also covers a writer whose own stamp makes the publish drop the unit) and costs one registry lookup when no such unit lies in the range, plus one after each reap and finish in a flush that waits. `APS5_FLUSH_WAIT_WHOLE_RANGE=1` checks the whole range as before (row in docs/dev/ENVIRONMENT.md). `tests/execution/StorageFlushOrdering.cpp` gains three cases, each with a GPU fill noted in the open batch: - a fill inside the flushed range but past the image's pending layer, which the flush no longer submits or waits for, while both the image's texel and the fill land; - a fill inside the pending layer, which it still waits for, so that the fill's block keeps its bytes and a texel in another block is stored; - a fill over a live shadowed unit outside the flushed image's layers, which a publishing flush waits for, while the fill's bytes stay and the unit the fill did not touch is published (3bc40d969e). The fill stamps when recorded, so the case can pin the wait, not the late-stamp race. It needs a write watch and an image whose write-back retiles into the unit shadow: the shadowed image is tiled (ec47dad254; at 3bc40d969e it was linear, so not block-tracked, and the case skipped on every device), and the case skips unless both of its 64 KiB units went into the shadow; lavapipe, which has no write watch, skips it earlier. No test reaches a unit shadowed during the flush's reap. `tests/Recorder.cpp` gains `agc_storage_flush_wait_mip_chain`: a three-mip DCC image with uncompressed keys, flushed over its first unit, completes the batch of a writer over its last pending unit. Its runner reports a device without host imports, or with an alignment that does not divide 64 KiB, as Skipped (exit code 77). `ANYPS5_TEST_HOST_IMPORT_ALIGNMENT` (row in docs/dev/ENVIRONMENT.md) stands in for the device's alignment in the recorder tests, so both skips can be exercised on one device; a value that is not a number or not a multiple of the device's alignment fails the run. ### Why it is safe - A write-back stores only the blocks of the layers it stores. A writer outside those blocks cannot be overwritten by it, and the skip decision for the stored blocks is unchanged. - The publish after the stores is the other way a flush can put bytes over a writer outside those blocks. A unit whose block a writer stamped since the retile is dropped, not published; writers that stamp only when their batch is reaped are waited for, an address-based dispatch by its heap lease over the whole range and the other two over the live units the publish selects (above). The edge that was left (the live units were read once, before the flush reaped) is closed by ec47dad254, as hardening: on the routes found, a completion that retiles a unit there does so through a nested flush whose hook runs a full `Sync`, which finishes the later batches first; the flush now rebuilds its wait set after every reap and finish and waits again when a later writer appears, so it no longer relies on that `Sync`. - Since #9685 the flush skips a drawn linear target's own earlier stores when it stores that target alone and the target has a host import; the per-layer check passes the same notes to each range, and `APS5_FLUSH_WAIT_WHOLE_RANGE=1` is `main`'s check including that skip. Not measured: the waits this change adds where two drawn linear targets, or a drawn target and a label or GPU fill, share one 64 KiB block; `main` checks the target's exact bytes there, this change its rounded block. - Checked in shadow on 007 First Light (PPSA11386), in a run from boot through about 10 minutes of gameplay, on a local tree with a local diagnostic (the title with a local patch for #6172). The check it evaluated is this change without the DCC mip clause and without the wait over live shadowed units (3bc40d969e, rebuilt after every reap in ec47dad254), both of which only add waits: - For each wait the flush does today, the diagnostic evaluated this change's check before the wait and classified the wait: - skipped (no submit, no wait): 12,743; - reap-only (completes finished batches, no submit and no wait): 22; - wait for an older writer than today: 95; - unchanged: 18,360. - After each wait it looked at every block the write-back kept. A kept block counts as depending on the wait when its newest stamp falls in the time this change would have skipped. - 0 such blocks in every class: 0 of the 41 keeps after skipped waits and 0 of the 1 after an older-writer wait. - The diagnostic is local and not in this PR. - With `APS5_FLUSH_WAIT_WHOLE_RANGE=1` on the RTX 3080, `agc_driver_storage_flush_ordering` fails at its first new case (the writer outside the pending layers; the test stops there) and `agc_storage_flush_wait_mip_chain` fails, so the tests tell the two checks apart. The second flush ordering case waits under both checks. ### Tested - Head 91cec4330f (2026-11-01): the same four commits rebased onto `main` f2d874c1fd; the one conflict was in the recorder tests' `main()`, where `main` now passes `binaryTest` to the `Device` constructor on the line this PR's `TestConfigurationError` catch follows, resolved by keeping both. On an AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4-arch3.1, Linux 7.2.10, CachyOS; power cap 243 W), `-R '^agc'`: 1,148 passed, 17 skipped, 2 failed of 1,167, the failures `agc_driver_tessellation` (SEGFAULT; its output ends with the device setup's lines) and `agc_idle_publish_wait` ("the idle publish's bytes are wrong"); `main` f2d874c1fd built the same way on this device: 1,147 passed, 17 skipped, 2 failed of 1,166, the same two names and the same 17 skipped names; the one test this PR adds, `agc_storage_flush_wait_mip_chain`, is the count's difference. `agc_driver_storage_flush_ordering` passes, but its shadowed-unit case skips on this card ("the write-back did not retile both units into the unit shadow: the shadowed-unit case is skipped"), so this card does not exercise the shadowed-unit case; `agc_storage_flush_wait_mip_chain` runs ("flush wait over a DCC mip chain: ok"). On lavapipe (Mesa 26.2.4, LLVM 23.1.1, in the container of the 1f15e200f7 entry below, `-j16`): 1,035 passed, 90 skipped, 42 failed of 1,167, the 40 that `main` 0836dfdf4f fails there (40 of 1,143, same names) plus `agc_driver_f64_fma_denormal_modes` and `agc_driver_f64_div_scale_denormal_modes`, `main`'s new tests from #13845 and #13846; `main` f2d874c1fd built the same way there fails the same 42 names of 1,166 with 90 skipped. - Head ec47dad254 (2026-10-31): on the RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS), `agc_driver_storage_flush_ordering` passes with the shadowed-unit case run, and fails with "storage flush ordering, shadowed unit under a writer outside the flushed image's layers: the flush did not wait for the writer over the shadowed unit it publishes" when the live units are left out of the wait set; `-R '^agc'`: 1,055 passed, 10 skipped, 1 failed of 1,066, the failure `agc_driver_mesh_barycentric_emulation` as on `main` f759e165d9 below. On lavapipe the case skips (no write watch) and `-R '^agc'` gives 949 passed, 84 skipped and the same 33 failed of 1,066 as at 3bc40d969e. - Head ec47dad254 on macOS (imellag, 2026-10-31, [comment](https://github.com/boykopovar/AnyPS5/pull/8887#issuecomment-6543614694)): Apple M4 Pro, macOS 27.2, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), x86-64 Release under Rosetta 2, the validation layer inserted on both sides. `main` does not build the driver on macOS on its own, so the base is imellag's support branch `support/macos-boot-1030c` 05bd71a66b (`main` 21a556f567 plus the open macOS PRs) and the change side that branch with ec47dad254 merged. Of the storage flush tests (#12070's pattern plus `storage_flush_wait_mip_chain`), the base passes 25 of 25 and this head 26 of 26, including `agc_driver_storage_flush_ordering` and `agc_storage_flush_wait_mip_chain`. The ordering test logged no skip line, so the shadowed-unit case appears to have run there; lavapipe skips it, so this is the first device off NVIDIA where it appears to have run. The only `VUID-` on the change side is `VUID-VkDeviceCreateInfo-pProperties-04451` (2 lines, `VK_KHR_portability_subset` not enabled), from `agc_storage_flush_wait_mip_chain`, which imellag traces to the recorder tests' existing device setup, not to this change. - 007 First Light main menu, main without and with this change, the current measurement (2026-10-31), captured as the Performance report form describes: - A: main 809c7fa2df. B: main 809c7fa2df with ec47dad254 merged (a local merge commit). Two binaries with the same shader-cache version; one shader-cache seed, made on A by a run from an empty shader cache through the menu and the Resume into gameplay, serves both, with the NVIDIA driver cache frozen with it; every run starts warm from it. - The title with a local patch for #6172 (both sides), scripted pad input, no `APS5_PROFILE_*` switch, trace window 180 s from 1,320 s (`APS5_TRACE_SECONDS=1320:180`, `APS5_TRACE_EVENTS=2097152`, and `APS5_TRACE_DIR`, which only names the directory the trace and summary files are written to), the menu held for the whole run, main's defaults otherwise (the pipeline journal among them); the title's scope runs with swap off. Run order A1 B1 A2 B2 A3: A3 failed a validity rule declared before the series (six shader-disk-cache misses in the first 10 s of its boot, where every other measured run had none), and the series stopped there; a continuation declared before its runs then added A4 as A's extra, and B3. The table holds the first three valid runs of each side, as declared; A3 is left out. The title's output goes to a log file (the sandbox launcher redirects it), which the form advises against. | run | commit | FPS | frame p50 / p90 ms | GPU busy ms/present | |---|---|---|---|---| | A1 | 809c7fa2df | 1.0056 | 989.8 / 1,118.2 | 152.3 | | B1 | 809c7fa2df + ec47dad254 | 1.0444 | 950.4 / 1,069.0 | 143.3 | | A2 | 809c7fa2df | 1.0102 | 983.2 / 1,103.7 | 150.1 | | B2 | 809c7fa2df + ec47dad254 | 1.0356 | 961.4 / 1,082.7 | 147.6 | | A4 | 809c7fa2df | 1.0360 | 952.7 / 1,072.0 | 145.2 | | B3 | 809c7fa2df + ec47dad254 | 1.0134 | 987.3 / 1,096.1 | 149.3 | - FPS (presents over the window's seconds): A 1.0056–1.0360, B 1.0134–1.0444; B/A of the means 1.0136; the ranges overlap (lowest B / highest A 0.9782, highest B / lowest A 1.0386). Frame p50: A 952.7–989.8 ms, B 950.4–987.3 ms; B/A of the means 0.9909; the ranges overlap (0.9602 and 1.0363 at the range ends). GPU busy per present A 145.2–152.3 ms, B 143.3–149.3 ms. On this main, the menu's FPS and frame time do not differ between A and B beyond the run-to-run spread: the ranges overlap. The +2.45 % in the earlier A/B below was measured on that earlier stack, not on main. - Queue 0's worker, ms per present, A → B, from the traces: `Driver.Packet.draw` 613–621 → 606–616; `Driver.Draw.draw_enqueued` 532–539 → 525–535; `Driver.Draw.shader_compile_and_link` 72–76 → 72–74; `Shader.DrawStage.capture_resources` 28–29 → 28–29; `Driver.Packet.dispatch` 281–305 → 281–294; `Vulkan.Dispatch` 193–215 → 189–200; `Driver.Packet` as a whole 957–986 → 949–978. - This pair runs at 1.0056–1.0444 FPS, with `Driver.Draw.draw_enqueued` at 525–539 ms per present (both sides); the earlier stack's pair below ran at 2.740–2.840 FPS and 45–68 ms. Besides the base, that pair ran the title unpatched, with swap allowed for the title's scope, and before main's pipeline journal. Its figures stay below as that stack's record. - Summary lines (the B lines' commit field and trace name are a local merge commit's and are masked): ```json {"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1477,"ms":180981.917},"presents":182,"frame_ms":{"p50":989.775,"p90":1118.178,"p99":1227.940,"max":1243.984},"gpu_busy_ms_per_present":152.293,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.445,"queue worker 0x28":99.702,"queue worker 0x30":99.700,"queue worker 0x38":99.587},"top_phases_ms_per_frame":{"Driver.Packet":4942.752,"Driver.Packet.memory_wait":3455.741,"GpuMutex.wait.hook":931.380,"Resources.Complete":829.201,"Driver.Packet.dispatch":823.578,"Driver.Dispatch":778.522,"Graphics.Draw":614.258,"Driver.Packet.draw":613.440},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"} {"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1532,"ms":180957.247},"presents":189,"frame_ms":{"p50":950.409,"p90":1068.995,"p99":1212.123,"max":1222.538},"gpu_busy_ms_per_present":143.266,"worker_busy_pct":{"queue worker 0x0":99.940,"queue worker 0x20":99.469,"queue worker 0x28":99.673,"queue worker 0x30":99.677,"queue worker 0x38":99.659},"top_phases_ms_per_frame":{"Driver.Packet":4759.304,"Driver.Packet.memory_wait":3357.369,"Resources.Complete":795.339,"GpuMutex.wait.hook":792.669,"Driver.Packet.dispatch":745.553,"Driver.Dispatch":699.782,"Graphics.Draw":609.515,"Driver.Packet.draw":606.285},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"} {"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1500,"ms":180164.235},"presents":182,"frame_ms":{"p50":983.204,"p90":1103.687,"p99":1189.840,"max":1272.081},"gpu_busy_ms_per_present":150.148,"worker_busy_pct":{"queue worker 0x0":99.941,"queue worker 0x20":99.451,"queue worker 0x38":99.705,"queue worker 0x28":99.716,"queue worker 0x30":99.502},"top_phases_ms_per_frame":{"Driver.Packet":4920.512,"Driver.Packet.memory_wait":3429.062,"GpuMutex.wait.hook":958.287,"Resources.Complete":822.577,"Driver.Packet.dispatch":819.917,"Driver.Dispatch":776.828,"Graphics.Draw":625.272,"Graphics.Draw.draw_and_resource_release":621.681},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"} {"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1514,"ms":180579.495},"presents":187,"frame_ms":{"p50":961.443,"p90":1082.719,"p99":1192.333,"max":1217.294},"gpu_busy_ms_per_present":147.574,"worker_busy_pct":{"queue worker 0x0":99.935,"queue worker 0x20":99.541,"queue worker 0x28":99.721,"queue worker 0x30":99.719,"queue worker 0x38":99.693},"top_phases_ms_per_frame":{"Driver.Packet":4798.805,"Driver.Packet.memory_wait":3345.299,"GpuMutex.wait.hook":891.196,"Resources.Complete":798.303,"Driver.Packet.dispatch":792.040,"Driver.Dispatch":744.340,"Graphics.Draw":610.334,"Driver.Packet.draw":607.700},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"} {"commit":"809c7fa2dfb1","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1527,"ms":180503.198},"presents":187,"frame_ms":{"p50":952.670,"p90":1072.002,"p99":1204.098,"max":1252.461},"gpu_busy_ms_per_present":145.248,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.494,"queue worker 0x28":99.710,"queue worker 0x30":99.540,"queue worker 0x38":99.625},"top_phases_ms_per_frame":{"Driver.Packet":4797.831,"Driver.Packet.memory_wait":3374.813,"GpuMutex.wait.hook":853.180,"Resources.Complete":805.548,"Driver.Packet.dispatch":760.867,"Driver.Dispatch":715.581,"Graphics.Draw":616.207,"Driver.Packet.draw":613.714},"trace_dropped":false,"trace":"aps5-trace-809c7fa2dfb1-2.json.gz"} {"commit":"<local merge of 809c7fa2df and ec47dad254>","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":1507,"ms":180583.865},"presents":183,"frame_ms":{"p50":987.271,"p90":1096.114,"p99":1214.466,"max":1249.924},"gpu_busy_ms_per_present":149.261,"worker_busy_pct":{"queue worker 0x0":99.945,"queue worker 0x20":99.992,"queue worker 0x28":99.988,"queue worker 0x30":99.774,"queue worker 0x38":99.988},"top_phases_ms_per_frame":{"Driver.Packet":4917.724,"Driver.Packet.memory_wait":3445.697,"GpuMutex.wait.hook":985.527,"Resources.Complete":819.965,"Driver.Packet.dispatch":803.000,"Driver.Dispatch":755.687,"Graphics.Draw":620.804,"Graphics.Draw.draw_and_resource_release":617.459},"trace_dropped":false,"trace":"aps5-trace-local-merge-2.json.gz"} ``` - Head 3bc40d969e (2026-10-30): `agc_driver_storage_flush_ordering` passes on the RTX 3080 and on lavapipe, with the new case skipped on both (above). On lavapipe (the container of the 1f15e200f7 entry below, 2026-10-31), `-R '^agc'` at 3bc40d969e and at 1f15e200f7, built side by side, gives 949 passed, 84 skipped and the same 33 failed of 1,066 on both; lavapipe has no write watch, so unit shadows are off there and the new wait never applies. The RTX 3080 `^agc` run and the other runs below were not repeated on it. - Head 1f15e200f7 (2026-10-28): the flush commit rebased onto `main` f759e165d9 as a94e49393f (its added and removed lines are those of f0378179a2; the range-diff shows one changed context row of `main`'s), plus 1f15e200f7 for the test's skip (oneandonlydean's review): - lavapipe (Mesa 26.2.4, LLVM 23.1.1) in the Arch Linux container: `agc_storage_flush_wait_mip_chain` Skipped with `ANYPS5_TEST_HOST_IMPORT_ALIGNMENT=0` and with `=131072`, Passed unset, Failed with `=abc` and with `=4095`; `-R '^agc'`: 949 passed, 84 skipped, 33 failed of 1,066, and the 33 are `main` f759e165d9's own failures on this device (same set, same skips); - RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS): the same five cases give the same five results; `-R '^agc' -j 8`: 1,055 passed, 10 skipped, 1 failed of 1,066; `main` f759e165d9 built the same way on it: 1,054 passed, 10 skipped, 1 failed of 1,065, the same ten skips and the same failure (`agc_driver_mesh_barycentric_emulation`, `the pixel shader did not emulate barycentrics` on both trees). - On the rebased head f0378179a2 (`main` 7e4f6e0440), 2026-10-25: - lavapipe (Mesa 26.2.4, LLVM 23.1.1) in an Arch Linux container on a second machine: `agc_driver_storage_flush_ordering`, `agc_storage_flush_wait_mip_chain`, `agc_storage_writeback_blocks`, every `agc_driver_linear_target_*` and `agc_driver_linear_readback_label*` test: 14 of 15 passed, and `agc_driver_linear_target_direct_write_completion` skipped itself on this device (it passes in the RTX 3080 run below); - RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS): `agc_driver_storage_flush_ordering` and `agc_storage_flush_wait_mip_chain` pass; full `-R '^agc' -j 8` in a Release build: 1,005 of 1,012 passed, 7 skipped, none failed; - with `APS5_FLUSH_WAIT_WHOLE_RANGE=1` on the RTX 3080: `agc_driver_storage_flush_ordering` and `agc_storage_flush_wait_mip_chain` fail, and `agc_driver_linear_target_completion_stores` (#9685's test that a drawn target stays pending across draws and labels without a submission) passes, so the switch keeps #9685's own-store skip. - The items below ran on the earlier heads named in each (017123e1d6 on 5d10ea9ea0; the menu runs on the 68323bae7 trees). From 017123e1d6 to f0378179a2 the patch differs in one added line: the per-layer `PendingWriterSerial` call takes #9685's new overload with the flushed target's own store notes, for each stored range. - On lavapipe (Mesa 26.2.4, LLVM 23.1.1), in an Arch Linux container on a second machine, on 5d10ea9ea0: - a local commit with the flush ordering test alone (2514ee316c, not in this PR) fails `agc_driver_storage_flush_ordering` with "storage flush ordering, writer outside the image's pending layers: the flush submitted and waited for a writer its stores cannot overwrite"; - this PR's commit with the DCC mip clause reverted (local 8c5d2eb303) fails `agc_storage_flush_wait_mip_chain` with "flush wait over a DCC mip chain: a flush of the first unit did not complete the batch of a writer over another pending unit, which a write-back of a DCC image with more than one mip may store", and passes the flush ordering test; - this PR's commit 017123e1d6 passes both. - Full ctest on an NVIDIA GeForce RTX 3080 (NVIDIA 615.78.08, Linux 7.2.10, CachyOS) at 017123e1d6, `-j 16`: 1,763/1,766. The three failures are `net_dontwait_blocking_send`, `_sendto` and `_sendmsg` ("blocking send: peer never exhausted the send buffers"), libSceNet tests this change does not touch; main 5d10ea9ea0 fails them the same way when they run alone on this machine. - lavapipe in the same container, `-R '^agc'`: base 5d10ea9ea0 fails 19 of 840 and this PR the same 19 of 841 (the one more test passes); they fail on lavapipe without this change. - Validation layers, as CONTRIBUTING asks: the storage flush ordering, DCC mip chain and storage write-back tests with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V` on the RTX 3080 (Vulkan-ValidationLayers 1.4.363): - this commit passes 5/5, and main 5d10ea9ea0 4/4 (without the new test); - neither log reports the layer as not found; - neither has a validation message or a `VUID-`. - 007 First Light main menu, an earlier A/B within one binary (the switch), on the same local tree: - Tree: main 68323bae7 + #5799 #6868 #5372 #6918 #7643 #6679 + this change without the DCC mip clause (which does not apply in this menu, below) and without 3bc40d969e's wait over live shadowed units or ec47dad254's rebuild of it (the measurement on main above has them). The title ran as shipped. - A sets `APS5_FLUSH_WAIT_WHOLE_RANGE=1`; B runs this change. Same binary. - Warm shader cache, scripted pad input, `APS5_PROFILE_DRAW=1`, trace window 180 s from 1,320 s (`APS5_TRACE_SECONDS=1320:180`, `APS5_TRACE_EVENTS=2097152`). - Runs alternating A1 B1 A2 B2 A3 B3, plus A4. Another build ran on the machine during A2, after the menu was reached and before its window (19:47–19:57 against a window from about 20:02); A4 was added, and A2 matches the other A runs. | run | FPS | frame p50 ms | GPU busy ms/present | |---|---|---|---| | A1 | 2.728 | 374.1 | 182.6 | | A2 | 2.726 | 368.1 | 183.3 | | A3 | 2.740 | 366.5 | 182.1 | | A4 | 2.713 | 368.9 | 182.9 | | B1 | 2.777 | 364.8 | 182.5 | | B2 | 2.894 | 356.8 | 169.1 | | B3 | 2.785 | 362.8 | 182.9 | - Queue 0's worker, ms per present, A1–A4 → B1–B3: - `Driver.Packet.draw` 217–219 → 187–191 (means 218.3 → 188.7, −13.6%); - `Driver.Draw.draw_enqueued` 66–69 → 48–49; - `Driver.Draw.shader_compile_and_link` 145–146 → 135–137; - `Shader.DrawStage.capture_resources` 29–30 → 21–23. - Queue 0's worker is about 100% busy in every run, and part of the saving reappears in dispatch time (`Driver.Packet.dispatch` 127–129 → 129–132, `Vulkan.Dispatch` 59–70 → 70–75). So `Driver.Packet` as a whole goes 361–365 → 355–356 on B1 and B3, and the frame gain is small: +2.0% FPS (B1 +1.9%, B3 +2.1%) and −1.5% frame p50 for B1/B3 against the mean of A1–A4. - B2 ran in a different menu state (7% less GPU work per present) and is not averaged in: 2.894 FPS, p50 356.8 ms. - 007 gameplay, one run of this change (same tree, warm cache, scripted input, the title with a local patch for #6172): no faults, no Vulkan errors, the frames render correctly. Its frame rate is not compared: the window's GPU work per frame differs from the reference runs. - 007 First Light main menu, an earlier stack (measured 2026-10-21) without and with this change, captured as the Performance report form describes; the measurement on main above is the current one, this one stays as that stack's record: - A: main 68323bae7 + #5799 #6868 #5372 #6918 #7643 #6679 (local tree 984b9f06de). B: the same + this change (local tree bdf58c66fb). Two binaries. Measured on 984b9f06de / bdf58c66fb; the rebase changes no code in the change itself except a conservative clause for DCC images with more than one mip and its test, which does not apply in the measured window (below); 3bc40d969e then adds the wait over live shadowed units and ec47dad254 rebuilds it after every reap; the measurement on main above has both. - The title as shipped, warm shader cache, scripted pad input, no `APS5_PROFILE_*` switch, trace window 180 s from 1,320 s; runs alternating A1 B1 A2 B2 A3 B3. The title's output goes to a log file (the sandbox launcher redirects it), which the form advises against. | run | commit | FPS | frame p50 / p90 ms | GPU busy ms/present | |---|---|---|---|---| | A1 | 984b9f06de | 2.740 | 368.5 / 411.4 | 183.2 | | B1 | bdf58c66fb | 2.794 | 359.6 / 403.4 | 181.7 | | A2 | 984b9f06de | 2.740 | 366.7 / 411.2 | 182.6 | | B2 | bdf58c66fb | 2.820 | 357.8 / 403.2 | 182.5 | | A3 | 984b9f06de | 2.772 | 363.3 / 406.5 | 182.7 | | B3 | bdf58c66fb | 2.840 | 357.1 / 399.5 | 182.1 | - +2.45% FPS (means 2.751 → 2.818; the two sides' ranges don't overlap) and −2.2% frame p50 (366.2 → 358.2 ms), at the same GPU work. - This A/B (the table, the phases below and the summary lines) was measured before 3bc40d969e and ec47dad254; the measurement on main above includes them. - Queue 0's worker, ms per present, A1–A3 → B1–B3, from the traces: - `Driver.Packet.draw` 216–219 → 180–187; - `Driver.Draw.draw_enqueued` 67–68 → 45–49; - `Driver.Draw.shader_compile_and_link` 144–146 → 131–136; - `Shader.DrawStage.capture_resources` 29–31 → 20–22; - `Driver.Packet.dispatch` 123–125 → 131–133; - `Driver.Packet` as a whole 357–361 → 348–354. - Summary lines: ```json {"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3545,"ms":180287.298},"presents":494,"frame_ms":{"p50":368.481,"p90":411.368,"p99":440.918,"max":457.484},"gpu_busy_ms_per_present":183.176,"worker_busy_pct":{"queue worker 0x0":99.847,"queue worker 0x20":99.427,"queue worker 0x38":99.989,"queue worker 0x30":99.812,"queue worker 0x28":99.993},"top_phases_ms_per_frame":{"Driver.Packet":1817.547,"Driver.Packet.memory_wait":1293.239,"Driver.Packet.dispatch":298.272,"Driver.Dispatch":272.260,"Driver.Packet.draw":219.875,"Driver.Draw":219.728,"GpuMutex.wait.hook":189.370,"Vulkan.Dispatch":148.536},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"} {"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3575,"ms":180022.394},"presents":503,"frame_ms":{"p50":359.633,"p90":403.356,"p99":415.277,"max":426.827},"gpu_busy_ms_per_present":181.700,"worker_busy_pct":{"queue worker 0x0":99.802,"queue worker 0x20":99.806,"queue worker 0x28":99.968,"queue worker 0x30":99.972,"queue worker 0x38":99.963},"top_phases_ms_per_frame":{"Driver.Packet":1785.250,"Driver.Packet.memory_wait":1366.492,"Driver.Packet.dispatch":216.688,"GpuMutex.wait.hook":213.969,"Driver.Dispatch":195.161,"Driver.Packet.draw":188.917,"Driver.Draw":188.773,"Driver.Draw.shader_compile_and_link":138.836},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"} {"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3507,"ms":180297.055},"presents":494,"frame_ms":{"p50":366.690,"p90":411.179,"p99":426.409,"max":434.570},"gpu_busy_ms_per_present":182.609,"worker_busy_pct":{"queue worker 0x0":99.872,"queue worker 0x20":99.417,"queue worker 0x38":99.810,"queue worker 0x28":99.830,"queue worker 0x30":99.832},"top_phases_ms_per_frame":{"Driver.Packet":1817.322,"Driver.Packet.memory_wait":1288.556,"Driver.Packet.dispatch":301.382,"Driver.Dispatch":276.384,"Driver.Packet.draw":220.862,"Driver.Draw":220.715,"GpuMutex.wait.hook":198.027,"Driver.Draw.shader_compile_and_link":148.835},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"} {"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3613,"ms":180154.348},"presents":508,"frame_ms":{"p50":357.771,"p90":403.170,"p99":420.242,"max":439.099},"gpu_busy_ms_per_present":182.467,"worker_busy_pct":{"queue worker 0x0":99.825,"queue worker 0x20":99.790,"queue worker 0x30":99.775,"queue worker 0x38":99.824,"queue worker 0x28":99.836},"top_phases_ms_per_frame":{"Driver.Packet":1767.170,"Driver.Packet.memory_wait":1350.965,"Driver.Packet.dispatch":216.867,"GpuMutex.wait.hook":214.740,"Driver.Dispatch":194.306,"Driver.Packet.draw":186.990,"Driver.Draw":186.849,"Driver.Draw.shader_compile_and_link":134.694},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"} {"commit":"984b9f06dea5","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3519,"ms":180021.259},"presents":499,"frame_ms":{"p50":363.310,"p90":406.461,"p99":423.528,"max":438.563},"gpu_busy_ms_per_present":182.729,"worker_busy_pct":{"queue worker 0x0":99.861,"queue worker 0x20":99.473,"queue worker 0x28":99.874,"queue worker 0x38":99.858,"queue worker 0x30":99.876},"top_phases_ms_per_frame":{"Driver.Packet":1796.807,"Driver.Packet.memory_wait":1275.559,"Driver.Packet.dispatch":297.379,"Driver.Dispatch":272.796,"Driver.Packet.draw":217.249,"Driver.Draw":217.109,"GpuMutex.wait.hook":193.343,"Driver.Draw.shader_compile_and_link":146.354},"trace_dropped":false,"trace":"aps5-trace-984b9f06dea5-2.json.gz"} {"commit":"bdf58c66fbe4","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"2097152","APS5_TRACE_SECONDS":"1320:180"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"seconds 1320:180","first_present":3609,"ms":180291.888},"presents":512,"frame_ms":{"p50":357.083,"p90":399.522,"p99":413.200,"max":418.523},"gpu_busy_ms_per_present":182.100,"worker_busy_pct":{"queue worker 0x0":99.781,"queue worker 0x20":99.618,"queue worker 0x28":99.841,"queue worker 0x38":99.837,"queue worker 0x30":99.842},"top_phases_ms_per_frame":{"Driver.Packet":1754.445,"Driver.Packet.memory_wait":1345.372,"Driver.Packet.dispatch":214.465,"GpuMutex.wait.hook":210.999,"Driver.Dispatch":192.722,"Driver.Packet.draw":181.815,"Driver.Draw":181.681,"Driver.Draw.shader_compile_and_link":133.776},"trace_dropped":false,"trace":"aps5-trace-bdf58c66fbe4-2.json.gz"} ``` - Traces and `tools/trace_digest.py` output of all six: [this release](https://github.com/SleglJan/AnyPS5/releases/tag/perf-traces-flush-wait-stored-layers). - The DCC mip clause does not apply to the measured menu: a local counter on bdf58c66fb + the clause saw 317,481 flushes in a run of the same menu (40,777 in its 180 s trace window, 81.1 per present), none with a DCC image of more than one mip, so it changed no stored set and added no wait there. - `APS5_TRACE_EVENTS=2097152` in these captures only sizes the per-thread trace buffer, so the window's events aren't dropped (`trace_dropped` is false in every summary line above): in the earlier stack's 180 s window queue 0's worker records about 1.25 million events and the draw committer 266,000–271,000, against the default of 262,144. ### Overlap Overlap (2026-10-28 00:21 CET, trial merges with `git merge-tree` of the 224 open PRs that touch the same files, out of 1,363 open, against this branch 1f15e200f7 and against `main` f759e165d9; 118 merge cleanly with this branch, 102 conflict with this branch only in files that already conflict with `main`, none conflicts with `main` and in further files with this branch, and four merge cleanly with `main` but not with this branch: #8707, #10743, #11485 and #12070): - #12070 (imellag, 2026-10-27, does not wait for a storage image's own stamped writes before flushing it; head e7e78cff0e) conflicts with this branch at ec47dad254 only in `tests/execution/StorageFlushOrdering.cpp`, where both add cases (`git merge-tree`, 2026-10-31; `Recorder.hpp`, `Recorder.cpp` and `Texture.cpp` auto-merge): it narrows which writers the flush waits for, this change which ranges; the order agreed on #8887 is this PR first, and #12070 lists `Depends on: #8887`. - #10743 (orezraey, 2026-10-24, per-layer storage views of a 2D array in one image; head 8be6c1abe8) merges cleanly with `main`; with this branch it conflicts in the declarations in `Texture.hpp`, adjacent lines. - #8707 (LeoFeitosa, 2026-10-20; head df7ef2598b) introduces `StorageTexture::storesWhole()` (DCC metadata with keys not uncompressed, or more than one mip while another live storage image overlaps the image) and uses it in `writeBack`, `pendingUnitInside` (the flush pretest), `evictStale`, `skippedResultsInside` and the clear hand-over. This change's "stores whole" rule in `appendStoredLayers` is the wider predicate (any DCC image with more than one mip), so either merge order keeps the flush's stored set covering what #8707's write-back stores. It now merges cleanly with `main`; with this branch it conflicts in one region each of `Texture.hpp` and `Texture.cpp` (`appendStoredLayers` next to `storesWhole()`) and of `tests/Recorder.cpp` (the full run's call of `flushWaitMipChainTests` next to that of `dccMipWriteBackTests`). - #11485 (QRMOE, 2026-10-26, uploads a storage image over several host imports on the GPU; head 1c01a02411) merges cleanly with `main` and conflicts with this branch only in `tests/Recorder.cpp`, where both add test functions after `writeBackBlockTests` and their calls in the full run; `Texture.hpp` and `Texture.cpp` auto-merge. - Of the PRs an earlier version of this section named, #7984, #6682, #6948, #6718 and #8857 are merged, #6820, #8858 and #6202 closed, #8246 now merges cleanly with this branch, and #6960 and #8874 conflict with `main`. - Besides #12070, no open PR changes which writer the flush waits for. Merged #9685 did: the flush now skips the flushed drawn target's own store notes (one flushed image, with a host import), and this change passes those notes to its per-layer check (above). ### Checklist - [x] Based on `main` f759e165d9 (the base it is rebased onto; `main` has moved on since); 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 - [x] Unimplemented paths throw: no new paths - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source: none - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080, NVIDIA 615.78.08, Linux 7.2.10 (CachyOS); AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4-arch3.1), Linux 7.2.10 (CachyOS), at 91cec4330f; lavapipe (Mesa 26.2.4, LLVM 23.1.1) in an Arch Linux container, for the `^agc` and targeted runs; AMD Radeon RX 9070 XT (driver 32.0.32015.7029, amdvlk64), Windows 11 Pro 10.0.22631, by @bunbeans2-arch at 1f15e200f7 merged onto `main` f7f03daf52: `agc_driver_storage_flush_ordering` 3 of 3 on that merge and on that `main`, validation layer inserted, no `VUID-` line ([comment](https://github.com/boykopovar/AnyPS5/pull/8887#issuecomment-6530379079)); Apple M4 Pro (MoltenVK 1.4.2, Vulkan SDK 1.4.363.0), macOS 27.2, x86-64 under Rosetta 2, by @imellag at ec47dad254 merged onto `support/macos-boot-1030c` 05bd71a66b: 26 of 26 storage flush tests, details under Tested ([comment](https://github.com/boykopovar/AnyPS5/pull/8887#issuecomment-6543614694)) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Scramblrrrr commented 2026-10-22 09:11:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T09:11:15Z.


Reviewing the updated017123e1d6 for a Windows007 cross-test. Source-only integration163fd9b52c merges cleanly over our current c4162b2156b8 recorder-memory control, preserving #9565's command-buffer release and your new mip-chain/flush-ordering cases:
https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-oct22-storage-waits

Conventions pass; UNBUILT/UNTESTED and not staged. The current game is unchanged c416 (main d6 + #9591/#6918 + now-merged #7961 + #9565). Correct offline menu:78presents/62.137794s=1.25527FPS, GPU196.17083ms/present, same32GiB/7800X3D/RTX5070Ti617.42. The prior same-settings b36 menu was1.22951FPS; one moving-menu pair/no clock lock, so no useful speed gain claimed from recorder release. A five-frame timing capture and loading/memory probe are next before another native build.

Your flush-wait change fits the remaining queue/resource stalls. I will include both new regressions, the existing storage-flush ordering controls and the full recorder set, with the actual Khronos layer and the whole-range switch as the negative control, before any title test. Also reviewing #9400's outside-mutex presync, kept separate so far. Raw title requests/code/traces remain local. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337103791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8887#issuecomment-6337103791). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T09:11:15Z. --- Reviewing the updated017123e1d6 for a Windows007 cross-test. Source-only integration163fd9b52c merges cleanly over our current c4162b2156b8 recorder-memory control, preserving #9565's command-buffer release and your new mip-chain/flush-ordering cases: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-oct22-storage-waits Conventions pass; UNBUILT/UNTESTED and not staged. The current game is unchanged c416 (main d6 + #9591/#6918 + now-merged #7961 + #9565). Correct offline menu:78presents/62.137794s=1.25527FPS, GPU196.17083ms/present, same32GiB/7800X3D/RTX5070Ti617.42. The prior same-settings b36 menu was1.22951FPS; one moving-menu pair/no clock lock, so no useful speed gain claimed from recorder release. A five-frame timing capture and loading/memory probe are next before another native build. Your flush-wait change fits the remaining queue/resource stalls. I will include both new regressions, the existing storage-flush ordering controls and the full recorder set, with the actual Khronos layer and the whole-range switch as the negative control, before any title test. Also reviewing #9400's outside-mutex presync, kept separate so far. Raw title requests/code/traces remain local. AI-assisted: Codex.
Scramblrrrr commented 2026-10-22 09:37:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T09:37:17Z.


Windows cross-test of017123e1d6 on integration163fd9b52cc9 completed (basec4162b2156b8, the same current-main007 prerequisite/recorder stack as our active control). All commits retained; no #9652 join relaxation.

RTX5070Ti / NVIDIA617.42 / Windows11 10.0.26200 / 7800X3D, WinLibs GCC15.2r7 Release, game/native build SPIRV Tools OFF:

  • Baseline c416 recorder/import gate83PASS+1expected Linux-only skip35.67s; existing agc_driver_storage_flush_ordering separatelyPASS0.68s.
  • Candidate85PASS+same skip (86cases),35.65s. Includes every recorder/import mode plus both new regressions. Actual Khronos1.4.363 layer loaded, ANYPS5_REQUIRE_VULKAN=1 / ANYPS5_NO_SHADER_CACHE=1 / ctest -V. No missing-layer errors or new VUIDs: same two existing02275errors in agc_sampled_storage_base_level_usage.
  • Same-binary control: APS5_FLUSH_WAIT_WHOLE_RANGE=1 makes BOTH agc_driver_storage_flush_ordering and agc_storage_flush_wait_mip_chain fail at the intended new assertions. Default behavior restored:2/2PASS0.67s. Fixture EXE SHA256 values unchanged, no source modifications, these controls have no validation errors.

Clean final packaging, matched369modules SHA256 verified/staged, previous c416 cohort preserved. Not yet title-tested. The c416 control menu was1.25527FPS; its later loading probe hit the known RenderThread/quadtree fault class before guard termination, so no gameplay success. Prewarming two newly captured large loading pipelines locally before the163 title run; raw title code/requests stay local. No FPS claim for this PR from me yet. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337606279 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8887#issuecomment-6337606279). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T09:37:17Z. --- Windows cross-test of017123e1d6 on integration163fd9b52cc9 completed (basec4162b2156b8, the same current-main007 prerequisite/recorder stack as our active control). All commits retained; no #9652 join relaxation. RTX5070Ti / NVIDIA617.42 / Windows11 10.0.26200 / 7800X3D, WinLibs GCC15.2r7 Release, game/native build SPIRV Tools OFF: - Baseline c416 recorder/import gate83PASS+1expected Linux-only skip35.67s; existing agc_driver_storage_flush_ordering separatelyPASS0.68s. - Candidate85PASS+same skip (86cases),35.65s. Includes every recorder/import mode plus both new regressions. Actual Khronos1.4.363 layer loaded, ANYPS5_REQUIRE_VULKAN=1 / ANYPS5_NO_SHADER_CACHE=1 / ctest -V. No missing-layer errors or new VUIDs: same two existing02275errors in agc_sampled_storage_base_level_usage. - Same-binary control: APS5_FLUSH_WAIT_WHOLE_RANGE=1 makes BOTH agc_driver_storage_flush_ordering and agc_storage_flush_wait_mip_chain fail at the intended new assertions. Default behavior restored:2/2PASS0.67s. Fixture EXE SHA256 values unchanged, no source modifications, these controls have no validation errors. Clean final packaging, matched369modules SHA256 verified/staged, previous c416 cohort preserved. Not yet title-tested. The c416 control menu was1.25527FPS; its later loading probe hit the known RenderThread/quadtree fault class before guard termination, so no gameplay success. Prewarming two newly captured large loading pipelines locally before the163 title run; raw title code/requests stay local. No FPS claim for this PR from me yet. AI-assisted: Codex.
imellag commented 2026-10-30 20:52:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-30T20:52:04Z.

Review: COMMENTED


A question on the publish path, from reading head 1f15e200f7 (no run).

FlushPending publishes over the whole flush range after the stores: PublishShadow(address, bytes, scope, ...) at Texture.cpp:4361 (the default scope is Whole), and PublishShadow in UnitShadow.cpp:544 does not wait for GPU writers itself, apart from the completion case. Before this change, PendingWriterSerial(address, bytes, ownNotes) covered writers over the whole range, so a shadowed unit was published only after any in-flight writer over it had finished. With this change, when the scope publishes, the whole range is checked only for leases (PendingLeaseSerial, Texture.cpp:4320); writers are checked only over the stored layers (Texture.cpp:4324).

So take a unit shadow that holds another image's retiled results inside the flush range but outside the layers the flushed images store, with an in-flight batch that writes over it. That unit is now published while the write may still be running. Before, it was published after the write had finished. Is that ordered somewhere else (the shadow's notes, or something that drops the unit when a newer GPU write is pending)? If not, should the writer check keep the whole range when scope != PublishScope::None, as the lease check already does? The new StorageFlushOrdering case with the far fill uses the default Whole scope but has no shadowed unit over the fill, so it doesn't cover this.

This came up because #12070 changes the same ownNotes lines and is stacked on this PR.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5718508377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8887#pullrequestreview-5718508377). Originally posted by [imellag](https://github.com/imellag) on 2026-10-30T20:52:04Z. **Review:** COMMENTED --- A question on the publish path, from reading head `1f15e200f7` (no run). `FlushPending` publishes over the whole flush range after the stores: `PublishShadow(address, bytes, scope, ...)` at `Texture.cpp:4361` (the default scope is `Whole`), and `PublishShadow` in `UnitShadow.cpp:544` does not wait for GPU writers itself, apart from the completion case. Before this change, `PendingWriterSerial(address, bytes, ownNotes)` covered writers over the whole range, so a shadowed unit was published only after any in-flight writer over it had finished. With this change, when the scope publishes, the whole range is checked only for leases (`PendingLeaseSerial`, `Texture.cpp:4320`); writers are checked only over the stored layers (`Texture.cpp:4324`). So take a unit shadow that holds another image's retiled results inside the flush range but outside the layers the flushed images store, with an in-flight batch that writes over it. That unit is now published while the write may still be running. Before, it was published after the write had finished. Is that ordered somewhere else (the shadow's notes, or something that drops the unit when a newer GPU write is pending)? If not, should the writer check keep the whole range when `scope != PublishScope::None`, as the lease check already does? The new `StorageFlushOrdering` case with the far fill uses the default `Whole` scope but has no shadowed unit over the fill, so it doesn't cover this. This came up because #12070 changes the same `ownNotes` lines and is stacked on this PR. 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!8887
No description provided.