Repository navigation
Conversation
|
Independent Windows 11 check at c8d5020. The offline workspace build and both stock page-mapping tests passed. I extended the physical-page fixture to reuse the vacated pool address for a second page with different bytes. The original GPU view still resolved to the first page at its new address, and a new mapping resolved to the second page. A These checks exercise the mapping functions directly. AI-assisted. Codex (GPT-6) extended and ran the synthetic fixture. |
There was a problem hiding this comment.
Review of c8d5020 against its merge base 67a3735, by reading the code; nothing was built or run here. I found no defect that changes what a title does today: nothing reads mapped_source yet, and the decode is checked before anything is recorded. The one real point is that the new address-to-page record (Away::title) is not kept in step with frees and failed maps, and the description's statement about freed pages does not match the code. That matters for #1102, which reads this record.
-
CONFIRMED: a freed page is answered at its home, not at the pool address as the description says (
crates/xcl/src/hle/kernelx.rs:949-952,:989-994,:1307-1314). Not tested says: "page_nowthen finds no page, and the pool address is answered." That holds only when the page's whole allocation is gone.page_homeasks whether the block has any live page (live > 0,:993), not whether this page is live, andFreeTitlePhysicalPagesremoves the block only when its last page is freed (:1323-1326). Scenario: the title allocates its streaming pages in one call (the comment at:916-918describes a retail game doing so), maps page P at a pool page, gives that pool page to a GPU-view page, and later frees P alone. The free dropsaway.page[P]and leaves the bytes at the pool address (:1306, "that address keeps whatever it holds").mapped_sourcethen returns P's home:page_nowfinds nothing inaway.pageandpage_home(P)is stillSome. That home was given back when the page moved away (move_home_away/give_back_homes), so it is not committed, or in the coherent window it holds old bytes. The pool address, which still holds the data, is not answered. Fix: either drop the freed pages from the record inFreeTitlePhysicalPages(see 2), or correct the sentence in Not tested; a test that frees one page of a two-page allocation would pin it down. -
CONFIRMED (minor):
Away::titlekeeps entries for mappings that are gone or never happened (kernelx.rs:1398-1402,:1374-1376). Three cases:FreeTitlePhysicalPages(:1307-1314) clearsaway.page/away.atbut nottitle, so a laterapply_batcheson that pool page still recordspage: Some(P)and counts it under "to a physical page the title mapped there" in the log.- In
map_pagesthe entry is written before the mapping is made. Whenmove_awayfails (:1419-1422) or the commit fails (:1436-1439) the call returns null, buttitle[at]already names the page, afterunmap_awayremoved whatever was there. - Releasing a reservation with pages mapped in it (
VirtualFree,:571-575) leaves its entries; a later reservation at the same address inherits them. (away.athas the same gap onmain, so this one is not new in kind.)
None of these is read by anything in this PR. Fix: remove the freed pages' entries inFreeTitlePhysicalPages, and write the entry inmap_pagesafter the page is in place.
Checked and found in order:
- Decode and bounds (
kernelx.rs:255-297): batch and range arrays go throughreadablebefore they are read, the pool bound is checked per range withchecked_add, the page total is capped before anyextend, an unknown kind or a range leaving the pool returns before anything is recorded. - Locks:
apply_batchesreleasesAWAYbefore takingSTATEthenPAGES(:299-307);releasedtakes the same order (:204-210);mapped_sourcedropsPAGESbeforepage_nowtakesAWAY(:241-242);map_pagesholdsAWAYand reachesSTATEthroughnote_mapping_at. I see no inversion. - Slot: with the newer layout
queue_dispatchsubtracts 2, so #31 arrives as 29 (crates/xcl/src/hle/d3d12x/real.rs:4961,:5010); four arguments are enough forcount, batches, pool, pool_pages, and the method still returnsS_OKas the stub did. Like 23 and 30, the arm is not gated on the layout being known; a newer-layout title calling its #29 before its first fence at #16 / #17 would have that call decoded as batches, where thereadableand kind checks are the only guard. - Tests: both tests assert what the description lists. The second goes through
MapTitlePhysicalPages, so it covers the move from the pool address to another address. Neither covers a freed page (finding 1) or the page limit. - CONTRIBUTING: Tested, Regression run (main block at the merge base, PR block at the head commit, frames and peak commit within the limits), Not tested and AI use are there; 286 changed lines. The
CIworkflow showsaction_requiredfor this head (it has not run), so onlyPR checksis green so far.
Questions for the author, not defects:
- The log line in the description shows 18,635 mapped GPU-view pages after 256 calls (at 64.8 s); the tracker table says 34,872 mapped after 256 calls, and the last bullet says 256 calls by 84 s. Are these from different runs? The share of pages read wrong (15,064 of 34,872) rests on the tracker's count.
- The first commit records pool pages and the second replaces that model with physical pages, as the correction in #1031 explains. Both land in
main; squashing them would keep the superseded model out of the history.
Overlap: #1102 (draft) is stacked on this PR and reads mapped_source. #979 touches only crates/xcl/src/hle/dstorage.rs and resolves GPU-view addresses through mirrors::source and physical_page_at; there is no textual conflict, but once pages recorded here are honoured, a DirectStorage destination in a GPU-view page that this method pointed at a pool page should follow mapped_source too, otherwise it writes the CPU view while textures read the pool page. No other open PR implements this queue method.
Verdict: no blocking defect; fine as a logging-only first step once CI has run. Finding 1 should be settled (code or description) before #1102 relies on it.
Review by Claude Code (written by Claude Fable 5.2, checked with Claude Opus 5.5); each point checked by a person before posting.
…GPU-view page shows Queue method ivall#31 (ivall#29 of the older layout) maps pages of the title's memory into GPU views; it was a stub. Its batches are now decoded and checked against the batch count and the pool, and each 64 KiB page of a GPU view records the pool page it was given and the physical page the title had mapped there (kernelx::mirrors). A bad call records nothing; releasing a view drops its pages. XCL keeps a physical page's data where it was mapped last, and the title maps most streamed pages into the CPU view behind the GPU view too, so `mapped_source` answers where that page is now (`page_now`), else the pool page itself. Each title mapping is remembered per address (Away::title), written once the page is in place and forgotten when the reservation goes; a page freed while its allocation lives is no longer looked for (Away::freed). Nothing reads the record yet: textures are unchanged; the queue logs its counts. (ivall#1031) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c8d5020 to
f532d33
Compare
|
Thanks @pvfreis, both findings were right. I pushed 1. A page freed alone.
2.
Your questions.
Tested so far on #1102 is rebased onto AI use: Claude Code (Claude Opus 5.5) made the changes, ran the tests and the title, and wrote this reply. |
|
The full suite and a regression run on
Each figure in the description now names the run it comes from, and I removed the wrong sentence about freed pages. |
|
Thanks, both are fixed at
Reply by Claude Code (Claude Opus 5.5); checked by a person before posting. |
Integrates upstream PRs ivall#1055 and ivall#1102 (issue ivall#1031) and ivall#1070 (issue ivall#1040). Assisted-by: xcl-ops (deepseek-v4.1-flash) Trace-Issue: ivall#1031
|
Code review on
What is still needed before merge:
|
|
Update: \Build and test (Windows, no GPU)\ is now green on \532d33\ (\CLEAN). Isolated AMD verification on \532d33\ is the only remaining item before merge. |
|
A reader for this record beyond textures (#1102): the title's buffer views and root views in the GPU view. Making them readable is what gets the world's geometry rasterised here. Result: #697 (comment) ; the per-page census with this PR's map is on #1031 (#1031 (comment)). Setup in short (the full block is in the linked comment):
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment. |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
The queue's CopyPageMappingsBatchX names pool addresses, and on the console a physical page stays mapped at every address the title mapped it at. XCL keeps a page's bytes in one place: Away::at holds an address only while the bytes are kept there, and when the title maps the same page at a second address XCL moves the bytes and move_away drops the first address - which is the pool address the method names. So the method could not tell which page a pool address holds. Away gains title: address -> the page the title mapped there last. map_pages clears an address's entry first and writes it only once the page is in place (at home, after a move, at the lazy insert, at the final insert); a failed map leaves none. FreeTitlePhysicalPages drops the entries of the freed pages with one retain (page numbers are never handed out again); the release of a sparse, view-window or graphics reservation forgets the entries inside it. Bookkeeping only: nothing reads it yet, no behaviour change. Tested: cargo check -p xcl --tests (no new warnings); cargo test --release -p xcl --lib hle::kernelx: 52 passed, 0 failed, 1 ignored, including the new an_address_keeps_the_page_the_title_mapped_there_last. Builds on xcl-dev#1055 by Xeltax (f532d33): Away::title, forget_title_mappings and their insert points, with the fixes made there after review (write after placement, clear on free, forget on release). Not taken: Away::freed (the entries of freed pages are removed instead). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The queue's CopyPageMappingsBatchX (xcl-dev#29 of the older layout, xcl-dev#31 in the newer one) maps pages of the title's pool into GPU views; it is a stub here. Its arguments are decoded apart from what is done with them, so the record that follows takes a checked list. mirrors::decode_batches turns one call into (GPU-view page, pool page or None for unmapped) in the call's order: batches of 24 bytes (first destination, number of ranges, pointer to them), ranges of three u32 (kind 0: consecutive pool pages, 1: one pool page repeated, 2: unmapped, 3: left as they are; start; count). The whole call is checked before anything is returned: an unreadable batch or range, a range leaving the pool, an unknown kind or more than 1 << 20 pages refuse it. No lock. Not called yet; mirrors::PAGE names the 64 KiB page. Tested: cargo check -p xcl --tests (no new warnings); cargo test --release -p xcl --lib hle::kernelx: 53 passed, 0 failed, 1 ignored, including the new the_page_mapping_batches_are_decoded_whole. Builds on xcl-dev#1055 by Xeltax (f532d33): the decoding, its checks, the Batch test helper and the cases of the test. Builds on xcl-dev#2308 by adiologydev (31fe59c): the decoding split from the record. The batch layout is a fact xcl-dev#1055 cites; no code from elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The queue's CopyPageMappingsBatchX copies the mapping of a pool page into a page of a GPU view: from the call on, the view page shows the physical page the title had mapped at that pool address. XCL keeps a page's bytes in one place, often not the pool address (the title maps most streamed pages into the CPU view behind the GPU view too), so the record keeps, for each view page the method names, the physical page and where XCL keeps its bytes now. mirrors::apply_batches decodes a call (decode_batches), resolves each pool address through Away::title to its page and the page's place (the address it is mapped at away from home, else its home), and records it with AWAY held from the lookup to the record, so a page that moves in between cannot be recorded at the place it left. The record has a lock of its own (PAGES, an RwLock; STATE -> PAGES where both are held, readers take PAGES alone): what each page shows (physical page, place, whether a tile may show the place - unified memory, a graphics reservation or a home -, the call that last changed it, its log key), physical page -> view pages, place -> view pages, the 16 MiB blocks of the places and a log of the last change of each page. A pool page with no page mapped and an unmapped page show nothing; the same mapping named again changes nothing. mirrors::released drops the pages of the views that go. Readers: shows (NoView, Same, Page, Nothing), resolve (an address per 64 KiB page and four counts), touched, any_mapped, calls - each one atomic load while nothing is recorded. Still not called by the runtime: no behaviour change. Tested: cargo check -p xcl --tests (no new warnings); cargo test --release -p xcl --lib hle::kernelx: 54 passed, 0 failed, 1 ignored, including the new gpu_view_pages_record_the_physical_page_mapped_into_them (a call made after the page moved into the CPU view, the unchanged mapping named again, a remap, the tile flag of a page kept in plain memory, the release of the view). Builds on xcl-dev#1055 by Xeltax (f532d33): the recorded physical page, Mapped, the record step with its in-view check, the released hunk and the cases of its tests. Builds on xcl-dev#2308 by adiologydev (64ad64c): a pool page with nothing mapped shows nothing and is counted. Fork: the place kept eagerly (in place of page_now, which locks AWAY), the lock of its own, the tile flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dev#1031) Queue method xcl-dev#29 (xcl-dev#31 in the newer layout) is how a title maps the pages its texture streaming fills into the GPU views its textures are in. It was a stub: every mapping was dropped, a GPU-view page kept showing its CPU view at the same offset, and streamed textures uploaded as zeros. Its arm now goes to q_copy_page_mappings, which hands the call to kernelx::mirrors::apply_batches (the record, the tiles, the textures and the writes of the commits before this one) and sums what it did. A call the decoder refuses records nothing and logs one warning. The result is S_OK either way, as the stub's was. The fifth argument does not reach queue_dispatch and is ignored. This is the only commit of the series that changes what a title sees. XCL_PAGE_MAPPINGS=0 (mirrors::page_mappings, parsed by the pure page_mappings_on) leaves slot 29 to the stub and logs that once; the record then stays empty and every new path is behind one atomic load. README names the switch. Tested: the_queue_page_mapping_method_records_and_can_be_switched_off (new): a call over a pair of views of the test's own records a named pool page with no page and an unmapped page as showing nothing, leaves an untouched page on its CPU view, and returns S_OK; a call with a range of an unknown kind records nothing and returns S_OK; the switch parses. Modules queue_tests + hle::kernelx: 61 passed, 0 failed, 1 ignored (release, software adapter). Builds on xcl-dev#1055 by Xeltax (f532d33): the queue arm, the totals and the warning text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One info line at the first recorded call of CopyPageMappingsBatchX, at powers of two and when 10 s have passed since the last one: the calls; the GPU-view pages mapped, unmapped, named with a pool page that had no page mapped there (must stay 0: above 0, Away::title misses a path by which the title maps pages) and elsewhere; the view pages that moved with their physical page; the textures read again for a mapping changed under them and the pages of their uploads by where they were read; the tiles shown anew and the tiles that followed their page. This is what a run needs to tell whether the page mappings reach the textures and tiles. Diagnostics only; the text comes from a pure function, and the counters are atomics read with the totals' lock dropped. Tested: the_page_mapping_line (new) checks the exact text. Module queue_tests: 4 passed, 0 failed, 0 ignored (release, software adapter); the run printed the line for the test's own call. Builds on xcl-dev#1055 by Xeltax (f532d33): the first half of the line. The count of pool pages with nothing mapped follows xcl-dev#2308 by adiologydev (64ad64c). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Queue method #31 of the newer layout (#29 of the older),
CopyPageMappingsBatchX, maps pages of the title's memory into GPU views. It was a stub. This PR decodes its batches and records, for each 64 KiB page of a GPU view, the physical page it shows. It can then say where XCL keeps that page's data now. Nothing reads that record yet, so textures are unchanged. First of the PRs planned in #1031 (see the correction there).What is in it
crates/xcl/src/hle/kernelx.rs,mirrors:apply_batches(count, batches, pool, pool_pages)decodes one call:kind, start, count(u32 each). Kind 0 mapscountpool pages fromstart; kind 1 maps pool pagestartat each ofcountpages; kind 2 unmaps; kind 3 keeps.pool_pages, the kind must be known, and the call may name at most 2^20 pages. A bad call records nothing.Shown).mapped_source(va)answers what the method put underva:Some(Some(a)):ais where XCL keeps that physical page now (page_now), or the pool page itself when the title had mapped none there;Some(None): the page is unmapped;None: the method never touched the page.releasednow also drops a released view's recorded pages.crates/xcl/src/hle/kernelx.rs, physical pages:Away::titleremembers, per address, the page the title mapped there last.move_away).page_now(page)gives where the page's data is: its address away from home, else its home. For a page the title freed while the rest of its allocation lives (Away::freed), it gives nothing.crates/xcl/src/hle/d3d12x/real.rs: queue Shader tools: keep DXC timings out of JSON output #29 (older numbering) callsapply_batchesand returnsS_OKas the stub did. It logs its totals at the first call and at powers of two, including how many mapped pages had a physical page, and warns once on a bad call.page_mappings_point_gpu_view_pages_at_pool_pages: synthetic batches covering:a_gpu_view_page_shows_the_physical_page_where_it_is_kept: a real physical page is mapped into a pool and given to a GPU-view page. The page shows the pool. Once the page is also mapped at another address, the GPU-view page shows that address, with the same data.a_freed_page_is_read_at_its_pool_page(from the review): one page of a two-page allocation is freed. The GPU-view page then reads the pool page, which keeps its bytes, and a later call records no physical page behind it.On the retail title (the one in #505;
main67a3735+ this change, RTX 4080, A pressed throughXCL_PRESS_AT; the run ends at+0x23cf683as onmain)Every call decodes, and every page lands in the title's one GPU view (
0xdffff0000, the view of0x7ffff0000). Log line from the run ofc8d5020:Where XCL keeps the physical pages. A local tracker, not part of this PR, followed each page. This was a separate run, on
924b55cplus the tracker. After 256 calls (at 84 s), of 34,872 mapped GPU-view pages:mirrors::source), whichtitle_texturesreads today, is right.How textures sit on the map (local count, another run, 111 s, 22,353 textures in the view):
The next PR has
title_texturesread GPU-view textures page by page throughmapped_source. It will re-check only the textures on pages that changed: the existing re-check of all GPU-view textures took 225 ms over 64k textures at 111 s, and there were 256 calls by 84 s.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4onf532d33: 738 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).Regression run
main:
PR:
Not tested
Reference
The batch and range layout comes from VIctory's description of this method (
crates/victory-gpu/src/queue.rs). I read it as a reference only; no code was taken. The decode matches what the retail title passes (#1031).AI use
🤖 Generated with Claude Code