Repository navigation
Conversation
…itten table
A copied read-only draw input was noted for reuse under the stamp
{tracker generation, collect epoch, registry generation} even when the
collect epoch was 0. A CPU store to a compared (unwatched) host import
changes none of those, so later draws reused the copy taken before the
store. The collect epoch is 0 with APS5_NO_COLLECT_MEMO=1 and on a thread
that has not bumped one yet; such snapshots now go through the
generation-checked draw snapshot path instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0125gxvaRgLMwjs53eqvUzya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PrepareDrawBindingsnotes a copied read-only draw input in the recorder's unwritten-snapshot table under the stamp{TrackerGeneration, CollectEpoch, registry generation}. Later draws reuse the noted copy while that stamp is unchanged. The note was skipped for a zero collect epoch only on the upload path. A copy made throughReusableDrawSnapshotor a new buffer (!uploaded) was noted withstamp[1] == 0as well.A CPU store to a compared (unwatched) host import changes none of the three stamp words, so with no collect epoch every later draw reused the copy taken before the store.
CollectEpoch()is 0 in two cases:APS5_NO_COLLECT_MEMO=1, which documents itself as only turning the memo off;The change notes a snapshot only when
stamp[1] != 0. Without an epoch, draws go throughReusableDrawSnapshot, which checks the range's collect generation.agc_draw_snapshot_epoch_no_collect_memoruns the existing--draw-snapshot-epoch-onlycase withAPS5_NO_COLLECT_MEMO=1. The two reuse checks in that case now hold only when there is a collect epoch, since reuse within an epoch is all they assert. The content checks stay unconditional.Tested
Linux 6.18, lavapipe (llvmpipe, Mesa 25.2.8, LLVM 20.1.2), upstream
main06b3505 compared with this branch on the same machine.Found by: running
ctest -R '^agc_'with the cache and memo switches fromdocs/dev/ENVIRONMENT.md.main,APS5_NO_COLLECT_MEMO=1failsagc_draw_snapshot_epochandagc_driver_recorderwitha draw snapshot does not hold the guest bytes of its draw.7a, where guest memory holds85.Epoch 0 with the memo on: I instrumented the changed branch for one full
ctest -R '^agc_'run with default settings. Nine other tests take a large draw snapshot with a collect epoch of 0, so the noted-snapshot path ran without an epoch outside the switch too:agc_driver_address_draw_space_reuseand four of its variantsagc_driver_recorderandagc_driver_recorded_kept_bytesagc_draw_snapshot_capandagc_driver_volume_mip_targetsAll nine pass with this change. I have not measured how often a title's draw threads run before their first collect epoch.
New test on
main:agc_draw_snapshot_epoch_no_collect_memofails.New test with this change: it passes in 3 of 3 runs, and
agc_draw_snapshot_epochstill passes.Mutation check: I restored
!uploaded ||, and the new test fails again witha draw snapshot does not hold the guest bytes of its draw.With
APS5_NO_COLLECT_MEMO=1across the whole sweep:agc_draw_snapshot_epochandagc_driver_recordernow pass.Full
ctest -R '^agc_'(2324 tests): the results matchmainapart from the new test andagc_driver_msaa_resolve_publication_order. That test fails about 30% of runs onmainwiththe guest arena gave no resolve destination below a multisampled source, and passed in this run.Validation protocol: I ran the same focused tests on
mainand on this change withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layerand validation layer 1.4.363.1. The test regex was^agc_(driver_recorder|draw_snapshot.*|draw_input.*|owned_draw_inputs.*|draw_inputs_.*|untracked_forget|idle_publish_wait|recorder_.*)$.main: 26 of 29 passed and 3 were skipped on this device. The loader inserted the layer, never loggedwas not found but was requested by env var VK_INSTANCE_LAYERS, and the log has 0VUID-lines.VUID-lines.NVIDIA hardware, Dec 1: NVIDIA GeForce GTX 1050 (the machine's only Vulkan device), driver 582.67, Vulkan 1.4.312, validation layer 1.4.363, Windows 11, built with WinLibs GCC 15.2.0. This branch is 97 commits behind
main, so I applied its commit ontomain483b81f and compared that withmain483b81f on the same machine; the branch head itself was not built. Every run usedANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, each run's log shows the loader inserting the layer and none reports it missing, and no log has aVUID-line.agc_driver_graphics,agc_driver_register_keyandagc_draw_snapshot_epoch*: 3/3 pass onmain; 4/4 with this change, the fourth being the newagc_draw_snapshot_epoch_no_collect_memo, which ran and passed.snapshot|recorder|collect:main59 passed and 1 skipped of 60; this change 60 passed and 1 skipped of 61. The skipped test isagc_host_import_retire_snapshoton both.Checks:
tools/check_conventions.pypasses.tools/pr_overlap.py --branchcould not confirm 132 PRs that conflict withmain, so I compared each one by hand.!owned && (!uploaded || stamp[1] != 0). It keeps the zero-epoch note, so the two would conflict textually.ENVIRONMENT_MODIFICATIONlist.drawSnapshotEpochTestscall.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)mainhttps://claude.ai/code/session_0125gxvaRgLMwjs53eqvUzya
Generated by Claude Code