agc_driver_multisample_fill_host_only fails intermittently: the sentinel fill after an absorbed multisampled clear does not land #6512
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-15T18:11:13Z.
What happens
agc_driver_multisample_fill_host_only(core/libs/prx/libSceAgcDriver/tests/execution/MultisampleFillHostOnly.cpp, added in #5313) fails intermittently with:On current main (
03c4cb5e7) it failed 10 of 200 consecutive runs of the test binary (run directly with the ctest environment:ANYPS5_NO_SHADER_CACHE=1,PATHprepended withbuild/core/libs/libs/unpatched, working directory the source root). A single ctest run usually passes, so it shows up as a random red test.Where it fails
I added a local print to
Settle()(not part of any PR) that runs when the comparison fails. It shows the sentinel's value read throughGuestMemory::Read, a direct host read of the block, and a second read after one moreAgcDriverWaitIdle_nid_postfix(). Six failures out of 74 runs printed the same thing every time:So:
Settle(), the one right afterDispatchFill(code, color.Address(), BlockBytes, 0), which is the fillMultisampledColorFillAbsorbstakes as the multisampled target's clear (the absorbed path inExecution/src/Driver/Memory/BufferFill.cpp).Settle()and the later ones never failed.How long it has been there
Failure rates over consecutive runs on one machine:
e34c4792108a7f7a8c03c4cb5e7(current)A first-parent bisect between
e34c47921and38d245448at 60 runs per step ended on a tools-only merge (#5308), which cannot affect this test. The flake is older than that range, and 60 runs are too few at these rates. I don't know which change introduced it. The rate seems to have gone up on newer main, but the samples are small.Not measured
APS5_PIPELINE_DRAIN_FILLS=1, so I don't know whether the queue-0 ordered-fill path (DrawPipeline::Queue0().Enqueue) is involved.Reproduce
Found, measured and written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by fanyzp on 2026-10-15T19:59:38Z.
Not reproducible on Linux/RADV here, and one code path that can produce this shape. A change following from it is in #6548.
Measured on this machine (RADV, Radeon 680M, Mesa 26.2.3, Linux 7.2.8;
ANYPS5_NO_SHADER_CACHE=1, the ctest environment, and 200 of the runs with the process pinned to two CPUs): 300 + 200 runs ofagc_driver_multisample_fill_host_only_testson RADV and 200 on lavapipe: 0 failures. A temporary print inDriver::storeBufferFillshows the absorbed multisampled clear (absorbed 1) and every sentinel fillstored 1, so they are recorded withvkCmdFillBufferinto the host import rather than written by the CPU.What the symptom needs. An imported guest range is the guest's own memory and the CPU reads that pointer, but
bindImport(core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp) binds the import to the first memory type the intersection offers (std::countr_zero), whatever that type guarantees, and nothing invalidates an imported range: there is novkMapMemorybehind it, sovkInvalidateMappedMemoryRangesdoes not apply. On a device whose pointer's bits put a non-HOST_COHERENTtype first (aHOST_CACHEDone, say), a store the GPU makes through the import can stay invisible to the CPU: the line the previous round's read cached is what the later reads return, which is why the value stays at round 1's through more reads and idle waits instead of appearing late. On this machine the pointer's bits are one coherent type, so it cannot happen here, which matches 0/700.Which types your device reports settles it. #6548 takes a
HOST_VISIBLE | HOST_COHERENTcandidate for a host-pointer import (a cached one when the device offers it) and refuses the import when the device reports none, in which case the range is copied and the log sayshost import of 0x… failed at memory type selection without host coherency. After it: an import that is not refused is coherent and this flake should be gone; a flake that continues with no such refusal is a different cause and worth reporting here.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T21:27:36Z.
A Linux + NVIDIA data point. The report has Windows + RTX 3080 only, and #6548 says it is not established which memory types a discrete GPU's driver reports for a host pointer.
Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04 (kernel 7.0.0-38), i7-8700. GCC 15.2, Release,
BUILD_TESTING=ON. Unchangedmainat44df21632. Each run is a freshctest -R "^agc_driver_multisample_fill_host_only$" -j1 --timeout 60, with the selected device checked in every log.ANYPS5_GPU)So the flake does not reproduce on this machine.
Memory types for a host-pointer import on this driver, from a small standalone Vulkan program (not AnyPS5 code): an anonymous private 1 MiB
mmap,vkGetMemoryHostPointerPropertiesEXTwithHOST_ALLOCATION_BIT_EXT, intersected with the requirements of a storage + transfer buffer created for that handle type:HOST_VISIBLE | HOST_COHERENT; 4HOST_VISIBLE | HOST_COHERENT | HOST_CACHEDDEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT | HOST_CACHEDOn this NVIDIA Linux driver every candidate is coherent, so
countr_zeroalready lands on a coherent type here. I have not checked what the Windows driver reports.Written with AI assistance (Claude Code). I ran the tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-16T21:25:59Z.
I independently confirmed the device-ownership defect already addressed by #6522 while validating native multisample initialization. The finding below supports that existing PR; it is not a new fix proposal. Completed follow-up: the actual #6522 commit with the original two-device fixture preserved passes 200 processes on each of NVIDIA, AMD and llvmpipe. The separate experiment below is retained as diagnostic evidence only.
The test keeps the standalone
OpenVulkanTestDevice()alive, then its first packet submission creates the driver's own device. That second constructor activates its recorder globally. The fixture still creates native images using the first device's context, whileMultisampleTarget.cpp::recordCommandstakesRecorder::Active()from the second device. Thus native resources and the command recorder belong to different logical Vulkan devices.A regression assertion immediately after the existing plain-memory control dispatch, before creating any native target, fails on Windows NVIDIA, Windows AMD and Linux llvmpipe:
Independent fixture-isolation experiment: initialize the driver through that existing control dispatch, acquire its actual device through a private test friend, and use that device for the native targets and cleanup. The temporary availability probe is destroyed first. All original fill, sentinel, sRGB and retirement assertions remain. This experiment is preserved on the fork, but is not being submitted upstream: the original two-device fixture provides useful regression coverage for #6522.
bc3c0fc13also fails on both Windows GPUs.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, serial CTest, 30-second individual timeout. Windows was tested at76ba458757b7a310f3934aa2ec1e1bfd402a0253; rebasing to3d5ff37ba7532fce1e76542eac9a57d72471f98echanges documentation only, with identicalcore/contents. Linux was tested at the rebased head.This establishes an invalid fixture setup and a correction, not that every historical round-2 sentinel failure has this cause. I have not reproduced the reporter's RTX 3080 configuration or established whether #6548 addresses an additional cause. No game startup improvement is claimed.
AI-assisted: Codex. Builds, source checks and the runs above were performed locally.
Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-18T00:24:05Z.
Windows + NVIDIA reproduction on current main, and #6522 stops it under the same conditions.
Windows 11 10.0.26200.9711, NVIDIA GeForce RTX 5070 Ti (driver 617.42), Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. main
b51c65dd1. Each run is a freshctest --test-dir build -R "^agc_driver_multisample_fill_host_only$".^agcsuite running at-j7in the background09f5749, clean merge)The failures print
AGC graphics: the sentinel fill did not land, the same message as the report. It first showed up as the single failure in a fullctest -R "^agc" -j8run (671/672 passed). So on this machine it needs CPU/GPU contention and never happened in 200 idle runs, which may be why the Linux runs above didn't reproduce it.With #6522 merged, 0 of 100 under load. At the main rate (13/200), 0/100 would happen by chance about 0.1% of the time. The background load isn't exactly identical between batches (it's the same suite started the same way, but the loop and the suite don't finish in lockstep).
Not checked: #6548. Its merge onto this main conflicts in
docs/dev/debt/libSceAgcDriver.md, and the run was cut short. Running the agc suite in parallel produced repeatednvlddmkmevent 153 GPU resets on this machine and eventually hung it, so I didn't retry under the same load. That happened on plain main too, so it says nothing about either PR.AI-assisted: yes