Repository navigation
GPU: track each write range once per submission - #440
tcurtsinger wants to merge 1 commit into
Conversation
|
Overlaps with #435: both deduplicate Both were verified separately on Arch Linux x86_64, Windows MSVC release build under Wine 11.22 (
This PR keeps the first-declaration copy-back order and tests it; #435 keeps the set inside |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 0ba3e44 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).
The change looks correct. Declarations are deduplicated per (shadow, address, len). Copy-back keeps first-declaration order, and the membership set is dropped before the GPU wait.
This overlaps almost line for line with #435 (melon0918, "coalesce identical write declarations within a submission"), which I also reviewed. The two cannot both merge, since they rewrite the same hunk of run_deferred and copy-back. The one real difference:
By my reading of Shadow::writing both are equivalent. A repeat never retakes the snapshot, and refreshes queued between two declarations are flushed by the next title_written() or the final batch flush before the lists run. #440's form is the more conservative of the two. It would be good for the maintainers to pick one and close the other. #440 also brings the submission_tests.rs harness, which #435 lacks.
I have not merged this into our fork, because it conflicts with #435, which is already merged there.
AI-assisted (Claude Code).
|
Thanks for testing both PRs. I ran the same ordering test on both heads with Windows D3D12 WARP. A refresh queued between two identical write declarations is visible to a host callback immediately after the repeat in #440. On #435 the callback ran before the refresh and saw the old byte.
The callback is synthetic. Gameplay impact remains unmeasured. Either implementation can preserve the existing ordering by flushing before the duplicate check. I’d keep the regression in whichever PR lands. Test source
AI-assisted testing. |
|
Test report on a 6 GB / 16 GB laptop: on top of #393 this PR gives a further small gain (3,347 → 3,221 ms per world frame, copies 100 → 67 ms). That's within this machine's run-to-run spread (about ±10%), so it's not a clear effect. Setup: RTX 3050 6 GB Laptop (NVIDIA, driver 32.0.16.2124), i7-13700H, 16 GB RAM, Windows 11 26300, diag build. Title 1.0.2.1, Series X profile, the story load. Base tree:
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine and drafted this report; results are from the runs described. |
texture_at inserted failed host creations into PLACED_TEXTURES, so a later lookup returned Some with host == None. Release the resource and return None instead (VIC-BT-027 / Marvisak#440). Refs Marvisak#440. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…iled-host-440-111a GPU: do not cache placed textures without a host copy (Marvisak#440)
v_cvt_f16_f32 / v_cvt_f32_f16 already go through valu16 (abs/neg/clamp); remove the unreachable opsel==0 arms (VIC-BT-028). image_get_resinfo returns 0 for unused size channels instead of 1 (VIC-BT-038 / Marvisak#440). Refs Marvisak#440. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…ily-440-111a HLE: report analytics family as Windows.Xbox (Marvisak#440)
…arvisak#440 resource::track visited blocks in index order, so after split_irreducible appended copies a descriptor access could run before its dominating s_load was recorded in out.scalar and miss the waterfall offset load. Collect every scalar address first, then resolve descriptors in reverse postorder. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…-440-111a Shaders: track scalar addresses in RPO before waterfall lookup (Marvisak#440)
… Refs Marvisak#440 Hardware masks base, soffset, and imm_offset with & ~3 independently before summing; adding first then truncating shifts the load when low bits of two terms carry into bit 2. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…naligned-440-111a Shaders: dword-truncate each s_buffer_load address term before adding (Marvisak#440)
RDNA flushes f32 subnormals on v_mad_f32 / v_mac_f32 (inputs, product, sum, and after omod) regardless of MODE.denorm32. Without that, mul:2 of a flushed-to-zero mad sum could yield FLT_MIN instead of +0. Refs Marvisak#440. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…lush-440-111a Shaders: flush subnormals around v_mad_f32 / v_mac_f32 omod (Marvisak#440)
Unfused mad/mac must round a×b to binary16 before adding the accumulator; conflating them with fused v_fma_f16 / v_fmac_f16 made 256h×256h+(-65504h) yield 32h instead of +inf (VIC-BT-042). Refs Marvisak#440 Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…40-111a Shaders: round v_mad_f16 / v_mac_f16 product to f16 before add (Marvisak#440)
…pages-440-111a xmem: recycle freed physical page numbers under churn (Marvisak#440)
…tname-440-111a HLE: allow local gethostname through offline resolvable() (Marvisak#440)
…gister-440-111a HLE: lock XPackageUnregisterInstallationProgressChanged to bool unregister (Marvisak#440)
…-440-111a Shaders: keep SCC uniform for two-mask s_cmp_eq/lg (Marvisak#440)
Unreachable CFG predecessors left empty outs during rename, so phi.args got NONE (Value(u32::MAX)) and remove_trivial_phis panicked in release. Prune blocks unreachable from entry (and re-prune in rename if needed) so SSA never sees those edges. Refs Marvisak#438 Marvisak#440 (VIC-BT-002). Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…chable-preds-111a Shaders: prune unreachable blocks before SSA renaming (Marvisak#440)
…pipeline-111a GPU: bind CreateCommandList pInitialState like Reset (Marvisak#440)
…ull-result-111a HLE: document and harden getaddrinfo null-on-failure tests (Marvisak#440)
…uns-111a GPU: split execute batches when the same HostList repeats (Marvisak#440)
…ar-rt-ds-440-111a GPU: drop optimized clear values without RT or DS flags (Marvisak#440)
…-dsv-dim-111a GPU: synthesize NULL-desc RTV/DSV dimensions from the resource shape (Marvisak#440)
…-null-desc-111a GPU: resolve null/UNKNOWN views on typeless-promoted textures (Marvisak#440)
…i16-440-111a Shaders: decode inline floats as f32 bits for 16-bit integer ops (Marvisak#440)
When LaneExit::Branch has taken == not_taken, calling edge() twice overwrote the first critical-edge block under the same (from, to) key and left fill_phis missing a CondBr predecessor. Treat that case as an unconditional jump (VIC-BT-007 / Marvisak#438/Marvisak#440). Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…edge-map-440-111a Shaders: collapse Branch with identical arms before critical-edge map (Marvisak#440)
…er-cmp-slots-111a Shaders: distinct static slots for comparison vs plain immediate samplers (Marvisak#440)
…r-high-half-111a Shaders: keep d16 format-load high halves and saturate integer channels (Marvisak#440)
…unknown-440-111a HLE: GameInput QueryInterface accepts IUnknown and own IIDs (Marvisak#440)
…-440-111a GPU: clarify null CreateConstantBufferView always writes a null CBV (Marvisak#440)
…are-440-111a GPU: bind descriptor heaps by creation id to avoid ABA reuse (Marvisak#440)
…d-d16-440-111a Shaders: keep image_load d16 high half and saturate integer texels (Marvisak#440)
Change
Each submission prepares every declared GPU write and then, after the fence, walks all deferred commands again to find the distinct ranges to copy back. Repeating a declaration also grows the shadow's pending list, which later refreshes search.
Record each exact (shadow identity, address, length) on its first declaration. Flush preceding refreshes at every declaration, including repeats. Keep the first-declaration order for copy-back so distinct views that overlap title memory finish in the same order as before. The membership set is released before the GPU wait.
Synthetic measurements
Windows D3D12 WARP, optimized diagnostics build, base
d2a4bae. Each range is 512 bytes. Each sample submits closed command lists with deferred refreshes and GPU-write declarations and checks the resulting title bytes. Values are median microseconds per submission across eight fresh processes per revision in counterbalanced order. Each process ran three warm-up batches and nine measured batches of eight submissions.The 128-distinct control took about 1% longer end to end. The two repeated-range cases improved. The frequency of repeated write declarations in a native world frame and the effect on FPS remain unmeasured.
Verification
Related to #400. AI-assisted implementation and testing.