Repository navigation
Conversation
…cl-dev#582) Behind XCL_SPARSE_COOL=1 (off by default), a 64 KiB tile of a sparse window with no written page for 8 looks is made read-only and left out of the GetWriteWatch look. Its first CPU write faults; a vectored handler makes it writable again and the next look takes it back, the write itself in the write watch as before. A tile written between the look and the protect stays writable. The kernel's writes (kernelx::lazy::ensure: ReadFile, DirectStorage, cpu_writes) and the title's commit, decommit and protect calls warm the range first. At most 64 tiles are cooled and 4096 examined per look. The timing line adds ms and MB per look and the read-only tile counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and skips cooled tiles Rainmaker33's Zen 4 run on xcl-dev#1034 measured the pass at 0.23 ms a look, half of what the shorter look saved there. Each look examined up to 4096 tiles through a HashMap and asked the read-only set again for every tile already cooled. Now the quiet state is a Vec indexed like the tile list (rebuilt when the mapped tiles change), a cooled tile is marked in it and skipped until a write marks it again, and a look examines at most 1024 tiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ooling pass The title maps and unmaps tiles all through a load, and each change rebuilt the list of ~118,000 tiles and its index. Now a changed list is rebuilt at most every 64 looks; a tile mapped meanwhile waits for the next rebuild, one unmapped meanwhile fails cool_tile's query. The timing line now gives the cooling pass's own time per look (0.095 ms on an i9-9900K). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Upstream PR xcl-dev#1034 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of xcl-dev#582: step 1-2 of the plan there (direction agreed in xcl-dev#582 (comment) and claimed in xcl-dev#582 (comment)). Off by default:
XCL_SPARSE_COOL=1turns it on.What is in it
hle/d3d12x/sparse_cool.rs(new): a 64 KiB tile of a sparse window with no written page for 8 looks is made read-only and left out of theGetWriteWatchlook. Its first CPU write faults; a vectored handler makes it writable again, and the next look takes it back with that write in the write watch as before. At most 64 tiles are cooled and 4,096 examined per look, so the extra cost of a look is bounded.VirtualProtecta non-resettingGetWriteWatchon the tile undoes it if a page was written meanwhile (testa_tile_written_since_the_look_is_not_cooled).kernelx::lazy::ensure(so the ReadFile hook, DirectStorage destinations andcpu_writes), the title'sVirtualProtectand sparse commit, andsparse::committed/decommitted.sparse'sSTATE, so a readback that writes title memory underSTATEand faults does not deadlock.sparse::mapped_rangesleaves the read-only tiles out, and the look's range cache (title_textures::cached_watch_ranges) is keyed on the module's generation too.Tested
XCL_SPARSE_COOLunsetXCL_SPARSE_COOL=1What stays in the look (951 MB) is the kept-in-step textures and the graphics reservations, step 3 of the plan. The cooling pass costs about 0.6 ms a look here (chunk scan line), which is the next thing to trim.
3bc6aa0), after Rainmaker33's Zen 4 run measured the cooling pass at 0.23 ms a look: the quiet state is a Vec indexed like the tile list instead of a HashMap, cooled tiles are skipped until a write marks them again, a look examines at most 1,024 tiles, and the tile list is rebuilt at most every 64 looks (the title maps and unmaps tiles all through a load). The timing line now prints the pass's own time: 0.095 to 0.159 ms a look on the i9-9900K in two 120 s runs, against about 0.6 ms before (the chunk-scan difference above). Same machine,3bc6aa0, 120 s, at 1,024 looks: 1,351 MB a look unset, 862 MB a look withXCL_SPARSE_COOL=1(13,427 tiles read-only, 621 warmed); ms per look were about equal in this pair (6.22 / 6.30), with the dirty-page count differing between the runs (520,462 / 321,431), so on this CPU the reset of written pages, not the bytes, set the time in these two runs.cargo test --workspace -- --test-threads=4: 731 passed, 0 failed, 41 ignored (debug, aftercargo build --workspace). SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64 on this GPU).sparse_cool: a cooled tile is warmed by its first write and the write is still in the write watch; a tile written since the look is not cooled;warmrestores write access for kernel writes; only tiles quiet for several looks are cooled.Regression run
main:
PR (default,
XCL_SPARSE_COOLunset):PR with
XCL_SPARSE_COOL=1:Not tested
smoke.ps1pair withXCL_SPARSE_COOL=1on a Zen 4/5 or a recent Intel would settle it.ERROR_NOACCESSrather than leave stale data; that is why it is off by default.AI use
🤖 Generated with Claude Code
Mirror of xcl-dev#1034 (auto-synced, do not edit).