Repository navigation
D3D12.X: read title texture generations without the TEXTURES lock - #3580
raylitebull wants to merge 2 commits into
Conversation
update_lengths, called under the TEXTURES lock on every placement, release, retirement and uncover, counted the CPU-backed entries by walking all of by_res. A retail title keeps tens of thousands of entries there (55k+ in the amd-dev measurement), so every texture create and release paid for a full scan while holding the lock that submits and recording also take. Table now keeps cpu_backed_count up to date where by_res changes (insert_active / remove_active), and update_lengths stores it. Ported from amd-dev 4d6d4a7. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
Review (head 04737e3, the top commit read; draft, stacked on #3576):
Fine: it's an AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
capture_transitions (every barrier recorded on a list while textures are kept in step) and capture_gpu_write (every copy and clear into one) took the TEXTURES mutex to read one registration generation each. Submits hold that lock while they choose the textures to upload, so recording threads waited behind them. RES_GENERATIONS mirrors the generation of every active or shadowed entry of TEXTURES. Table writes it under the TEXTURES lock where an entry is placed and where it leaves (release, retirement), and the two capture paths read it under a shared lock. Tables made by tests leave it alone. Ported from amd-dev 4d6d4a7, which measured this together with its other lock changes on amd-dev (draw recording 168 -> 48 us avg on an RX 9070 XT); this part was not measured on its own or on main. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
04737e3 to
c36eedf
Compare
|
Follow-up (head c36eedf; the diff from 04737e3 read). The duplicated state is now checked: in debug builds AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
@Foniass thanks, the check is in (c36eedf), as you confirmed. On the write lock inside AI use: written by Capy (Claude Opus 5.5) and posted on raylitebull's behalf, with their go-ahead. |
|
Test report (not a merge-check: draft, AI-written and posted by Foniass without a human check of each point. |
Stacked on #3576; only the top commit (
D3D12.X: read title texture generations without the TEXTURES lock) belongs here.capture_transitionsruns for every barrier recorded on a list while textures are kept in step, andcapture_gpu_writefor every copy and clear into one of them. Each took theTEXTURESmutex to read one registration generation. Submits hold that lock while they choose which textures to upload, so recording threads waited behind them. Now the generations are mirrored in a map that both read under a shared lock.What is in it
title_textures.rs:RES_GENERATIONS, the generation of every active or shadowed entry ofTEXTURES.Tablewrites it under theTEXTURESlock where an entry is placed and where it leaves (release, retirement).capture_transitionsandcapture_gpu_writeread it. Tables made by tests leave it alone (Table::global). In debug builds,update_lengthschecks the map against the table.amd-dev: theSHADOWED_IDSmirror foruncover_drawn, whichmaindoes not have.the_generation_mirror_follows_the_table. The existingtransitions_apply_when_their_list_is_submittedcoverscapture_transitionsthrough the mirror.Tested
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu: no errors, no new warnings.x86_64-pc-windows-gnufrom this branch (both commits) and run under Wine 9.0 (no GPU) with--test-threads=4, next to the same filters onmainb2b1f109:hle::d3d12x::title_textures: 66 passed, 1 failed, 1 ignored (main: 64 / 1 / 1)hle::d3d12x::list_x: 110 passed, 4 failed (main: 110 / 4)The failures are the same tests on both, ones that need a D3D12 device or Windows' working-set queries, which Wine lacks.
Regression run
Not run yet: there was no Windows machine or title here.
scripts/smoke.ps1still has to run on a title, built frommainand from this head, soPR checksfails until those two blocks are added.Not tested
cargo test --workspace -- --test-threads=4) on Windows, with or without a GPU; CI's no-GPU job is the first Windows run.main. Onamd-devthis was part of4d6d4a77, measured together with its other lock changes there (draw recording 168.1 -> 47.6 us avg on an RX 9070 XT).AI use
amd-devcommit4d6d4a77tomain, split it into this PR and five others, and wrote the test, the commit message and this description. Theamd-devmeasurements are raylitebull's own runs.