D3D12.X: a look finds the blocks new to the watched ranges by their change #3477
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3477"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T23:37:12Z.
Port of raylitebull's amd-dev commit
5ff2b663. To find blocks newly added to the watched ranges,hot_runsrebuilt a set of every 2 MiB block of every range each time the ranges changed, while holdingHOT, which the walk thread also takes. A retail title's world has about 1,800 such blocks.new_blocksnow compares the sorted ranges with the last look's:The result is the set's, but only changed ranges are walked.
What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs:new_blocks,hot_runsusing it (theknownset goes), and the testnew_blocks_are_those_no_old_range_meets. The test checks against a set of all old blocks for ranges grown, shifted, merged, new, gone, and in part of a block.HOT_NEW,look_stats::HOT_WHY), which main does not have. A new block is put in with its time only, as before.Review:
new_blocksrelies on the ranges being sorted and apart.watch_rangesmakes them so, andhot_runsalready relied on that. If two ranges ever overlapped, the error could only go one way: extra blocks marked hot, never a missed one.Tested
cargo test -p xcl --lib hle::d3d12x::title_textures: 66 passed, 0 failed, 1 ignoredcargo test --workspace --no-fail-fast -- --test-threads=4ond8c75c5c, rebased on main86e86fcb(5070 Ti): 2890 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost allno wave64(the others: no D3D12 debug layer, heap windows off, driver cache needs Developer Mode). The narrower runs listed here are from before the rebase.Regression run
main:
this PR:
Not tested
AI use
5ff2b663.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T17:36:41Z.
merge-check
base:
6bfb5c5153head:
d8c75c5c13merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2905 passed, 0 failed, 51 ignored (base: 2904 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none
review: read the whole diff (
title_textures.rs, +93 -15). No correctness problem found.new_blocksgives the oldknown-set result:partition_pointona + n <= loand thebinary_searchskip of unchanged ranges both rely on the ranges being sorted and apart.watch_rangesmakes them so (the description says this too).h.rangesbecomes the last look's ranges, asknowndid.new_blocks_are_those_no_old_range_meets: 3 of 3 runs passed. Its timing line: 6.6-8.5 µs a call against 1.34-1.39 ms for the set of all blocks (16 ranges, one changed).metcomparinga <= hi(a range that starts right at the block's end counts as meeting it) fails the test. Good.old.iter().any(|&(a, _)| a == base)) fails the test. Good.new_blocksagainst the old algorithm.hot_runsitself is reached only through the runtime path, which this machine has no title for.performance: not measured on a title. The unit test's timing above shows the per-change cost going from milliseconds to microseconds while
HOTis held.verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T01:22:59Z.
merge-check claim
head:
d8c75c5c13Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T01:33:30Z.
merge-check
base:
1c8b551475head:
d8c75c5c13merge: clean (merged tree 8363e23e,
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2910 passed, 0 failed, 51 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same set as on the base; failing: none. Base alone, same machine: 2909 passed, 0 failed, 51 ignored. The new test
new_blocks_are_those_no_old_range_meetspasses.review: whole diff read (one file, title_textures.rs, +93/-15). No finding.
new_blocksgives what the removedknownset gave: a block was in the set exactly when a range of the last look touched it, andmetasks that of the sorted, disjoint old ranges by a partition point; a range found unchanged in the old list is skipped, which is right because all its blocks were touched by itself. Both lookups need the ranges sorted by start and apart, which the description sayswatch_rangesguarantees; the test compares against the set form for grown, shifted, merged, new, gone and partial-block ranges. The first look (no old ranges) makes every block hot, as before. The test prints a timing line and asserts nothing about it.performance: 60 s smoke of the same title, release, default settings, same machine, one run each. Base
1c8b5514: 1608 frames shown, presents per 2 s (last 3) 60 60 61, 0 device removals, 0 crashes, peak commit 19911 MB. Merge result (local merge commit): 1681 frames shown, 60 60 60, 0 device removals, 0 crashes, peak commit 19839 MB. No difference outside the spread; the start and menu phase has few watched blocks, so the saving underHOTin a world is not shown here. By default it does less work than main whenever the ranges change, reasoned.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3080 10 GB (driver 621.40), AMD Ryzen 9 7950X, Windows 11 Pro 26200, rustc 1.100.0, debug suite and release smoke / Claude Code with Claude Fable 5.2. Run and posted without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:13:09Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.