Repository navigation
Conversation
Rejected records still added their cost to the list's budget, so the word wrapped and let work in again: of 128 garbage draws (2^26 vertex instances each once clamped) four ran where two fit. One group now walks the records in tiles of 64: every lane clamps its own record, and the first lane charges the tile's records in order. No word is shared between groups. Reserving by compare-exchange was tried: 16,384 small records took an RTX 4080 past the host's time-out. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The layouts follow AMD's addrlib, but the tests only checked them against themselves (every element on its own address) and a few hand-worked offsets. Two tests now pin them to addrlib itself (Mesa src/amd/addrlib at ed09d38, Navi 21 settings): - layouts_match_addrlib: 21 descriptions over every mode Layout::offset addresses (linear, 256 B, 4 KiB and 64 KiB S and D; 1-16 byte elements, block compression, arrays, mip tails, 2D and 3D), each with addrlib's surface size, first tail mip and a hash of the address of every element. - deep_volumes_keep_their_chain_in_each_slabs_tail: a 16x16x64 volume whose chain is all in the tail (addrlib's mipChainInTail), with explicit addresses: each 16-slice slab has its own tail block, and mip 1's 32 slices span two of them. Over a wider sweep (about 20,000 descriptions, every mip count for volumes up to 256 deep) main matches addrlib exactly in size, tail and every address compared. A tail-entry rule that also requires a mip's depth to fit one slab changes 5,456 of 14,780 volume layouts (5,087 grow, by up to 5x) and moves their addresses; both tests fail with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fence.rs already implements ID3D12Fence1::GetCreationFlags at slot 11 (0x58), but FENCE_IIDS only listed ID3D12Fence and PAGEABLE_IIDS, so CreateFence and QueryInterface rejected ID3D12Fence1 with E_NOINTERFACE. Add ID3D12Fence1 (433685fe-e22b-4ca0-a8db-b5b4f4dd0e4a) to FENCE_IIDS and add a unit test covering creation, QueryInterface, and GetCreationFlags. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A package copied without the DLLs that ship beside the executable leaves every import from them unbound, and the title stops at its first call into one: Grand Theft Auto VI 1.0.2.1 at +0x2237178 during System Init (Marvisak#930, Marvisak#1553, #8), with nothing saying why. After mapping the title DLLs, name the main image's static imports that must come from the title's folder (neither the host nor our runtime serves them) but were not mapped from it. Print them; when executing with the default trap policy, stop before running title code. With `--unimplemented zero` the title still runs (stubs were asked for). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
save() releases LAST and library locks before calling write_atomically(), which always wrote to the same fixed host-pipelines.tmp path. Concurrent worker saves and shutdown save(true) can truncate or unlink each other's temp file on Windows. - Serialize write_atomically() with a mutex and unique per-call temp filename (.tmp-<pid>-<n>), cleaning up the temp file on rename failure. - Add a 4-thread concurrent write_atomically stress test.
…ted() GetCopyableFootprints does not pad the final row of the final subresource to RowPitch, so pitch * rows * depth in Staging::detile can exceed the mapped upload buffer size (UB in from_raw_parts_mut). committed() also used unchecked p + len (wrapping to end < p in release) and ignored PAGE_NOACCESS / PAGE_GUARD. - Keep Staging.size unconditionally and clamp subresource slice length to size - footprint.Offset via subresource_len(). - Check overflow with checked_add / saturating_add and reject PAGE_NOACCESS / PAGE_GUARD in committed(). - Add regression tests for both.
…ages A title makes its window on one of its own threads and reads its messages only when that thread reaches its PeekMessage loop. In slow frames and loads that is seconds apart, so the system shows the busy cursor over the window and a click turns it into a "Not responding" ghost. A top-level title window is now made message-only (it can never be shown), and a stand-in window with the title's text, style, icon and fitted size is made on a thread of ours that does nothing but pump its messages. The title's ShowWindow shows the stand-in, its window text follows, closing the stand-in suspends and ends the title as before, the keyboard window menu is still refused, and the stand-in goes when the title's window does. Frames are presented to the process's visible window, now the stand-in; input is unaffected, since titles read it through GameInput, not window messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s request The title writes a request's page list after enqueueing it, and a queue half full is submitted on its own, so a read can start before the list is filled. It then names page 0 (no page: numbers start at 0x10_0000), the write to physical pages fails, and the request fails silently: the title never reads a request's result, so the model or texture stays unwritten. The list is now read again for up to 8 ms before the request fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f E_NOTIMPL ID3D12Device::GetDeviceRemovedReason "gets the reason that the device was removed, or S_OK if the device isn't removed" (Microsoft D3D12 reference). Slot 37 (0x128) in the device function table was left on the default handler, returning E_NOTIMPL (0x80004001) on a healthy device, which a title checking FAILED(GetDeviceRemovedReason()) takes as a lost device. Wire slot 37 to removed_reason, which queries the host device's GetDeviceRemovedReason() and returns S_OK on Ok (or when there is no host device) and the error's HRESULT otherwise. Add a unit test verifying slot 0x128 returns S_OK on a healthy device. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The f16 interpolation always wrote the low destination half via low_half() and dropped the VOP3 output modifiers. Write through write_half() (op_sel[3], SDWA) and apply omod then clamp to the f16 result in f32 so the conversion rounds once, matching write_f()'s order. Addresses VIC-BT-029 from audit Marvisak#1242. Validation: - cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests - cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings - cargo xtask policy
`Instruction::name()` binary-searches the opcode table, and the pipeline asks about every instruction eight times per translation: `ir::build`, `structure`, `resource` (which has the most call sites), `io` and `lower`. The answer cannot change - the encoding and opcode are decoded from the words and never rewritten - so resolve it once when the instruction is built and read the field after that. Measured with the synthetic bench from Marvisak#1002 (no game data), sixteen interleaved rounds per arm, best of each, nanoseconds per instruction, at 256/1k/4k/16k instructions: resource 17 -> 9, 15 -> 7, 24 -> 16, 23 -> 15 (0.47-0.67) lower 511 -> 479, 428 -> 411, 440 -> 401, 477 -> 428 (0.90-0.96) io 27 -> 23, 26 -> 21, 26 -> 22, 30 -> 22 (0.73-0.85) whole 926 -> 881, 920 -> 874, 958 -> 921, 1019 -> 939 (0.92-0.96) `decode` pays the one search it used to be spared (112 -> 115 at 16k, inside the run-to-run spread); every stage after it reads a field. The emitted DXIL is byte-identical at all four sizes. cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored. Both clippy configurations clean; cargo xtask policy ok.
Recovery took any name `v<digits>` as a version, so a leftover `v01` next to a committed `v1` parsed as version 1, and the cleanup rebuilt the name as `v1` and deleted the committed save (Marvisak#870). A correctly named but unreadable newer entry (an empty `v2`, a file, a broken manifest) did the same: `v1` was pruned as older, the read failed, and the next update committed a fresh `v1` holding only the changed blobs, which the following read pruned again. Now only `v<N>` exactly as `commit` writes it is a version. `current` takes the newest version whose manifest reads, removes only versions below it, and leaves unreadable newer entries alone. An update goes above the highest version name present, so a stray entry neither hides the save nor blocks writes. With no readable version at all, reads and updates still fail and nothing is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the console, whole-quad mode puts a pixel shader's helper lanes in EXEC, so a waterfall loop (read the first lane's value, run the lanes with that value, take them out of EXEC) serves them too. On the host, wave operations leave helper lanes out: once only helper lanes are left in such a loop, WaveReadLaneFirst reads no lane, no lane matches, and the loop runs to the iteration limit in each of them. In a retail title's world, draws took 0.3 to 1.3 s each until a submission passed the host's 2 s limit: DEVICE_HUNG about 200 s into the world. A helper lane now takes its own value, so it matches in the first pass and leaves. What it computes only feeds derivatives; its stores are dropped already. Waterfall reads the proof already turns into per-lane reads are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 9d5ce7a)
Shadow::update skipped the ranges an earlier list of the same submission declared as written by shaders, so the title's writes there (constants, sizes) stayed stale in the copy for the whole submission; on an RTX 4050 Laptop a dispatch read its sizes as zeros and looped until the device was removed. A submission waits for the one before it, so none of its shaders has run when it refreshes: update_busy copies the pages the title wrote there since they were taken (Tracked::take), and puts the same bytes into the snapshot writing() took, so copy_back neither takes them for the GPU's nor puts them back over a later title write. Test: title_writes_under_a_busy_range_are_copied fails on main and passes with this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`State::execute_indirect` refreshes the argument buffer from title memory and dispatches the argument clamp (`indirect::bound`) before it asks whether the call can run. When the pipeline has not been built yet - `prepare` returning false, which Marvisak#400 measures at 1 400-1 750 indirect calls a frame, Marvisak#255 at 1 294, Marvisak#748 at 64 plus 282 refused compute pipelines - the call is dropped after paying a copy and a GPU dispatch with its barrier, for records nothing reads. Ask `host_pipeline` first. It is the same lookup `prepare` does a few lines later, and `None` means the call cannot run, so it is dropped before the refresh and the clamp. A call that can run is unchanged: same refresh, same clamp, same execution. That is the order the file already uses for skipped pipelines ("Skip before the argument clamp can mutate the indirect buffer"), extended to the much more common not-built-yet case. Dropping earlier is safe: the clamp is per call, and a later call that runs clamps its own range first. Not measured in the title - I cannot run it - but the work removed is one refresh and one dispatch per dropped call, and the diagnostics already separate "no host pipeline" from "prepare failed", so the next frame line shows the clamp dispatches behind those drops stop. cargo test --workspace --locked; both clippy configurations with -D warnings; cargo xtask policy.
Census: report directory traversal failures
…used-block XAsync: end the call that finished, not whatever call the block holds now
…d past the card's budget What was wrong: a host texture, once made, lived as long as its title texture; placed textures (made when shaders read them) for the whole run. The title views far more textures than one frame reads (8.4-8.9 GB of placed textures left null in run textures1), so making them as they are read only grows video memory until the card pages or the process runs out of commit (30.8-32.2 GB with the read marks alone). What changed: a title texture's host texture can be given up and made again on its next use (the owner is a resettable slot; host copies are returned owned). Host textures fed from title memory (no render target, depth or unordered access, nothing written by host copies) carry use stamps: a list of the title's naming them (tables, copies; our own upload lists do not stamp), and, at each pass, every read mark set since the last pass on a heap slot viewing them (the marks are then cleared; a slot's read is reported as new only once, so stamping on the first read alone gave up textures read every frame: run evict1 gave up and made again hundreds a frame). Once per presented frame, before a submission, those unused for 120 s and 300 presented frames are given up (shorter idle times gave up textures read again within a minute, runs evict2 to evict4), and past 90 % of the card's budget the least recently used others until 85 %. Giving one up first gives every heap slot viewing it a null view of its kind (retired until the running submission has run; the record stays noted, so heap syncs pass it by and a draw's or shader's read makes it again), then the title textures let go of it; lists recorded before hold it until they are reset, so no GPU work reads it freed. The next use makes it again from title memory (a fresh upload). Uploads of heap-viewed textures skip those not made. GPU-written textures are never given up; they go with their title texture. The cap on placed texture bytes is gone (the budget bounds video memory instead). Measured, 240 s of the intro cutscene each. With giving up (run evict2) against without (noevict1, the same tree with the pass off): card memory flat at 7.6-9.5 GB against 6.4 GB rising to 10.4 GB (86 % of the budget) at the end; host textures 6.1-7.8 GB against 5.2 GB rising to 8.6 GB; process commit 26.2 GB against 27.7 GB on average (29.7 GB and rising at the end). With the rest of its stack (run evict6) against main (perf13): median world frame 1,206 ms against 475 ms; frames uploading under 50 MB of textures 559 ms (+18 %, run evict4); a new shot's uploads cost 3-4 ms of frame per MB. Evidence: tests `host::tests::textures_read_every_frame_stay_and_title_lists_stamp_theirs`, `host::tests::heap_reads_since_the_last_pass_name_their_textures`, `draw::tests::a_texture_given_up_is_made_again_with_its_bytes_and_recorded_lists_keep_it`, `descriptor::host::tests::a_slot_viewing_a_texture_given_up_is_made_again_when_read`, `resource::tests::only_textures_fed_from_title_memory_are_given_up` and `resource::tests::idle_textures_go_and_past_the_budget_the_least_recently_used`; the crate's tests three times with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… read them lately What was wrong: at every submission (about 30 a frame), every texture any heap slot of a heap-indexing list viewed was brought up to date: its staging refreshed and, where its pages had changed, detiled and uploaded, read or not. With placed textures made when read (4-8k textures, 5-8 GB viewed by the heaps) that re-uploaded about 4 GB in 30-46 world frames and took 0.3-3.7 s a frame (runs evict2, noevict1; main 5-25 ms). What changed: a heap-viewed texture is brought up only if the title used it in this presented frame or the last (made then, named by one of its lists, or read through the heap as the eviction pass's stamps found). Textures lists read through tables keep their own rule (the list names them). Uploads of heap-viewed textures are counted with the others. shortcut: a texture read again after a gap is brought up after the submission that read it, which can see bytes one refresh old. Evidence: test `host::tests::heap_textures_unread_lately_are_not_brought_up` (a viewed texture whose pages changed is not uploaded while not read lately; stamped as read, it is); the crate's tests twice with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… lock What was wrong: after each submission, the views of heap slots shaders read for the first time (read marks) were made under `SHADER_HEAPS`, which every title thread writing a view takes: making a placed texture (its resource and host texture) took up to milliseconds each, and title threads waited 1-6 s a frame to write views (runs evict2, noevict1; main 0.2-0.3 s). What changed: the slots are looked up under the lock, the placed textures they view are made without it (they are never released, so they outlive it), and the lock is taken again only to make the views. Evidence: test `descriptor::host::tests::views_written_while_read_slots_get_their_textures_do_not_wait` (another thread writes a view while a read slot's texture is being made and finishes within a bounded wait); the crate's tests twice with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: every slot the title rewrote updated a map from each host texture to the slots viewing it (for giving textures up), searching the texture's whole list to take the slot out. A texture viewed in thousands of slots made each rewrite cost ~25 us; the title rewrites ~62,000 slots a frame (it copies per-draw descriptor tables into its heap), so heap syncs took 0.6-2.9 s a frame and held the heaps' lock that title threads writing views wait on (run evict3: 62,208 stale slots a frame at 25.7 us each, 16 us rising to 34 us as the lists grew). What changed: no map; giving textures up walks the heap's slots once per pass that gives any up. Evidence: tests `descriptor::host::tests::a_slot_viewing_a_texture_given_up_is_made_again_when_read` and the eviction tests; the crate's tests twice with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts pages What was wrong: textures the heaps view are refreshed at every submission where the title used them lately: 123,000 refreshes a frame (run evict3), each taking its tracker's lock to find, almost always, nothing changed. What changed: a refresh of a tracked texture first reads the tracker's dense clean bit, which needs no lock, and stops there if it is clean. Evidence: the upload tests (`draw::tests::a_texture_is_uploaded_once_per_submission_and_only_when_written`, `a_texture_owning_its_pages_is_uploaded_on_any_write`, `a_write_into_one_mip_uploads_that_mip_alone`); the crate's tests twice with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: making a heap slot's view held the heap's slot lock throughout, including making the texture it views (on first use) or the host copy of the buffer memory it views: title threads binding views for draws and writing views waited on that lock (119 of 307 samples of title threads in our code, run evict5). What changed: a slot whose view is unchanged is answered under the lock as before. One to make again releases the lock, makes what the view needs without it, takes it again and, if the slot still holds the record it prepared for, makes the view (cheap now); if the title wrote another record there meanwhile, that record is made instead. Evidence: tests `descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait` (a thread binds a view while another slot's texture is made, bounded wait) and `a_slot_rewritten_while_its_view_is_prepared_views_the_new_record` (the title writes another record into the slot during the prepare; the slot views the new record's texture); the crate's tests three times with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: at each submission the textures to bring up were read from title memory, detiled into staging buffers and copied one after the other on the submitting thread, while the heaps' view registry stayed locked: in a new shot that was about a third of the submitting thread (reading memory 19 %, making staging buffers 10 %, detiling 6 %, run evict5), frames grew 6-10 ms per MB uploaded, and title threads setting views waited on the lock throughout. What changed: what to bring up is collected under the heaps' locks, then refreshed without them on up to four threads (a quarter of the CPUs), those whose trackers are clean skipped, then recorded. Staging buffers come in powers of two (at least 64 KiB), so a buffer serves other sizes, and are made without the pool's lock. The tracker still decides the bytes: its pages are taken (and guarded) before they are read, so a title write during the read or detile marks them again and the next refresh brings them up (`watch::tests::writes_mark_every_tracker_of_their_page`). Evidence: tests `host::tests::heap_textures_brought_up_together_each_get_their_upload` (six textures refreshed side by side, each uploaded once, none again when unchanged) and the upload tests; the crate's tests three times with 8 threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…opies at once What lists using title memory write while the frame withholds stays in the host copies until the frame's end: through the page table, through root views (byte for byte) and through marked views. When a list of the submission read or wrote memory with no copy, those results are garbage computed from zeros (BVH builder nodes: +-inf bounds, 0xffffffff, rising u16 pairs), and later submissions of the same frame read them from the copies: in run shards20 the meshlet culling read such bytes in its per-batch meshlet buffers (stale copies with no title-side event after their take; 95.59 % of the batches walked equal to title memory). Now what such a submission withheld counts as changed in every buffer copy holding it right after it completes (`drop_withheld`, which takes the place of `drop_at_frame_end`), so the next submission's refresh takes it from title memory again. What submissions that missed nothing withheld keeps the frame-end retake. Run shards21 (2921092 + the page-table part alone + branch-only diagnostics, same listing as shards20): one list per world frame wrote through the page table, every one missed and was retaken at once (34-19,446 pages); stale copies written through the page table are gone, 98.12 % of 13,509 batches walked equal title memory. Every sampled stale batch left was last written through a declared, unmarked view with no retake after it (the builder's root UAVs, which the page-table path leaves to the byte-for-byte path), hence the root and marked views here too. Test: memory::tests::a_submission_that_missed_leaves_the_copies_at_once (a write through the page table beside a miss; fails before the change: the next submission reads the write instead of title memory's bytes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console rectangle list gives three corners per rectangle and the hardware adds the fourth opposite the right angle. The geometry shader that completes them on the host (and the CPU expansion used without it) took the right angle to be at v1, as the blits give it (top left, bottom left, bottom right). The tiled lighting's vertex shader (VS_TiledLighting, 3 vertices per tile: corner c = vertex % 3 at x + bit 1, y + bit 0) gives top left, bottom left, top right, the right angle at v0, so every lighting tile drew its upper-left half and the lower-right half of the tile above: tiles whose neighbour below was in another list lost their lower-right half and lit the one above, the right-triangle wedges along silhouettes and kerbs of runs shards22 (frames 1603, 1615, 1627; their depth is clean there). Now the right angle is the corner opposite the longest side (`emit::right_angle`, ties and NaN keep v1), the fourth corner is va + vb - vc and the second triangle (va, vb, v3), turning as the first for any three points; the CPU expansion takes the same rule from the first float element of two or more components. Tests: emit::rect::rule_tests::right_angles_are_found_in_any_order; emit::rect::tests::rectangles_get_their_fourth_corner draws the three orders (and three points on a line, which draw nothing) on hardware and WARP, and fails with the old rule; primitive::tests:: rectangles_complete_opposite_their_right_angle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: each texture brought up took a staging buffer of its own size class from a pool, and the pool's free buffers rarely fit a new shot's sizes: making upload buffers was 10 % of the submitting thread in a new shot (run evict5), one committed resource per texture. What changed: staging space up to 32 MiB is carved, front to back, from 32 MiB upload buffers, 512-byte aligned as texture copies need; the copies read their footprints at that offset. The chunks are rewound at each submission (the last one has run, as for the pool) and 16 are kept. Larger textures keep a buffer of their own from the pool. Evidence: test `draw::tests::textures_uploaded_together_each_read_their_own_bytes` (two textures brought up in one submission, the second at an offset in the same chunk, each read back with its own bytes) and the upload tests; the crate's tests twice with 8 threads (a timing test of frame waits, `frame::tests::waits_end_on_ticks_and_count_frames`, failed once while a title run loaded the machine, and passed in the other run). Measured together with the upload barrier batch (next commits' run shots2, 240 s of the intro cutscene, quiet): world frame median 964 ms (mean 1,038) against 1,169 ms with only the parallel creation (run shots1) and 1,206 ms before (run evict6); preparing 497 ms against 706; texture refreshes 264 ms for 135 MB a frame against 745 ms for 154 MB. The two were not measured apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: after a submission, the placed textures of heap slots its shaders read for the first time were made one after the other on the submitting thread, and `texture_at` held its map's lock while making each host texture: in a new shot, hundreds of committed textures, 7 % of the submitting thread (run evict5). What changed: `texture_at` makes the host texture after letting go of its map's lock, and the read slots' placed textures are made on up to four threads (a quarter of the CPUs), with the helper the texture refreshes use. Evidence: test `resource::tests::placed_textures_made_side_by_side_are_one_each` (four threads asking for four memories: one resource and one host texture each) and `descriptor::host::tests::views_written_while_read_slots_get_their_textures_do_not_wait`; the crate's tests twice with 8 threads. Measured alone (run shots1: main 8ff7913 and this commit, 240 s of the intro cutscene, quiet): world frame median 1,169 ms against 1,206 ms before (run evict6), preparing 706 ms against 709: a small gain; the staging chunks and the barrier batch carry the rest (run shots2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: the upload list a submission runs first recorded, for each texture it brought up, the copies and then that texture's barrier back to shader reads, so every barrier sat between one texture's copies and the next one's. In a new shot the list holds hundreds of textures (154 MB a frame in run shots1), and each barrier kept the GPU from overlapping the copies around it. What changed: record_upload returns the barrier instead of recording it, and the upload list records all of them in one call after the last copy. Evidence: textures_uploaded_together_each_read_their_own_bytes (two textures uploaded by one submission each read their own bytes) and the other upload tests pass. Measured together with the staging chunks (run shots2, 240 s of the intro cutscene, quiet): world frame median 964 ms against 1,169 ms without the two (run shots1); GPU 313 ms against 351. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir list misses A list in which a program using title memory read or wrote memory with no copy had every range its shaders declared withheld from title memory (and, since ec9e750, dropped from the host copies right after the submission), whichever program declared it. The BVH builder's list also holds ordinary programs (run light13, one list: ~1,000 builder dispatches beside billboard_nobump:CS_ComputeImposterTransform x250, CSGenerateHairVB/IB, bvh_skinning, CS_InstanceRotationFixup), so their output never reached title memory and, after the drop, never reached the frame's later draws either. Now each declared range records whether its program uses title memory (the draw or dispatch being bound, `HostList::writer_uses_memory`), and only those ranges are withheld when their list misses. Other programs write through bounded views from their own inputs: their ranges go back as before the withholding. An ordinary range overlapping a withheld range of the same copy is withheld with it, since its copy-back would take the other's bytes along. Test: host::withholding::only_programs_using_title_memory_are_withheld (a missing list with an ordinary write, a title-memory program's write and an overlapping ordinary write; fails with the whole list withheld). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssion What was wrong: `texture::host_written` marked a texture as written by the host (a copy, copy-region or resolve into it) when the list holding the copy was recorded, and textures read through tables were checked only then, by `texture::upload` at record time. A list recorded before the writer but submitted after it kept its upload due: its submission uploaded title memory over the texels the host copy had written. Submissions need not run in the order their lists were recorded (`light` is changing the order to the title's own waits between queues), so this decision belongs to the submission. What changed: `texture::host_writes(list, resource)` marks the texture from the submission that runs the writing list (a deferred host step), and the submission's upload gathering skips table-read textures so marked, as the heap path already did. A reader submitted before the writer still gets its upload; one submitted after keeps the host's texels. Evidence: test `draw::tests::a_list_run_after_a_host_write_keeps_the_host_texels` (a reader recorded, title memory written, a later-recorded writer submitted first, then the reader: the host's texels stay). Without the submission-time check it fails (the title's new bytes, 0.502, uploaded over 0.251). victory-gpu tests 179 passed; workspace clippy clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: every host texture was a committed resource, made one by one. A new shot brings hundreds of textures at once (the placed textures of slots shaders read for the first time, made after the submission), and making them took most of the copying-back phase: windows that made 337 / 134 / 110 MB of placed textures a frame spent 351 / 926 / 300 ms there (run shots2). Measured on the RX 6700 XT, 300 textures of a new shot's sizes (430 MB): committed 255 ms (not zeroed: 274 ms); one heap 32 ms, then placed 3 ms. What changed: textures without render-target, depth, unordered-access or simultaneous use, up to 16 MiB, are placed in 64 MiB heaps (default heaps for textures that are neither render targets nor depth), first fit, with castable formats through `CreatePlacedResource2` as the committed path uses `CreateCommittedResource3`; others stay committed, and so does a texture whose placement the host refuses. A texture's range is free again only once nothing else holds its resource (views' slots keep it until the running submission has run, lists until they are reset), checked at each placement and eviction pass; empty heaps past two are released. The eviction budget counts free heap space as unused. A texture whose memory is not committed when first read gets zeros, as a committed one starts (a placed one starts with what its range held); every other first refresh already uploads every subresource. The host-textures statistics line gives the heaps held and their used and free bytes. Evidence: tests `placement::tests::ranges_are_taken_first_fit_and_joined_when_given_back` and `a_range_is_reused_only_once_nothing_holds_its_texture`; the texture upload tests, whose textures are now placed, pass (victory-gpu 182 passed, twice). Run placed1 (240 s of the intro cutscene, quiet, on main with the narrower withholding of 0a5be3c and the host-write fix): making the read slots' textures 23 ms a frame (median 12; the largest new shots 406 / 568 / 871 slots in 107 / 68 / 43 ms), against up to 926 ms before; copying back 109 ms against 223 (run shots2); world frame median 894 ms against 964. The whole-frame gain shares its main with the withholding change; the read-slot part is placement's alone. No device removal, no stale texels seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: Wait32/64BitValueX were ignored and every submission ran
when the title made it. Grand Theft Auto VI's four compute queues start
each list with a wait for the frame's value of a word that a list on
another queue writes at its end (Write64BitValueBottomOfPipeX), and some
lists wait again after their first commands. Run light17's trace, one world
frame (F = the frame counter, all comparisons GREATER_EQUAL):
compute lists (kind 2), 22 queue submissions of one list each:
wait [0xd0417fe00 + 16k] >= F at the start, write [+8] = F at the end
(0xd0417fe00 .. 0xd04180070); the depth-processing list
[w fe10][HBO dispatch, barrier][write fe18 at its end][w fe68, fee8]...
graphics lists (kind 0) of 32-33-list submissions wait on words the
compute lists write (list 1 after 7-8 commands for [0xd0417ff80],
lists 3, 5, 7, ... at their start for [..ff90], [..ffa0], [..ffb0])
So CS_DepthProcessingHBO ran before the character G-buffer it reads, and
CS_MaterialTilesInitial classified the head and hair as sky: the white-grey
hair blob, faces dark or patched, the erased building bodies, the black
shards in the sky and part of the skin's leopard patches.
What changed: a wait recorded after commands cuts the title list into a
new host list (`list::wait`, `State::cut` replays the fixed-function state
and lets the next draw rebind the rest); each queue keeps a FIFO of list
segments, Signals and fence Waits (`hold.rs`). The pump runs a queue's
head once its waits hold, consecutive runnable segments as one host
submission (a piece, its own submission for refreshes, marks, withholding
and copy-back), and tests every queue again after each piece until none
can move. Order within a queue never changes, only the interleaving across
queues. A queue Signal behind held work is delivered after it (its fence
is kept alive meanwhile); CPU fence Signals, GetCompletedValue and
SetEventOnCompletion, PresentX, every submission and a 2 ms timer (values
the title writes from the CPU) pump. D3D12 lets a list be reset as soon as
it is submitted, which the title does up to 21 times a frame while its
work is held: the held part keeps its own host list, its title list's draw
state (dynamic descriptor slots, title-memory page table) and 0x4a0
memory, freed after it ran; host lists back from a queue are reused.
Counted shortcuts (`shortcut:`): a head held 10 s runs anyway (valve);
an unknown comparison holds; CopyPageMappingsBatchX and PresentX do not
wait behind held work. The frame line (when work waited or is held):
submissions, pieces, segments, cuts, early resets, segments that waited
and what released them, the pump's own time, the title's fence-event
waits, what is held at the present with the unmet waits.
Evidence: run light18 (240 s, survived): per world frame 16-42 title
submissions, pieces = submissions + 1, 188-266 segments, 0-11 cuts, 5-10
segments waited (55-1060 ms, every one released by a later submission);
held at the present 0, valve 0, unknown comparisons 0, page mappings with
work held 0. Hair whole against the sky, buildings whole, sky clean, skin
clean, every face present and lit (13 faces in 8 close shots; act3 2700,
without this, has a dark patch over the same woman's face). light19 (the
debug layer, 240 s; median per world frame 30 submissions, 31 pieces,
236 segments, 9 waited; pump 1.1 ms a frame; no fence event left
pending) and light20 (240 s, with the stale-upload fix now in main: 30,
31, 241, 9; pump 1.8 ms) survived; held at the present, valve, unknown
comparisons and page mappings with work held 0 in all three. The debug
layer's resource-state errors of light19 are on main alone too (light21,
same kinds and rate): not from the new order.
Tests: hold::tests (comparisons, a wait across queues, a wait that holds
defers nothing, chained waits across two queues, order kept, a Signal
after held work, a fence wait, work held at the frame's end, unknown
comparisons, the valve) and the GPU test
resource::tests::a_list_waiting_for_another_queues_write_reads_what_it_wrote
(a compute list cut at its wait and reset while held reads back the plain
texture the graphics list fills, as that list left it; on the old code it
reads zeros).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What was wrong: each refresh of a tracked texture read the changed title memory into a buffer allocated for it, the texture's whole size (5.6 MB for a BC7 2048), zero-filled and touched page by page: a zero-fill and a page fault per 4 KiB for every texture brought up (129,071 page faults while preparing in one frame of run placed1). The detile itself is not the cost: a BC7 2048 64KB_D texture detiles at 0.04 ms per MB on this machine, as fast as a plain copy of its bytes, against ~2.2 ms per MB for a whole refresh. What changed: the read goes into a buffer the worker thread keeps for its next refresh (up to 32 MiB; larger ones are not kept). Only the touched spans are written, and only they are hashed and detiled, as before. In diagnostics builds, the scan of each texture read for all zeros runs only when its debug message is wanted. Evidence: the texture upload tests, which refresh several textures and single mips on the same threads, pass (victory-gpu 193 passed, twice). Run scratch1 (240 s of the intro cutscene, quiet, on the same main as run placed1): texture refreshes 177 ms of worker time for 98 MB a frame (1.8 ms per MB) against 235 ms for 105 MB (2.2 ms per MB). Its whole frame was slower (median 1,010 ms against 894) through GPU time (mean 450 ms against 318) and after-work, which this change does not touch: one run each, run-to-run variance not separated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lowering leaves much in the DXIL that never runs or counts: branches on constants (lane conditions structurisation already knows, edges no lane takes) and the code only their other edge reaches, empty blocks that only forward to the next, size queries for descriptor words no path reads. The host driver compiles all of it. `indirect_diffuse_lighting:CS_ScreenProbes_ ActivateRays` (with nested descriptor joins, PR Marvisak#1012) is where it showed: 8,745 of its 10,040 conditional branches were on constants, 10,061 of its 22,384 blocks empty forwarders, about 70 % of its instructions reachable only through constant branches' dead edges, and 556 of the 587 size queries in the rest unread; the AMD driver never finished it (over 6 GB at 64 s). The writer (`Module::plan`, `Module::kept`) now: * takes a branch on a constant as a branch to its one target: blocks only the other edge reaches are not written, and phis lose the entries of edges that are gone (their other entries stay); * folds an empty block with one predecessor into it (the predecessor branches to its target), unless it splits a critical edge (lowering keeps loops' exits and preheaders dedicated, as DXC emits them) or its predecessor would then reach the target twice (one phi entry per predecessor); empty latches fold as before; * writes only instructions with effects (stores, atomics, calls neither read-none nor read-only: barriers, discard, wave operations, the write and read marks) and what they read, transitively (it dropped only unread phis before); * declares only the functions it calls and the constant globals it reads (the validator refuses the others); * and the shader flags of heap handles, wave operations and 64-bit integers follow what is written (`Module::uses`; the validator refuses a flag whose use is gone, "Flags must match usage"). Whole list (shaders.rpf, the exe, XboxBvhBuilder, the upscaler; translate --list --validate, against 8ff7913): 0 programs change outcome (14,254 VS/PS, 2,732 compute, 8,765 mesh emitted; 13,313 / 1,984 / 4,625 validated, as before); DXIL bitcode 1,423,424,800 -> 1,246,729,828 bytes (-12.4 %), blocks 3,624,448 -> 3,554,816 (-1.9 %). ActivateRays itself is still refused here (nested joins); its table is in the commit that lets it through. Tests (`emit::bitcode`): a constant branch drops its other side and that side's phi entry only; a loop whose back edge is never taken; empty blocks before a phi fold only where the entry can move; only values with effects or readers are written (read-none and read-only calls, stores, atomics, barriers); constant globals nothing reads are left out; uses count only what is written. The writer's pinned bytes are pinned anew (its test module's last call became one with effects). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The console compiler reloads a descriptor before each use rather than keep it (`indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays` loads table offset 0x640 2,399 times, once before each of its typed buffer loads), and lowering made a heap handle at each load: index arithmetic, for heap buffers the host-view guard, `createHandleFromHeap`, `annotateHandle`. A descriptor resource tracking finds at a fixed address (a table or heap entry, no dynamic term, not a waterfall loop's per-lane load) now gets one handle for the program, made in the entry block from the root parameter's user data. A descriptor chosen by control flow (a phi of heap indices at a join) gets one handle made in its join block, shared by every access the join dominates, instead of one per access. Read marks still go with each access, at the handle's index. ActivateRays (with nested joins allowed, the commit after this one): 2,608 heap handles before the DXIL writer's folding, 674 after it, 65 with this. Whole list, translate --list --validate: 0 newly failing; DXIL bitcode 1,246,729,828 -> 1,197,299,944 (-4.0 %) bytes. Tests: `descriptors_reloaded_from_a_root_table_share_one_handle` (a descriptor loaded in a branch and again after it: one handle), written heap handles counted from the module (`Module::written_calls`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since 4243a96 ("16-bit typed buffer accesses pass bits through integer views") a 16-bit typed buffer access reads its view's format kind from the host's view-stride table, root SRV `t255` (`VIEW_STRIDES`), also for views in tables. The differential harness asserted that a translated program's root views are only the case's own (slots 4 and 5), so the case "16-bit and 64-bit arithmetic" (`RWBuffer<half4>` stores through `buffer_store_format_d16`) failed on its root SRV 255 before anything ran, in every run with the console compiler since that commit (eed1670 passes, 4243a96 fails). `host::view_strides` builds the table as `victory_gpu` fills it for the harness's view heap (element sizes, the integer and signed bits of typed views of integer formats), and the harness binds it where a program asks. The case now runs and matches the console compiler's program on the RX 6700 XT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… flags Since the read marks, every vertex, geometry and mesh program that reads a texture from the resource heap writes the marks' UAV (the write marks do the same for programs writing through views), and its shader flags did not declare "UAVs at every stage" (ShaderFlags bit 16, SFI0 0x4): the validator refused 5,046 programs of the title's list with "Flags must match usage" (VS_OctaWindFire_e6901d4b: declared 0x40000010, actual 0x40010010). The runtime does not validate, so their pipelines were made, but a driver may trust the flags. The validator counts UAV ranges the module declares, not UAVs indexed from the heap: `finish` sets the flag (and the SFI0 bit) when a program that is neither a pixel nor a compute program declares any (root UAVs, the memory bitmap, the marks). Counting every handle annotated as a UAV instead set it wrongly for 26 mesh and vertex programs whose only UAVs come from the heap (`MST_DS_TerrainTransform` and others: declared 0x40092000, actual 0x40082000). Whole list (translate --list --validate), validated: vertex and pixel 13,313 -> 14,254 of 14,254, mesh 4,625 -> 8,694 of 8,765 (the other 71 have outputs over 32 KB), compute 1,984 of 2,732 unchanged (748 sample with implicit LOD); no program newly fails. Test: `emit::shader::tests::uavs_outside_pixel_and_compute_programs_are_declared` (a marked vertex, pixel and compute program and a vertex program writing a heap-indexed UAV each pass the validator; the marked vertex program fails as the list's did without the flag, the heap one with it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dges The console runs pixel programs in whole-quad mode: in every quad a triangle edge crosses, the pixels outside the triangle run as helpers, and the compiler takes derivatives of computed values (and quad reads) by reading the neighbour's register with DPP `quad_perm` or `ds_swizzle`. We lowered those reads to `WaveReadLaneAt` unless the program discards. Wave operations leave helper lanes out on the host, and on AMD a read of one gives 0: every pixel whose quad neighbour lies outside the triangle took a wrong derivative, along every triangle edge. WARP includes helpers in wave reads, so the tests passed there. Quad-local reads in pixel programs now always go through quad reads (`QuadReadLaneAt`), as they already did after a discard. What the host guarantees there: helper lanes execute the program so that derivatives can be taken, and quad operations include them (wave operations do not), so a quad read of a helper gives the value that helper computed, as the console's DPP read of a whole-quad-mode lane does. A discarded pixel stays a helper in the same way. Tests: two control-flow cases draw a triangle whose diagonal crosses quads (`ddx_fine`, `ddy_fine`, `QuadReadAcrossDiagonal`, `QuadReadLaneAt` of a computed value, console compiler against PC DXC). "derivatives and quad reads across a triangle edge": before, RX 6700 XT 24 of 256 texels differ (texel (0, 0): ddx -1 instead of 15, the helper read as 0), WARP 0; now 0 and 0. "discard, then derivatives and quad reads across a triangle edge" discards some neighbours before the reads (the path that used quad reads already): 0 and 0. Whole list (translate --list --validate): 3,005 pixel programs change, 84,589 read sites (median 15 per program, at most 732); no program changes outcome. DXIL 1,197,299,944 -> 1,203,716,752 bytes (+0.54 %) on top of the writer folding (on main without it: 1,423,424,800 -> 1,429,871,224), blocks unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the clamp's own buffer The debug layer reported ~16 resource-state errors a second in the world on main (run light21) and with the queue order (light19), four kinds: Depth twins, and 16-bit depth textures with twins (COPY_SOURCE, UNORDERED_ ACCESS and COMMON against DEPTH_WRITE): a list's prelude swapped each texture's real state for the one the list leaves before recording the twin copies it owed, so those copies moved the textures from the wrong states. The prelude now records the copies from the real states, then the list's moves from them, and only then stores the states the list leaves. The title's 174 MB GPU heap, bound as a vertex buffer while in UNORDERED_ ACCESS, and barriers on it disagreeing with the state an earlier vertex binding promoted it to: our only transitions on a title buffer's copy were the indirect clamp's, UAV to INDIRECT_ARGUMENT and back to UAV. The clamp now reads the title's records through a root view and writes the clamped ones into an argument buffer of the list's own, which the execution reads; only that buffer is transitioned (common, unordered access, indirect argument, common). Title buffers' copies are never transitioned: common between submissions, promoted by every use, ordered by unordered-access barriers (the shortcut is in indirect.rs). The clamp no longer writes the copy of the title's memory; the capture's read-back reads the clamped records from the list's buffer. Tests: a transition log (every barrier built on the test thread) replayed in GPU order by the debug layer's rule: twin::tests::prelude_copies_start_ from_the_real_states (fails on the old order: "before COPY_SOURCE, the resource is in COMMON", run light21's message) and indirect::tests:: argument_buffers_move_from_their_current_states (two lists in either order; the title's copy untouched); the clamp tests now also check the whole title copy is as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings back PR Marvisak#1012's recursive heap index (taken back by fbac5bb): a descriptor every lane shares, chosen by an if/else nested in another, reaches the outer join with an edge that is itself a join; its heap index is a phi at each join of what each predecessor computes at its end. It lets `indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays` (39f0e9aeb156a61c, issued every cutscene frame) through, whose host pipeline the AMD driver could not make before the two commits ahead of this one. The program itself is large: 74,700 GFX10 instructions, 11,896 branches (488 backward), 1,889 typed buffer loads, each after a reload of the same descriptor. Its DXIL, and what the AMD driver (RX 6700 XT, 32.0.21045) does with it: | | Marvisak#1012 alone | now | |---|---|---| | lines (dxc -dumpbin) | 151,610 | 24,896 | | branches (conditional) | 22,382 (10,040) | 3,070 (1,295) | | blocks | 22,384 | 3,072 | | heap handles | 2,608 | 65 | | size queries | 2,477 | 0 | | phis | 2,883 | 1,124 | | DXIL bytes | 864 K | 144 K | | validator | passes | passes | | host pipeline | over 6 GB at 64 s, never finished (26.7 GB unwatched) | 2.36-2.45 GB, 78-107 s (with other work on the machine) | What remains costly is the program's shape: one loop of 2,941 blocks holding 1,239 of its 1,295 conditional branches, an inner one of 1,440 (the largest loop of the largest program by DXIL bytes, RTShadowTrace32TemporalHQ_OneOver4RPP_Tiled, has 110 blocks; it compiles in 14 s, 353 MB). Making every branch uniform (an experiment) took the compile to 1.9 GB and 54 s, so divergence is not most of it. The pipeline library keeps it after the first make. WARP refuses the pipeline at once (E_INVALIDARG): the program declares the console's wave size (32), which WARP's 4-lane waves cannot run, as for every compute program that declares one. Whole list, translate --list --validate: 0 newly failing, 1 newly emitted and validated (this program). Test: the nested-join lowering test is back (`descriptors_joined_by_nested_control_flow_lower_to_one_uniform_handle`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otient What was wrong: buffer and typed-buffer loads of normalized formats (UNORM, SNORM) converted a code by dividing it on the host. The host's division is not exact. On the RX 6700 XT, 125 of the 256 8-bit codes loaded one ulp high, and 16-bit codes such as 257, 261, ..., 32896 loaded one ulp low; WARP was exact. The console's buffer unit gives the float nearest the exact quotient, and titles rely on it in decisions: Grand Theft Auto VI's mesh programs read a material index from a vertex colour's alpha as `v_mul_legacy_f32 255.0` then `v_cvt_u32_f32`. A quotient one ulp low truncates to the code below (the 16-bit codes above did), so another material is picked. What changed: for formats up to 16 bits per channel the quotient a / (2^n - 1) is worked out from integers: Q = floor(a * 2^32 / d) as a * K plus a correction (none when n divides 32), rounded to 24 bits up exactly when its highest dropped bit is set (the quotient is never exact, so never a tie), and that integer, at most 2^24 and so exact as a float on any host, scaled by a power of two. The reference is the exact quotient rounded to the nearest float, which removes the dependence on how the host rounds a division or converts a large integer (WARP rounds integers above 2^31 otherwise). Signed formats convert their magnitude the same way; their two lowest codes stay -1.0. The 11- and 12-bit widths, whose smallest codes need more bits, are rounded fully in integers. Cost: about 18-21 DXIL operations a channel where the division was 2 (a division by a constant more where n does not divide 32), so a 4-channel 8-bit fetch is about 80 operations instead of about 12. The car body's mesh program grows from 4,616 to 5,103 instructions (+487 for about 23 normalized channels). In the title it is not measurable: in a run of the intro cutscene with this commit (cost2, on the previous main 4015a18), on world windows with no pipelines being made, the frame median was 881 ms and the GPU 349 ms a frame (median 335), against 1,013 and 389 (365) for the same tree without it (s1a). Two runs of one tree have differed by 132 ms of GPU a frame, so the difference is within run-to-run noise. Evidence: tests `normalized_buffer_formats_load_correctly_rounded_quotients` (every 8- and 10-bit code and a 16-bit sample, unsigned and signed, bit-exact on hardware and WARP; it failed on the RX 6700 XT before, at 8-bit code 3) and `normalized_codes_truncate_back_to_themselves` (the title's truncation gives every code back; 16-bit code 257 came back as 256 before). Offline, the integer arithmetic as emitted matches the exact quotient for every code of every width 2 to 16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VlREX
force-pushed
the
fix/descriptor-address-publication
branch
from
November 25, 2026 14:51
4b64506 to
9c827c0
Compare
A new committed resource is not always zeroed: on the CI's WARP the 512 KiB mark buffer of heap_direct_texture_reads_mark_their_heap_index came back holding the page table an earlier test had uploaded and freed, so the test saw 16,389 bits besides the one the shader set. Buffers, root UAVs and UAV textures are now made as copy destinations and get zeros from an upload buffer before the dispatch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The title now plays the intro cutscene and reaches the prologue with the graphics fully displayed. Splits the two in the stage table, updates the subsystem rows, the memory requirements and the pipeline pre-build timing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
VlREX
force-pushed
the
fix/descriptor-address-publication
branch
from
November 25, 2026 18:26
9c827c0 to
a272c66
Compare
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.
Problem
HostHeap::view_addressesfills its lazy address table under themademutex, but releases that mutex beforeOnceLock::get_or_initpublishes the table. A concurrentmirrormay update a descriptor after the snapshot is taken, see an uninitializedaddressescell and skip the address update. The published table then contains stale buffer address data.Fix
Keep the same writer mutex held through OnceLock publication, with a lock-free fast path after initialization. No changes to heap caps, remapping, shader code or GPU synchronization. This is an independent CPU-side race fix, also present in Marvisak#1779; it is not a claimed fix for Marvisak#1808.
Validation
Two CPU-only Rust regression tests are included. A separate exhaustive JavaScript model of one initializer and one descriptor writer found stale state in 2 of 5 legal old interleavings and 0 of 2 legal new interleavings. Native Rust tests and GPU validation not run here (no Rust toolchain); no real game data. AI-assisted (ChatGPT).