AGC: sparse BDA stores falsely prove a complete page overwrite #7220
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 Amoenus on 2026-10-17T17:22:14Z.
Current status, 2026-10-22 UTC: #7233 merged as
3ca07d086d5f44fbe3c00370e7f03953ab46ca1bat 12:53 UTC and closed this issue. Its exact head waseb55d58728f367f527253b3ae5b30ed45030fdf3. The possible-write versus exact-completion correction is now on main. The queued-consumer handoff #7371 is also merged; the separate production tracking limitation in #8759 remains open. The qualification below is historical evidence at its stated pins, not a new title run.Our updated Windows report tests eb55 adapted onto main
cd700fe9ec. Control20de25385fhas unchanged eb55NativeMultisampleDepth.cpp, no #7371 production handoff, and only its identical BDA regression added to the adapted base. Both RTX5080 and Radeon Graphics pass the clear group 3/3, each process exercising 26 completed-output cases plus one expected uncovered-HTILE production refusal,checked=27 unavailable=0. The refusal case does not establish completed-clear output; its Windows coverage-loss cause is not isolated. The separate missing-handoff regression fails 3/3 per GPU as expected. Control: 60 passes/six expected failures; literal main:66 passes with its older fixture. No VUIDs, validation errors/warnings, whole-test skips or timeouts. Exact hardware/settings and older evidence remain in the maintained report. No current candidate or Sonic result is implied.Attributed exact-eb55 Linux reports: RTX4070Ti/GCC13.3 completes the tracked clear path; RTX3080/RADV/lavapipe matrix completes it on NVIDIA, with expected safe refusals on RADV/lavapipe. Lavapipe additionally has unavailable cases and a separate BDA skip. These do not establish universal NVIDIA or Windows coverage. The author's scope correction distinguishes test acceptance from a production import/watch fix.
Keep this issue open. The original sparse-store reproduction and held
fe08b72deproposal below have not been rerun on today's main. fe08 remains held because a correction must preserve the recognized full-clear producer. No generic-coverage fix or title-unblock claim. AI-assisted report maintenance: yes (Codex).Original sparse-store reproduction, held proposal and historical positive/negative controls
Historical candidate result, 2026-10-18: #7233 at e7b6e4381f (2026-10-18). The completion-based revision passes the full8-case refusal group3/3 on each physical NVIDIA/AMD GPU, including the same-value partial store. The real BDA positive passes through its new production completion argument, with exact32768-byte metadata readback, complete=1 and owner reuse; the sparse wave32/wave64 controls retain incomplete-page coverage. Full Windows/Linux builds pass. Maintained current matrix, test-only fork, fixture-contract adaptation and #7311 reset correction. The f030 failure below is historical and corrected in this revised validation. fe08 remains held. Sonic's new observed HTILE refusal is a separate title check; no successful e7b6 title run is claimed yet.
Proposal status, 2026-10-17 UTC: do not promote fe08b72de. A new real-GPU producer control confirms that this proposal rejects a legitimate full native HTILE clear on both GPUs. The earlier 54 selected controls did not exercise this path. The generic coverage mismatch below remains reproduced, but the current production consumer also requires an independently recognized full-range kernel; no incorrect native clear or title-visible corruption has been demonstrated. See the end-to-end comparison below.
Independent test-only PR #7228 now carries the standalone GPU regression. It neither ships fe08 nor closes this generic coverage finding.
Original reproduction on pinned main
66702f1cffOn main
66702f1cffd3646f2d674ed093fde0a85a70761f, sparse GPU stores through BDA can makeGuestMemory::StoredAllSince_nid_no_patchreturn true for an entire 4096-byte page. The page contains bytes the shader never stores. This is a completeness-proof mismatch, not a claim that BDA page invalidation should be narrower.Reproducer and evidence
Test-only fork branch, exact head 317ba251804fa7203f26ee511e6450408578e126. Production code is unchanged main; only the fixture and its CTest registration are added.
The test reuses the repository's
NarrowConstantStoreFixture(8 lanes, 16-byte stride, byte/short/dword stores: 56 written bytes within the first 128 bytes). It requires a BDA page-table binding, uses a watched 1 MiB allocation, warms the import, takes a clean generation, dispatches again, waits idle, and verifies every byte of the 1 MiB allocation against the fixture/sentinel pattern before asking the tracker about coverage. The next page remains unmodified and unreported.Both wave32 and wave64 reproduce 3/3 on each physical GPU (12 failing regressions total):
10de:2c02watched=1 generation=6 overlap=0before dispatch; first pageoverlap=1 complete=1, next pageoverlap=01002:13c0Each measured case finishes below 0.6 seconds with shader caching disabled. The assertion is
sparse BDA stores falsely prove a complete 4096-byte overwrite. Target/dependency builds and conventions pass. Linux Ubuntu 24.04/lavapipe builds, but both cases explicitly skip because that import loses write watching; this is not counted as reproduction or a passing behavioral check. Earlier 64 KiB Windows controls likewise lost watching and did not reproduce; the 1 MiB settled import is necessary for this fixture.Reproduce after a normal full test-enabled build:
Select the GPU with the existing
ANYPS5_GPUselector and require Vulkan withANYPS5_REQUIRE_VULKAN=1; verify the selected-device line in the output. CTest suppliesANYPS5_NO_SHADER_CACHE=1.Source path and scope
BdaResources::markWrittenPagesconverts written-page flags into page-alignedMarkWrittenranges.MarkWrittenrecords those possible-written ranges as driver pieces, whileDriverPieces::coverstreats their union as complete byte coverage. Native depth clear completion consumes this proof, but its other producer/HTILE/value checks still apply. This fixture does not establish a wrong depth clear or a title-visible corruption.Found while investigating PPSA99902's #5336: its observed metadata invalidations come from BDA written-page reports. This issue does not establish that changing the proof resolves that title's DCC refusal; the guard must remain until actual metadata transitions are supported. The ordinary manual launch independently reproduced #5336 today.
A proposed correction should distinguish possible-written pages from exact completed stores: keep conservative overlap invalidation, but never let a page flag by itself establish complete byte coverage. Exact
StoreOwnBytes/known fills must retain their existing coverage proof. No capability fallback or guard removal is proposed.Overlap search checked
StoredAllSince, BDA coverage reports, #6346, #6868 and #6455; their currently published changes do not distinguish possible BDA page coverage from exact stored bytes. @SleglJan, this touches tracker proof semantics near your pending work; reporting the independent reproducer first to avoid overlapping implementation without coordination. No duplicate upstream PR has been opened.AI-assisted investigation and fixture: Codex; physical GPU runs and complete readback verified locally. No game code or assets attached.
Tested fork proposal
fe08b72de7631d50ee6c1472d8e35771802a4580, branch codex/fix-bda-store-coverage-main667, separates possible-written driver pieces from complete ones. BDA written-page reports use the possible form; overlap checks still see them, while the full-coverage query excludes them. Exact
MarkWritten/StoreOwnBytescallers retain their complete-store behavior. The candidate also tests an uncertain whole 64 KiB block, an exact dword (complete for its four bytes, incomplete for its page), and an exact page store (complete for its page).At this exact head, full relinker/library builds pass on Windows and Linux. Nine focused groups repeated three times on each verified RTX5080/AMD device give 54 passes, no skips: wave32/wave64 coverage, depth fast clear, depth fast-clear submit, native depth clears/refusals, and 2/4/8-sample DCC clear controls. The formerly failing real-BDA cases now report
overlap=1 complete=0 next page overlap=0, with exact 1 MiB readback. The native-depth fixture's separate selected-device lines also match each requested physical vendor. Every selected test stays under 30 seconds.Linux/lavapipe has 15 passes and 4 explicitly skipped cases in the same selection: the two BDA coverage cases lose write watching, and 2-/8-sample DCC clear controls lack support. No Linux BDA correctness result is claimed. Cppcheck and selected clang-tidy checks parse all three changed translation units without selected diagnostics; conventions pass. Base remains main667.
This is a proposal for review/coordination, not an upstream PR or a claim to unblock PPSA99902. The existing depth-clear fixtures pass, but a title-visible incorrect clear caused by this proof mismatch has not been demonstrated. Producer recognition, completed HTILE values and other existing refusals remain required. In particular, the effect on a legitimate full BDA-written HTILE clear needs an explicit end-to-end control before promotion; page bits cannot alone serve as exact-byte proof. #5336's resident color-DCC refusal is intentionally unchanged. The test-only branch above preserves the unchanged-main failing control.
Full native BDA producer control: proposal regression confirmed
A new test runs the existing recognized 17-word HTILE mask kernel through the normal recompiler/BDA dispatch path, using watched 1 MiB imports. It creates a native four-sample D32 owner for a 5x3 surface with zero-clear metadata, changes the clear value to one, notifies the recognized complete HTILE producer, dispatches all 32 workgroups, waits idle, and verifies the complete 32 KiB metadata range is
0xfffffff0while the rest of its allocation remains zero. It then asks the native owner to reuse its sampled view and attachment.Both sides pass the exact metadata/allocation readback, verify the physical device identity, and finish each case below one second. Main reports
complete=1and accepts the clear. The proposal reportscomplete=0, then throwsnative multisample depth clear has no complete tracked HTILE store. No skip or timeout was counted. Drivers/OS are the same as the earlier table. The initial fixture setup was corrected before this matched comparison; its earlier warm-up initialization failure is excluded.Reproduction: build
agc_driver_bda_write_coverage_testson either linked branch and runctest --test-dir build -V -R "^agc_driver_bda_native_clear$" --timeout 30. These are Windows target/dependency rebuilds on the exact heads; the prior full Windows/Linux builds remain evidence for fe08 itself, not a new full-build or Linux claim for these test additions. Conventions pass. This control checks completed native-owner acceptance plus GPU metadata readback; it does not add a numeric sampled-depth readback or a title/gameplay claim.Why this matters:
HtileDepthClearBytes_nid_no_patchchecks a known unconditional kernel and complete direct workgroup extent before the driver callsNoteHtileDepthClear. The native clear consumer relies on that producer restriction as well as completion/CPU/depth/value checks. Globally downgrading all BDA page records without replacing that producer's completion proof regresses an existing supported path. The earlier native-depth fixtures simulated completion withStoreOwnBytes, so their passes did not establish this preservation requirement.The original sparse-store finding establishes that page coverage cannot be used as a generic exact-byte proof. It does not by itself establish a bug in the restricted native consumer. Please keep the fe08 branch as investigation material; no upstream PR or integration rollout of that proposal. A complete correction must preserve this positive producer case as well as reject unproven sparse coverage. Coordinating here avoids interfering with #6346/#6868 or submitting a guard-removal workaround. AI-assisted fixture/analysis; no game code or assets attached.
Historical f030 control: the maintained report retains the accepted4-byte/32768-byte same-value partial-clear reproducer and unchanged-main refusal. The revised e7b6 callback no longer reproduces that acceptance in our current physical-GPU and lavapipe refusal matrices. This does not turn the historical f030 result into a title finding.
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-17T17:31:17Z.
@Amoenus thanks for checking first. Neither #6868 nor #6346 changes how MarkWritten ranges count: BDA page ranges still become driver pieces that StoredAllSince treats as complete, so your fix doesn't duplicate either one. Go ahead.
One interaction with #6868: a new driver piece whose range contains older pieces' ranges now takes one of their slots and clears the others. If pieces get an exact/possible kind, a possible page range shouldn't take or clear the slot of an exact piece it contains, because that piece's completeness proof would be lost.
Also: MarkDirectWrites passes whole writable buffer ranges to the same MarkWritten, so those ranges are possible ranges too. A kind added only in
markWrittenPagesleaves the same false proof for descriptor-bound sparse stores.If your fix lands first, I'll rebase #6868 onto it. I can also run 007 First Light on it. That title hit #6868's case, through MarkDirectWrites ranges rather than BDA page flags.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-17T18:29:27Z.
@SleglJan noted the kind-aware slot reuse and the additional
MarkDirectWritesproducer. A further positive control changed the next step: main accepts the recognized full HTILE kernel3/3 on each GPU, while fe08 rejects it3/3 despite correct32KiB metadata readback. That first proposal is held; test-only #7228 preserves this missing GPU producer case. Exact control branches/results are now in the issue body.A complete correction must cover both possible-range producers, preserve exact pieces when coalescing possible ranges, avoid exhausting slots on repeated possible stores, and retain a completion proof for legitimate full HTILE clears. That broader correction is not ready, and I have not claimed a new007 validation. I will link the next tested candidate here before coordinating its order with #6868.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T15:20:55Z.
Thanks for running the no-host-import control. Since the worker exits at the native-depth read refusal before attaching a completion, this control cannot isolate the write-watch import from the later check. That confirms the existing test harness needs the real driver-device import path (or a targeted production change) to validate the interaction; it does not yet validate a proposed fix. I agree the earlier candidate should remain held until the full-clear positive control and both possible-range producers are covered.