Repository navigation
Conversation
Use the placement index to select uploads when a submit dirties a few pages. Check remapped CPU sources separately and preserve resource order. First uploads and dense writes still use the full scan. Co-Authored-By: GPT 6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rerun on the new head
The first run, on NVIDIA run, since Not tested lists NVIDIA. This machine has the D3D12 debug layer installed, so the two tests that were SKIPPED in your run ran here. Tested
Not tested
AI use
|
There was a problem hiding this comment.
Review of 3d5e3b1 against its merge base 384f7f7, by reading the code; nothing was built or run here, and no script of my own was run (only git and read-only gh). I looked for a texture that is written but no longer found, and did not find one: on the sparse path the seek through by_va selects the same textures, in the same order, as the full scan. The points below are a test gap, a note on #1102 and two notes on what the description already says.
What I traced for the "no missed upload" conclusion, all in crates/xcl/src/hle/d3d12x/title_textures.rs:
- Textures spanning pages. A texture that starts before a dirty run and reaches into it is found by the look-back at
:163-165. That is enough because active ranges with a different(va, end)are disjoint:insertshadows every active overlap except an exact-range unplaced alias (:269-285), andremovebrings a shadowed texture back only when nothing active overlaps it (:329). Aliases share the start, so the range from(start, 0)at:166takes all of them. A texture starting inside a run has its first page in the run (runs are contiguous,:158). One crossing two runs is found twice and deduplicated (:178-179). - Sources that differ from the placement.
srcis set in two places only: at registration (:436, classified ininsert_active,:116-118) and inrecheck_source(:528), whose only caller in the runtime updatesremappedfor active textures (:499-507). A shadowed texture whose source changed is classified again when it comes back, throughinsert_active(:344). Remapped textures are skipped in the seek (:171) and tested onsrcitself (:176). - Added, removed, moved between submits.
by_res.insert/by_res.removenow exist only insideinsert_active/remove_active(:114-127), soby_res,by_vaandremappedcannot disagree, and theunwrapat:136and the index at:176hold. The selection runs under theTEXTURESlock, as before. - Sparse / dense threshold. Both paths give the same set, so the thresholds (
:154,:168) only choose the cost. Under 16 texturescount / 16is 0 and any written page takes the full scan. - Pending uploads. The sparse path ignores
e.pending, which is only right ifPENDING == 0means no active texture is pending. I followed every change of the counter (insert,remove,retire_range,recheck_source, the upload closure at:841-844): it can end up too high (point 3), never too low, and it is read under the lock at:840. - Upload order.
candidates.sort_unstable()(:178) givesby_reskey order, the order of the old iterator.
-
CONFIRMED (test gap, not a defect): no test reaches the new
remappedbookkeeping inrecheck_gpu_view_sources(:498-508).dirty_texture_candidates_match_the_full_scan(:1643-1681) changes sources only throughinsert/remove. The two tests that change a source through the mirrors aregpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes(:1295), which registers one texture, socount / 16is 0 and every look is a full scan, anda_lazily_mapped_page_in_a_gpu_view_is_its_own_source(:1433), which callsrecheck_sourceon a looseEntry. Scenario the suite would not catch: lines:501-505are dropped or mis-merged; a texture in a GPU view whose page is unmapped goes fromsrc == vato the CPU view but stays out ofremapped; after its one pending upload, later sparse submits seek byva, the title's writes land atsrc, and the texture is never uploaded again. Suggestion: a test with 16 or more entries where one source flips each way, comparingcollect_uploadswithlinear_upload_keysafter each flip. Moving the three-line update into a smallTablemethod would let it run without a GPU. -
#1102 changes the same code. #1102 (open, draft, stacked on #1055) is not in the description's overlap list. It replaces
src: usizewith aSourceenum, rewrites the same loop inrecheck_gpu_view_sourcesand adds a second path there throught.get_mut(res), soremappedhas to be kept right on that path too when the two meet. -
CONFIRMED (already in the description's Not tested; credit to the author):
PENDINGcan stay above zero for the rest of the run, and then this PR never takes the sparse path again. A shadowed texture whose source changes getspending = trueandPENDING + 1(:509-510,:529-531). If it is released while shadowed,removereturns a delta of 0 (:310-315); if it comes back,:341-343counts it a second time and its upload takes only one off. This ismain's behaviour and the safe direction (full scan). -
Note on the numbers (as the author says; figures here are arithmetic on the description's tables, not measurements of mine). The pasted pair meets the rule: 977 / 1036 frames is 94.3 %, 15513 / 15113 MB is 102.6 %. Pair 3 (787 / 986) is 79.8 %, and the PR's median over the five pairs (991) is 4.3 % under
main's (1036). I found nothing in the code that would cost frames: the sparse path does at mostcount / 16seeks,count / 8index steps andcount / 4binary searches under a lock that was already held. fromthemoonx's report on this head (738 passed, 0 failed on an RTX 3060, and 742 / 0 merged onto47efa2e) covers NVIDIA and the two tests skipped on the author's machine.
Against CONTRIBUTING: the sections are all there (Tested with counts, Regression run with both blocks, Not tested, AI use with exact models), one commit, one file, 224 + 37 lines. The description's claims ("pending first uploads and dense writes keep the full scan", "upload order is unchanged") match the code.
Verdict: no defect found; correct as far as reading can tell. Before merging I would ask for the test of point 1, and for remapped to be kept right where #1102 meets this.
Review by Claude Code (written by Claude Fable 5.2, checked with Claude Opus 5.5); each point checked by a person before posting.
Review of xcl-dev#1086: nothing reached the `remapped` update in recheck_gpu_view_sources, which needs a GPU. The update moves into Table::recheck_sources (same loop, same order, shadowed textures too), and a test with 26 textures flips one source each way (and one back) and compares collect_uploads with linear_upload_keys after every flip. Without the update the test fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thank you for the careful review. I checked each point against the code. Pushed
Tested: AI-assisted: this follow-up was written and tested by Claude Code with Claude Sonnet 5.5. |
|
Follow-up at
Reply by Claude Code (Claude Opus 5.5); checked by a person before posting. |
|
A regression run under Wine on Linux, on a retail title. Tested
Regression run main (first run): this PR: The last Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
RX 7800 XT (RDNA3, wave32/wave64) report on exact head Tested
Not tested
AI use
|
Each submit that finds written pages checked every tracked title texture against the list of written pages, even when only a few pages were written. A sparse submit now seeks the overlapping textures through the existing
by_vaplacement index. Textures whose CPU source differs from their placement are kept in a small set and checked separately. Pending first uploads and dense writes keep the full scan, and the resulting upload order is unchanged.Related to #582, but it does not change
GetWriteWatch, which that issue measured as 99.7 % of a look. This is a saving of microseconds per submit in the selection step, not an expected frame-rate gain.What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs: indexed selection of upload candidates;insert_active/remove_activekeep the remapped set in step with the placement index; a test against the full scan (aliases, remapped sources, shadowed and restored placements, GPU-written and pending textures, dense writes); a manual release benchmark (#[ignore]).7d92772), same file: theremappedupdate ofrecheck_gpu_view_sourcesis nowTable::recheck_sources, so it runs without a GPU.a_source_that_flips_keeps_the_sparse_selection_exacthas 26 textures, flips one source each way (and back) and comparescollect_uploadswithlinear_upload_keysafter every flip.Tested
xclbuilds.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output: 735 passed, 3 failed, 42 ignored on this head; 734 passed, 3 failed, 41 ignored onmain384f7f7. The same three fail in both:placed_title_textures_share_vram_and_preserve_pixels(3D texture, subresource 2 mismatch), andtransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memoryon the lock it poisons.test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state.cargo clippy -p xcl --lib --tests(before the rebase, same patch): no warnings on the changed lines.7d92772:cargo test -p xcl --lib d3d12x::title_textures -- --test-threads=4: 14 passed, 1 failed, 1 ignored (the benchmark). The failure isplaced_title_textures_share_vram_and_preserve_pixels(3D texture, subresource 2 mismatch), which fails the same way on3d5e3b1(13 passed, 1 failed, 1 ignored). With theremappedupdate removed fromrecheck_sources, the new test fails.cargo clippy -p xcl --lib --tests: no warning on the changed lines. Same machine as above; the whole workspace was not run again for this commit.cargo test --release -p xcl --lib bench_dirty_texture_candidates -- --ignored --nocapture, median of seven rounds, synthetic textures, µs per submit for the selection alone:The ratio varies by run: two earlier runs of the 4096 / 4 row measured 72x and 90x.
Regression run
On the head
7d92772and on its merge base with main,384f7f7: one release build and one run each, from clean trees at those commits, the same title and 45 s. Other builds and tests ran on the PC during both runs, so the frame counts are not a timing comparison. Head: 1048 frames, main: 962; peak commit 15136 MB against 15133 MB; no device removal and no crash.main:
PR:
Earlier runs, on
3d5e3b1(before the review follow-up). The first pair, main then PR. The title line is the folder name, replaced with a neutral label; everything else is assmoke.ps1printed it.main:
PR:
All five pairs of those two builds, frames shown (no crash and no device removal in any):
Other builds ran on the PC during several of these, and I found no mechanism for a slowdown, but the PR's median is 4 % lower and its third run is below 80 % of main's, so a small cost is not ruled out. Runs 1 and 2 of the PR and run 3 of main peaked at about 15.5 GB, the others at about 15.1 GB. A run on a quiet PC is welcome.
Not tested
PENDINGand nothing takes that count back (existing behaviour, read in the code, not reproduced). Where that happensPENDINGstays above zero and every look uses the full scan, as before.recheck_gpu_view_sources(aSourceenum in place ofsrc) and adds a second path there throught.get_mut(res), soremappedhas to be kept right on that path too when the two meet. D3D12.X: render targets on one physical page share its video memory #1182 (open) touches this file only in the tests module (one new GPU test), plusvram.rsandkernelx.rs; it does not change the code here.AI use
Table::recheck_sourcesand its test) and updated this description for it.