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 |
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