Repository navigation
Conversation
A GPU copy through one serial can be lost from both sampled aliases when a CPU write to another mip makes a second serial replace their shared NvPkg before the first serial's storage write is submitted. Upload batches run before the command buffer being encoded, so the replacement gets stale bytes. Record the pending store generation on the package and defer replacement through every alias until commit, using the existing upload queue ordering. Extend the synthetic readback fixture with two serials, four layers and three mips, checking every subresource through independent GPU readback. Unchanged ab41 fails four of 274 checks. With the added explicit fence-completion assertion, the fix passes 275 checks in both encoder flag settings under Metal validation, and 276 with fast wake disabled. These flags do not independently prove replay-thread concurrency. No game attribution or performance improvement is claimed. Edge-snapshot synchronization and 1D-array storage coverage in the broader upstream change remain separate open risks. Document the finding and regenerate the symptom index. The shader translation chain and player builds are unchanged. Co-authored-by: Adam Kratch <70729875+akratch@users.noreply.github.com>
…2182) A GPU write into a texture uploaded from its storage is stored into the storage on the GPU in the command buffer being encoded (gsb_store), and an upload batch runs before that command buffer, so a texture with a pending store keeps its host texture until the commit (gsb_held). The hold was keyed by the serial the store went through, but serials over the same storage and description share one NvPkg (pkg_shared): a look through another serial after a CPU write into another image replaced the shared host texture from the storage without the store. The store then wrote the old host texture and the storage, and page tracking does not see a GPU write, so the copied image stayed the storage's old bytes through every serial. The hold is now on the bytes: each store notes its texture's storage range for the command buffer being encoded (64 ranges, then everything), and a packaged texture whose storage overlaps one keeps its host texture until the commit, through whichever object it is looked at. This replaces the serial set rather than adding a package field beside it. Open, and recorded in the reference entry: an object of another description over the same bytes (an sRGB twin) has a package of its own, which is now held as well but never learns of the store, so its next partial upload copies the stored image from its own host texture. PR #2182 found the serial key and wrote the test. t_readback's copy_stream_alias stores through one of two objects over a four-layer, three-level RGBA8 array, writes another layer on the CPU, and reads every image of both back on the GPU, once with a second object of the same format and once with an sRGB one (the sRGB object's stored image skipped, as above). On main the same-format run fails 4 checks, all 4,096 bytes of the copied level lost through both objects. Checked: t_readback 334/334 and 335/335 (DM_NVN_FAST_WAKE 1 and 0, Metal debug layer), test_docs, git diff --check. regress.py check on OCTOPATH TRAVELER II (the lightest NVN game here with a route; the packaged path is NVN's): PASS, 13980/13980 shaders, no MSL change, 59.8 fps and p99 17.87 ms before and after, no new red lines, on an M4 Pro. No game artifact is attributed to the finding. Co-authored-by: akratch <70729875+akratch@users.noreply.github.com>
|
Landed as 05b635c, with you as co-author. Thank you for finding this: your fixture reproduced on current main (4 of 275 checks failing, all 4,096 bytes of the copied mip lost through both aliases). The landed fix keys the hold by storage range instead of adding Your test is in Checked: t_readback 334/334 and 335/335 (fast wake on and off, Metal debug layer), test_docs, and a full regress.py check on OCTOPATH TRAVELER II (PASS, 59.8 fps and p99 unchanged, no new red lines). |
…s has a pending storage write (seedds) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
seedds#2182, seedds#2225, seedds#2194, seedds#2273 (mkw/sets.tsv) Each corrects wrong behaviour on code this game runs and brings a test that fails without it or a measurement; none changes the shader chain. Built on this Mac with 58 warnings as upstream; t_fstep passes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
…s has a pending storage write (seedds) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
seedds#2182, seedds#2225, seedds#2194, seedds#2273 (mkw/sets.tsv) Each corrects wrong behaviour on code this game runs and brings a test that fails without it or a measurement; none changes the shader chain. Built on this Mac with 58 warnings as upstream; t_fstep passes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
…s has a pending storage write (seedds) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
seedds#2182, seedds#2225, seedds#2194, seedds#2273 (mkw/sets.tsv) Each corrects wrong behaviour on code this game runs and brings a test that fails without it or a measurement; none changes the shader chain. Built on this Mac with 58 warnings as upstream; t_fstep passes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
A GPU copy into one mip can disappear from both sampled texture aliases when the CPU writes a different layer before submission completes. The GPU-updated guest bytes are correct, but looking up the other alias uploads the old storage into a replacement host texture before the pending GPU store runs.
Identical storage and descriptions share an
NvPkg; the pending-store guard tracked only the writing texture serial. Record the pending command-buffer generation on that shared package and check it before replacement through either alias. The existing serial guard remains. This adds no wait, cache flush or game-specific rule.The synthetic regression extends
copy_streamwith a second serial over the same packaged RGBA8 array. It independently reads all four layers and three mips through both aliases against literal byte patterns, and checks the stored guest bytes. It verifies the GPU-copied mip, the separately CPU-written layer and untouched neighbors.Validation on Apple M4 Max, macOS 27.2, Xcode 27.2, with Metal API validation:
git diff --checkpasses.The regression waits for the store's fence before the final lookup. GPU edge-snapshot completion and 1D-array storage coverage remain separate questions; this change does not claim to fix them or to explain any particular game's visual issue.
regress.py impact ab41d6a..HEADreports Breath of the Wild, Pokémon Scarlet and Tears of the Kingdom as affected, Hades as unaffected, and 152 profiles without usage manifests as unknown. No exact-branch game run or iOS gameplay check was performed; validation here is the synthetic storage regression. No shader translation-chain change or performance claim.