Repository navigation
Conversation
|
Review (head b9deb01, diff read, not a merge-check):
Fine: AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
Port the fast region-skipping non-zero scan from xcl-dev#3679 (iggyvilla) to main's map_levels_with_texels_in path: - Add range_any_nonzero_with_skip (title_textures.rs) and PageMap::any_nonzero_with_skip (texture_upload.rs), probing 4 KiB first so populated mips short-circuit immediately, scanning remaining committed spans in 64 KiB TLS chunks without multi-MB per-slice copies or Vec allocations, skipping unmapped PageMap pages and uncommitted/guard VirtualQuery regions in one step, and caching the last unreadable region across mips/slices. - Wire 2D and 2D-array lazy-level textures through levels_with_texels_2d in map_levels_with_texels_in (confirming non-full-block/odd levels and packed mip tails via Chain::level_has_nonzero so padding-only bytes match exact texel presence). Credit: ported from xcl-dev#3679 by iggyvilla. AI-assisted: Antigravity (Gemini 4 Neon)
level_scan(t ≈ 90..94 s, ~3,000 calls)701.0 ms(254.5 µs/call)134.9 ms(38.8 µs/call, 6.6× faster)level_scan(t ≈ 96..98 s, ~1,700 calls)404.4 ms(217.1 µs/call)43.8 ms(26.1 µs/call, 8.3× faster)level_scan(t ≈ 21..33 s, ~384 calls)2.3–3.3 ms(~7.8 µs/call)0.6–0.8 ms(~1.8 µs/call, 4.3× faster)submit cost(textures, 1024-submit avg)6.57 ms(textures 4.07 ms)4.97 ms(-24.4%,textures 2.69 ms-33.9%)What is in it
#3444'smainmerge ontoamd-dev: brings backlevel_upload,levels_with_texels_where,level_ranges,split_ranges(crates/xcl/src/hle/d3d12x/title_textures.rs) andtexture_upload::unknown_parts(crates/xcl/src/hle/d3d12x/texture_upload.rs). Because8ea8524fre-enabledvram::level_pagesby default right after#3444,amd-dev(41aa60ce) was falling back tomap_levels_with_texels_inon every lazy-level upload — reading and scanning the full multi-MB texture on every partial update, forcingchanged = Nonewhole-texture re-uploads whenever any level mapped, and inflatingbatch_fitsbyte estimates with unmapped top mips. Restoringlevel_uploadbeforebatch_fitsskips empty textures, cuts uploads to mapped levels, tracks per-range unknown hashes (unknown_parts), and packs batches by actual mapped-level bytes.range_any_nonzero_with_skip+PageMap::any_nonzero_with_skip):range_any_nonzero_with_skipuses a zero-copyall_zerofast path whenin_committed_window || sparse::known_readable, probes4 KiBfirst (then64 KiBchunks) onReadProcessMemoryso populated mip levels short-circuit after 4 KiB, and on any uncommitted/no-access/guard page jumps across the entire unreadableVirtualQueryregion in one call while caching(reg_lo, reg_hi)across mip levels of the same texture.PageMap::any_nonzero_with_skipcoalesces contiguous unmapped-mirror fallback runs (p & 1 != 0) into a singlerange_any_nonzero_with_skipcall instead of callingcopy_readable+VirtualQueryonce per 64 KiB page (which accounted for 92% oflevel_scantime on streamed textures in GPU mirror views), and probes4 KiBfirst on mapped physical pages (p & 1 == 0).map_levels_with_texels_indelegates 2D single-slice textures tolevels_with_texels_whereso the non-by_levelfallback benefits from the same fast scan.unknown_parts_clears_only_requested_pages,page_map_any_nonzero_coalesces_fallback_runs_and_skips_uncommitted,range_any_nonzero_skips_uncommitted_reserve_and_guard_pages, andsplit_ranges_partitions_inside_and_outside_cleanly.Tested
32.0.21045.29003), AMD Ryzen 7 5700X, Windows 11 x64,rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke.texture_upload::tests::,range_any_nonzero_skips,split_ranges_partitions): 16 passed, 0 failed.cargo test --workspace --no-fail-fast -- --test-threads=4: 2,962 passed, 13 pre-existing failed, 49 ignored (identical pre-existing failures to cleanorigin/amd-dev41aa60ce).T6-PROFsub-timers):level_scandropped 6.6×–8.3× (701.0 ms -> 134.9 ms,404.4 ms -> 43.8 ms), cutting average world-loadsubmit costfrom6.57 msto4.97 ms(-24.4%) andtexturesfrom4.07 msto2.69 ms(-33.9%).Regression run
Base (
main, required bypr_check.py):Base (
origin/amd-devmerge base):PR head (
b9deb01d):Not tested
AI use
#3444merge drop oflevel_upload, profiledPageMap::any_nonzeroandrange_any_nonzeroon the retail workload, implemented the coalesced region-skipping non-zero scan and unit tests, ran the workspace GPU suite and 60 s smoke, and drafted this PR description.