Repository navigation
Conversation
`title_textures::cached_watch_ranges` makes the watched ranges again
whenever any part of its key moved (the textures' 16 MiB blocks, the
graphics reservations, the shown pages, the mapped tiles), and each time
it asked `sparse::mapped_ranges`, which takes `sparse::STATE`. In a
retail title's world (RX 9070 XT, XCL_LOOK_STATS=2) a submit's "ranges"
stage was 0.11-0.31 ms, 0.08-0.29 ms of it waiting for that lock ("the
submit's other waits for it: ... ranges").
The tiles' runs (`State::runs`, `src_runs`) change only under the lock,
and every change moves `MAPPED_GEN` (which is in the key already). So the
last answer is kept with the generation it was made at (`RANGES`) and
given again without the lock while the generation stands; `init` moves it
when it puts a new state in. This is the "already up to date" check made
lock-free, as VIctory-Neo does for its refreshes (55eb862, its write
journal's epochs); here there is one generation for all the ranges.
XCL_LOOK_STATS=2: the sparse lock split line counts the answers made under
the lock and those that were not.
Test: mapped_ranges_made_at_this_generation_need_no_lock (answered while
another thread holds the lock; once the generation moved, it waits for
the lock and makes them again).
Ported from amd-dev: the static is `LAST_MAPPED_RANGES` (main has a
`const RANGES` look field); main's lock split line has no CPU reads part,
so only the mapped ranges count is added to it; `init` moves the
generation under main's `STATE` guard, which it keeps for the early
commits.
(cherry picked from commit 0383b3fe8a6a2595031fb89d702d0ce3e3f898ad)
(cherry picked from commit 707123a)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1dc5083 to
b47d0eb
Compare
|
merge-check
|
|
merge-check claim |
|
merge-check |
Port of raylitebull's amd-dev commit
707123ad.sparse::mapped_rangestooksparse::STATEevery time the watched ranges were rebuilt. In a retail title's world on amd-dev (RX 9070 XT), a submit waited 0.08–0.29 ms for that lock there. The ranges only change under that lock, and every change movesMAPPED_GEN. So the last answer is now kept with the generation it was made at, and given again without the lock while the generation stands.initmoves the generation when it puts in a new state.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:LAST_MAPPED_RANGES(amd-dev'sRANGES, renamed: main has aconst RANGES),initmoving the generation under main'sSTATEguard, theXCL_LOOK_STATS=2count of answers made with and without the lock (main's split line has no CPU-reads part, so only this count is added), and the testmapped_ranges_made_at_this_generation_need_no_lockReview of the port:
State::runs/src_runson main is followed by aMAPPED_GENbump underSTATE:shadow_window,ensure_listed,commit_range, decommit, unmirror,link_mirror,unlink_kept.STATEheld, so its generation always matches its ranges.forget_released, so buffers waiting inFORGOTTENare handled by the next lock holder. That only delays a release.Tested
cargo test -p xcl --lib hle::d3d12x::sparse: 141 passed, 0 failed, 1 ignored. The new test fails with the lock-free path taken out.cargo test --workspace --no-fail-fast -- --test-threads=4on b47d0eb, rebased on main 86e86fc (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
init, the split line), reviewed every change of the ranges for the generation bump, ran the tests and the smoke runs, wrote this description.707123ad.🤖 Generated with Claude Code