[pr-performance][RAYTRACING] Hardware RT: readable_len probes the pages instead of asking VirtualQuery #115
Loading…
Reference in a new issue
No description provided.
Delete branch "MesoPlz/Darner:hwrt-readable-probe"
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?
Contributor role (optional)
What it changes
With hardware ray tracing on, play stuttered in bursts of BLAS builds and rehydrates: frames of 200 ms to 2.5 s with the card idle. The submitting thread's write-watch asking (
preparing per frame, the submitting thread: ... asking the write watch) went up to 1,311 ms a frame, also withDARNER_ASK_FAST=1. Itsasklineshowed the calls on the processor for only 12-18 % of their time: they were waiting, not spinning.An xperf trace (context switches with ReadyThread stacks) of one such second: the submitting thread waited 375 + 103 ms in
WrPushLock. It was readied fromMiUnlockVadShared←MmQueryVirtualMemory←VirtualQuery←darner_gpu::hwrt::read_geometries←darner_hle::modules::xboxbvh::rehydrate_batched2, on two title threads that spent almost all their CPU samples inNtQueryVirtualMemory.VirtualQuerywalks the page tables to the end of the region under the process's address-space lock: milliseconds a call in the title's big pools (ashost::copy_mappedalready notes), andGetWriteWatchwaits for that lock.readable_lennow reads one byte of each 4 KiB page withcrate::safecopy::copy(the kernel's read withDARNER_SAFE_COPY=0), and stops at the first page that cannot be read, as before. A range past the end of all addresses is unreadable, asVirtualQuerysaid. Onlyhwrt.rschanges.How it was tested
6dbe5ddonmainfc3642e. The game runs were onmain1a5286awith the samehwrt.rschange (release build).cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test --workspace --locked: 2076 passed, 7 failed, 89 ignored. The failures are indarner-gpuwrite-watch and timing tests (watch_pipe,card_steps,gpu_owned,watch::tests::ask_once_by_res_splits_reservations_without_refusals); none inhwrt. Reruns ofcargo test --locked -p darner-gpu --lib: onmainfc3642e1 failure in 2 runs (shadow::wide_tests::nested_wide_each_scoped_handles_overflow_concurrency_and_panics); on this branchask_once_by_res_splits_reservations_without_refusalsfailed in 3 of 3 runs, and in 2 of 3 runs with the new test skipped (--skip readable_bytes_end). Alone or together with the new test it passes (3 of 3). Not found out why.cargo xtask policy --staged(at commit): 1 file okreadable_bytes_end_at_the_first_page_that_cannot_be_read(committed, reserved and past-the-end pages, all ones, the kernel's half, a non-canonical address): ok.DARNER_WINDOWS_BAR_MB=0,DARNER_CARD_WINDOWS_MB=1536,DARNER_ASK_FAST=1,DARNER_KEEP_SHOWN=checked.main(477 s)Checklist
main.docs/asset-policy.md.Checked for overlap
host::read_into, so its hot paths no longer callreadable_len; its fallbacks still do). The two conflict textually inreadable_len. #92 and #3 also touch hardware RT.🤖 Generated with Claude Code