Repository navigation
Conversation
…hazards A recorded draw's pass access listed its shader-resource reads, indirect arguments, storage images and resident color targets, but not the index and vertex ranges it binds in place from host imports (DrawInputs::inPlaceReads) nor its multisampled color targets (null in RecordedDraw::targets). A later draw writing those ranges through a shader buffer, or a pass sharing the multisampled target under another pass key, found no hazard: the break between the passes recorded no barrier, or the later draw continued the pass, so its writes could land before the earlier draw fetched its inputs, and the two passes' attachment writes and store operations on the multisampled image were unordered. The in-place input ranges join the pass reads, and MultisampleTargetView reports the target's image, which joins the pass attachments as written.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Runtime datapoint on NVIDIA hardware. RTX 3070, Ampere, driver 617.42, Windows 11 26200, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1. Head 3d457b9, all binaries rebuilt on this head, ctest serial:
18/18 pass on Ampere — read-only shader-buffer publication and the buffer-refusal boundary hold. |
…hazards A recorded draw's pass access listed its shader-resource reads, indirect arguments, storage images and resident color targets, but not the index and vertex ranges it binds in place from host imports (DrawInputs::inPlaceReads) nor its multisampled color targets (null in RecordedDraw::targets). A later draw writing those ranges through a shader buffer, or a pass sharing the multisampled target under another pass key, found no hazard: the break between the passes recorded no barrier, or the later draw continued the pass, so its writes could land before the earlier draw fetched its inputs, and the two passes' attachment writes and store operations on the multisampled image were unordered. The in-place input ranges join the pass reads, and MultisampleTargetView reports the target's image, which joins the pass attachments as written.
…fresh-pr7002-maine1 # Conflicts: # docs/dev/debt/libSceAgcDriver.md
|
@Amoenus Exact SHAs of that test: Yes, both 4x targets are drawn to again after the 1x accesses. In a local run with the guard retired instead of throwing (the same idea as #6808), with a print where a host multisampled target is created and where a 1x access retires a guard, the log has the same four events 45 times in a row:
The next cycle then creates both 4x targets again for the same memory, so this is a live alias reused every cycle, not memory reused after the target is dead. My prints covered only those two points, so I can't say whether a cycle starts with a clear, or whether the 4x targets are also read as multisampled resources between the steps. |
|
@hugodearaujo Recorded your exact pins and repeated live-alias sequence in the PR report. Drawing to both 4x targets again distinguishes this from dead-allocation reuse. The important scope boundary is that #7002 handles read-only shader buffers; it does not establish coherence from the 1x storage write back into subsequent 4x use. The guard-retirement experiment therefore does not by itself validate that handoff. Clears before reuse and any intervening multisample reads remain unknown, as you noted. This belongs in the broader #6480 alias work; I have kept it separate from this PR's supported paths and validation claims. |
What
Publish supported native MSAA color contents before logical read-only shader-buffer consumers upload or reuse them. This follows refreshed #6995's CPU handoff and retains exact #6498's strict binding guard. The current refresh below includes main
3b20a366ca, with prerequisite attribution and scope retained.Image-alias scope: logical read-only buffer descriptors here exclude sampled/storage-image aliases. Merged #5881's matching native-MSAA storage-view path remains separate. A1x image at twice the extent over4x native color memory, format reinterpretation and SW_64KB_S publication are not implemented by this PR. Mirage report and source-only clarification; no Mirage unblock is claimed.
Preparation, final upload, compute reuse validation and moved draw snapshots request the sample-preserving handoff before command-buffer binding. Binding still only asserts that no unsupported native owner remains: it does not wait or submit. Moved snapshots check the current logical descriptor range, leaving an unused old range guarded. Writable buffers and unsupported layouts remain refused.
All writable bindings are checked before any read-only publication. During extraction, a preparation-only regression found that processing a read-only alias first could retire its native owner and let a later overlapping writable binding through. The submitted implementation checks writable bindings first and verifies refusal leaves the complete guest bytes and native owner intact. The regression never executes the overlapping writes.
The direct difference from #6995 composed with the same main is five files, +462/-15, including declared prerequisite #6498 and its retained refusal cases. The comparison base isolates the source delta; it is not a separate tested binary. The existing read-only handoff, tests and attribution are preserved. The submission continues to use the actual device-draw fixture.
Related #6808 changes native color reuse but does not implement this sample-preserving buffer handoff. Coordination and exact fork findings are maintained in #6480 and our existing comment on #6808. No duplicate implementation was found in the open/merged searches. The checker also flags #6947's adjacent snapshot early-return edit. Coordination preserves this handoff before that condition when rebasing; its combined GPU-heap/space-reuse path remains untested. General metadata/depth publication, fixed-function vertex/index inputs, dynamic BDA and console equivalence remain outside this change and are recorded in technical debt.
Tested
Current refresh (2026-10-19 UTC): head
8221cbccadincorporates main3b20a366caa8a8de5509e7add433c55275aa6f29, refreshed #6995d0a7c59630and exact #6498103e467afc, with original attribution retained.This includes main's copied-writer overlap correction (#6365): mixed producers wait for copied ranges instead of unrelated direct GPU ranges. Main's optional timing-query change, shader position-export change, host-read coherence, copy settlement, precise write tracking and merged #6215 lifetime/device work are retained. The own synchronization/strict-binding routines and complete buffer execution fixture remain unchanged from the qualified
4e5ffdda3ccheckpoint. The fixture blob is6034ab8e44ca68842716d7a9e2e988bc91154857.For review, direct comparison against #6995 composed with the same main is five files, +462/-15, including the declared #6498 prerequisite/refusals. The comparison base is a source composition for isolating this delta, not a separate tested binary or an additional PR.
Matching Windows build: full relinker/system libraries and all selected fixtures pass. Seventeen GPU groups repeat three times per verified physical device: buffer publication/refusals/draw recipe; CPU and explicit publication; snapshot/native readback/initial contents; default MSAA sampling/shared readback/upload/pass ordering; retirement/storage-file write/alias-copy label/two-device host-only fills; and main's mixed copied/direct ordering mode. Five CPU groups repeat three times: graphics, shader memory, copy-input budget, depth-copy budget and write tracking. 51 NVIDIA + 51 AMD + 15 CPU = 117 passes, no VUIDs/validation errors/warnings/whole-test skips/timeouts. The copied/direct fixture's internal capability-skip text is also checked and absent. Actual device identity and Khronos insertion are verified per process; each test has a 30-second bound.
Windows 11 Enterprise 26200 / WinLibs GCC 15.2 r7; RTX 5080 driver 610.62/32.0.16.1062, Radeon(TM) Graphics driver 32.0.21036.18; Khronos 1.4.363. Vulkan required, project shader cache disabled, driver caches uncontrolled, no separate game process.
Cppcheck 2.20 then clang-tidy 23.1.3 on ShaderResources, MultisampleTarget and the fixture completed in 63.632 analyzer seconds, with no parser/configuration failures or timeouts. Three Cppcheck advisories remain: trace pass-by-value advice and the two inspected conditional/checked allocation reports. Two clang analyzer paths were inspected again: the timer path assumes its null constructor frame becomes non-null without initialization; the memo path gives an unchanged const span contradictory eight/non-eight extents. The constructor/Get and span invariants rule out those reported null paths. PerformanceTimer/CaptureTrace headers match main, and the precollectImages implementation is unchanged. No confirmed new defect, suppression, automatic fix or static-clean claim.
Historical read-path controls remain scoped to
4e5f: six expected failures when only the read-only synchronization call becomes a strict native-owner refusal, then exact restoration/full matching rebuild and 12 passes. Those unchanged-code controls were not rerun on8221; the new main/composition tests above are separate evidence. No writable-buffer, image-alias, BDA or fixed-function publication is added.Later main
a373e85e56merges cleanly. Its inspected changes cover the optional Windows allocator, versioned register-default tables, nested-return structurization and later-slice depth HTILE clearing; the buffer synchronization, binding guard and native color snapshot/publisher are unchanged. These later changes are not included in the exact tested composition. No new Linux/Intel/full-suite/console-equivalence, title-unblock or performance claim. The peer's live 1x-image write followed by 4x reuse remains a separate unresolved scope below. Remaining declared dependencies must land; ordinary Sonic observations remain in #7260 and discussion #4443.Previous 4e5f fork checkpoint, retained at its original pins, retained at its original pins
Validated fork checkpoint (2026-10-18 UTC; published PR head remains
131396fc0d): head4e5ffdda3cincorporates main0fd3555ad6ea56e2acc4caaaec9019db4314db47through published #6995 parent4206f220d1; current #6498 head103e467afcis also an ancestor. Credited dependency history is retained. The merge is clean. The synchronization/binding-check functions and all three buffer-publication/refusal/draw-recipe fixtures are byte-identical to published131396fc0d. The full difference to #6995 is five files, +462/-15, including the declared #6498 prerequisite.Matching full Windows relinker/system-library and affected fixture builds pass. Twelve GPU groups repeat 3 times per verified physical device: buffer publication, buffer refusal, draw recipe, automatic CPU publication, explicit publication, snapshot, native readback, initialization, default multisample sampling, shared readback, upload and pass ordering. 36 NVIDIA + 36 AMD + 6 CPU = 78 passes, zero selected whole-test skips/VUIDs/validation errors/warnings. Graphics and shader-memory CPU groups each repeat 3 times. Actual device identity and Khronos 1.4.363 loading verified per GPU process; every test has a 30-second bound.
Matched read-path control: keep writable-first checks, strict binding guard, publisher and fixtures intact; replace only read-only buffer synchronization with a strict native-owner refusal. Three fresh buffer-publication runs per GPU fail with
AGC graphics: a shader buffer read of ...: 6 expected failures, no timeouts or Vulkan diagnostics. Restore exact source bytes (SHA-256 checked), repeat the full matching build, then buffer publication and draw recipe each pass 3 times per GPU: 12 restored passes. No control is committed.Windows 11 Enterprise 26200 / WinLibs GCC 15.2 r7: RTX 5080 driver 610.62/32.0.16.1062 and Radeon(TM) Graphics driver 32.0.21036.18. Vulkan required, application shader cache disabled, serial fresh processes; no concurrent game.
Cppcheck 2.20 then clang-tidy 23.1.3 completed on ShaderResources, MultisampleTarget and the fixture in 63.828 analyzer seconds, no parser/configuration failures or timeouts. Three Cppcheck advisories remain: two inspected conditional/checked allocation reports, plus pass-by-value advice in unchanged main trace code. Two clang analyzer warnings were inspected: the timer trace assumes a null constructor frame becomes non-null at Finish without initialization; the memo trace assumes an unchanged const span has both a non-eight and eight-word extent. The constructor/Get invariant and unchanged span rule out those reported null paths. PerformanceTimer/CaptureTrace headers and precollectImages are byte-identical to main. No confirmed new defect, suppression, automatic fix or static-clean claim.
New-base refresh pending: main
84c1a4d9a2subsequently landed GPU host-read coherence, alias-copy destination settlement and transient copy-budget accounting. Its test additions conflict with the shared CMake insertion point. These dependencies need renewed validation before promoting this checkpoint to the PR branch. The refreshed parent on that base is being built; the completed results above remain pinned to4e5f/0fd. The checkpoint is preserved on our fork validation branch. Historical evidence and the peer live-alias boundary keep their explicit scope below.Previous validation retained at its original pins
Current refresh (2026-10-18): exact head
131396fc0dfd98eb9cb7347fae9809c941feedb1, main218aa8f00b. Full Windows relinker/system-library and affected fixture builds pass. Ten GPU groups repeat3 times on each verified physical device, plus graphics/shader-memory repeat3 times: 30 NVIDIA +30 AMD +6 CPU =66 passes, no skips, VUIDs, validation errors or warnings. Khronos1.4.363 loading and actual GPU identity are verified per GPU process; all tests fit the30s bound.Groups cover native color readback, initial contents, snapshots, GPU/CPU publication, buffer publication/refusal, the draw recipe, sampled multisample targets and native-MSAA vertex inputs. Windows11 Enterprise26200, WinLibs GCC15.2r7; RTX5080 driver610.62/32.0.16.1062; Radeon(TM) Graphics driver32.0.21036.18. Conventions pass against inspected later main5057673804. No additional title or exact-head Linux run is claimed; older Linux/negative-control evidence below retains its own pins. #7570 remains the separate sampled-cache fixture selector correction.
Current rebase validation (2026-10-18): exact head
53282f62c28a27a897f6f0de3e6deb46074f2140, main9caecfd2d5, declared dependencies retained. Windows11 Enterprise26200 / WinLibs GCC15.2r7; Ubuntu24.04 / GCC13.3 / Mesa25.2.8 lavapipe. Vulkan required, application shader cache disabled, serial fresh processes; host driver caches uncontrolled.relinker,libs) and the sample-target/CPU-graphics targets pass on both operating systems.10de:2c02, AMD Radeon(TM) Graphics1002:13c0, or Linux lavapipe. Validation is loaded, with zero logged VUIDs, validation errors or warnings in these selected runs.This is focused library/fixture validation. Historical game bring-up, fault controls and other results below retain their original pins. No new whole-title, FPS, completion or console-equivalence claim.
Earlier validation and maintenance at their original pins
Synthetic Vulkan execution fixtures. The original 57-process matrix and analysis retain pin
066f527694f9a71b8ff379bf9553dbdfc3000853. Final head3d457b9a832c28826c826ff99de01e17872398adincludes main29bfe31dd8a20650ba01059d44d96100c9b5e526. Its own ShaderResources implementation and fixture are unchanged; upstream shader changes received separate validation below. Both final OS builds compile relinker, libraries and the selected fixture.Comparison baseline with that main and both prerequisites: 59ca589f0. Pre-feature production guard matches
8ae7d561e19311cdbc6278c35ff5c1bf192d89bfexactly.24 additional rebase passes: all three new modes once per NVIDIA/AMD/llvmpipe adapter, plus all three under llvmpipe core validation (12), at
2835de774after main's dominator-bitset change; the same bounded matrix again at final3d457b9a8after the sampler/runtime-ABI change (12). All byte, ownership, mixed-alias and pixel oracles pass; no validation errors. There are 81 successful processes across these explicit pins, not 81 runs of the final head. Earlier controls remain at their original pins.57 successful processes: buffer publication, unsupported-buffer refusal and direct draw routing three times per verified NVIDIA/AMD/llvmpipe device (27); six existing affected modes once per device (18); those three new modes once under llvmpipe core validation (3); then all three once per device after restoring the control (9). Maximum 3.43 s. Project shader cache disabled; each mode has a 30 s timeout. Both final OS builds compile relinker, libraries and the selected fixture.
Buffer publication covers fresh, warmed, edge-overlapping, deferred and cached-recipe dispatches, adjacent logical ranges, a standalone written alias, and overlapping read-only/writable preparation. The latter checks all guest bytes and native-owner retention. Unsupported Standard4KB coverage retains six refusals, prepared/deferred and non-null recipe controls, adjacent reads, output bounds and unchanged native samples. Its neighbor control starts after the conservative guarded extent, not after an inferred console footprint.
Draw coverage executes ordinary
VulkanDevice::Draw, eligible unchanged-inputDrawFromRecipe, and a moved-fragment ordinary draw retaining the same cached resource template. RGBA32F output distinguishes original/current/moved raw words; covered/clear pixels, all four channels, complete source bytes/padding, output neighbors and the unused old guard are checked. This does not execute PM4 draw-key/variant selection. New shader-buffer fixtures cover 4x RGBA16F, not all formats/sample counts.18 pre-feature refusal failures: control 1e823c956 restores only pre-feature ShaderResources source/header. Both publication and draw modes fail three times per device with the existing host-only refusal. Restoration passes. This is main plus the required foundation/guard stack, not unchanged main without its dependencies.
Nine ordering-regression failures: control 7698eb434 retains the earlier single-pass proposal. Three preparation-only processes per device return a non-null resource plan without refusing the overlapping writable alias. The final writable-first pass fixes this. No overlapping writes, device-loss or timeout control is executed.
Khronos 1.4.363.0 core layer insertion confirmed for instance/device in all three llvmpipe modes: zero VUIDs/validation errors. No synchronization validation or Windows layer claim.
Cppcheck 2.20 followed by clang-tidy 23.1.3: 40.963 s analysis; two Cppcheck and two clang-tidy advisories in unchanged CaptureTrace, allocation-helper, PerformanceTimer and image-binding contexts. Source-context equality against the prerequisite baseline is checked. No new selected diagnostic, parser/configuration failure, suppression or automatic fix; not a clean whole-project analysis. Conventions, whitespace and registration checks pass (924 executables, not a full-suite execution).
Windows 11 Enterprise 26200 / WinLibs GCC15.2r7; Ubuntu24.04 WSL / GCC13.3 / Mesa25.2.8 llvmpipe LLVM20.1.2. Physical device identity is verified per process. Existing CPU modes include 2/4/8 samples and XOR 0/0x8100 on hardware; software excludes unsupported 2x/8x subcases. No fresh title startup/FPS, PS5 equivalence, performance improvement or guarantee against concurrent unsynchronized guest writes is claimed.
Current rebase validation, 2026-10-17
Current head:
16ccc1935e, containing main21a0672ab25e8170e128f03a136085101e76e2c2. It merges cleanly with later main47a266cf975f00f7fba94013467d03bfa5e355e9; intervening main changes do not alter this MSAA implementation or these fixtures. Source pins were frozen during validation. The declared prerequisite stack and original authorship are retained; foreign dependency commits have not been replaced. Removed the duplicate test-only VulkanDeviceTestAccess definition introduced by the main merge; retained the single identical upstream accessor. Kept the adapted buffer helper/refusal cases and removed the obsolete duplicate helper block; separate-function cleanup retains the correct device lifetime. Refreshed #6498 ancestry is dd44829.On this exact head, full relinker/system-library (
relinker,libs) builds and affected fixture/CPU graphics targets pass on Windows 11 Enterprise 26200 / WinLibs GCC15.2r7 and Ubuntu24.04 / GCC13.3.agc_driver_native_color_buffer_publication,agc_driver_native_color_buffer_refusal,agc_driver_native_color_draw_recipe,agc_driver_native_msaa_vertex_inputeach pass three fresh processes on RTX5080 (10de:2c02, driver32.0.16.1062), Radeon Graphics (1002:13c0, driver32.0.21036.18), and Mesa25.2.8 llvmpipe (LLVM20.1.2): 24 physical-GPU test passes plus 12 software-Vulkan passes. CPU graphics passes three repetitions on each OS. Device identity verified per process, Vulkan required, project shader cache disabled, serial tests, 30s per-test bound; maximum complete selected CTest invocation 3.265s. Windows Khronos1.4.363 is confirmed loaded with zero observed validation errors/warnings. No whole-test skips/timeouts; llvmpipe's unsupported 2x/8x internal sample subcases remain excluded by the existing fixture.Conventions and diff whitespace checks pass against the inspected later main. Earlier analyzer/regression controls remain below at their original pins; no new static-clean, full-suite, Intel/console-equivalence, title-startup or FPS claim. The first local attempts exposed duplicate fixture declarations/helpers; the counts above refer only to the corrected head.
At this final composition, main's seven shutdown-worker groups also pass three repetitions on each OS (42 CPU test passes). These are lifecycle controls, not additional GPU runs.
Earlier rebase validation retained at its original heads
Rebase validation, 2026-10-17
Current head:
75ea360469769eb18cd53142cbddf44c6a832647, containing mainef674f5af3e4d0fe44fda10e46d36ead2c262c0eand refreshed parent #6973 atb64742f8679010aba1209c01f1155f91f27ec860. Replayed this PR's own topic commits onto the refreshed parent chain; original published heads are preserved. The native-color implementation/header and combined sample fixture are byte-for-byte identical to the preceding published head. The inherited correction in #6973 gives two older MSAA control fixtures modeled RenderTarget allocations, retaining all assertions and production refusals. Thanks to @blawesom for the parent rebase handoff.Main advanced to
6d6e33d638ab22a9270079e035b7d981dd587f3cduring these runs. Its locale/aligned-new/NID-tool changes do not touch this MSAA code or contribution instructions; the tested source pins were retained, and conventions were rechecked against the new main before push.At this exact head, Windows 11 Enterprise 26200 / WinLibs GCC 15.2.0 r7 builds the full relinker/system-library targets and affected fixtures.
agc_driver_depth_storage_dispatch,agc_driver_multisample_readback,agc_driver_multisample_readback_depth,agc_driver_multisample_readback_uint128,agc_driver_multisample_readback_uint16,agc_driver_multisample_readback_uint64,agc_driver_multisample_readback_uint8,agc_driver_multisample_readback_upload,agc_driver_multisampled_pass_order,agc_driver_native_color_buffer_publication,agc_driver_native_color_buffer_refusal,agc_driver_native_color_cpu_publication,agc_driver_native_color_draw_recipe,agc_driver_native_color_initial,agc_driver_native_color_publication,agc_driver_native_color_readback,agc_driver_native_color_snapshot,agc_driver_sample_multisample_target: 3/3 on NVIDIA RTX 5080 (driver 32.0.16.1062) and AMD Radeon(TM) Graphics (32.0.21036.18), 108/108 fresh processes. Vulkan required, shader cache disabled, serial tests, actual selected vendor/device verified, 30-second timeout.python tools/check_conventions.py --base origin/mainpasses.The final dependent composition #7002 at
75ea360469769eb18cd53142cbddf44c6a832647also builds relinker/libs and affected fixtures on Ubuntu 24.04 / GCC 13.3, then passes all eighteen selected MSAA groups 3/3 on Mesa 25.2.8 llvmpipe (LLVM 20.1.2), 54/54. This Linux result belongs to that final composition; it is not a standalone Linux run of every intermediate head. Unsupported software 2x/8x subcases are explicitly excluded; no whole-suite, Intel, game-startup or FPS claim. The earlier Intel upload mismatch reported on #6973 is not resolved by our device coverage.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)10de:2c02), driver610.62 / 32.0.16.1062; AMD Radeon(TM) Graphics (1002:13c0), driver32.0.21036.18; both Windows11 Enterprise26200Peer live-alias evidence and scope
hugodearaujo's report uses main
6efb7261b, #753251e5eae15, #7533bfcb8fcdf, #6343ce5b0c395and older #7002d9b584e423. Their local guard-retirement experiment reports 45 repeated cycles: create two 960x540 4x targets (R11G11B10F and R16F), perform 1920x1080 1x storage-write/overlapping texture-read accesses, then draw to the 4x targets again. This is evidence of live alias reuse, not merely allocation reuse after a target dies. It is the peer's observation at those pins, not a new local reproduction or proof of correct pixels after retiring a guard.This PR only prepares native color for read-only shader buffers. It does not establish the reverse handoff from 1x storage writes into a later 4x target, or coherence between the overlapping image views. Retiring the guard alone does not settle that requirement. Clears before reuse and intermediate multisample reads are unconfirmed in the peer report. Keep those unknowns explicit in the broader #6480 alias work; this report does not broaden the PR's supported paths or title-unblock claim.