Repository navigation
Conversation
|
Test report: RTX 5080 (wave32), head Tested
Not tested
AI use
|
…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>
…hod put under it Each 64 KiB page of a texture in a GPU view is read from what queue XCL keeps it, zeros for an unmapped page, the CPU view for a page the method never mapped (`source_of`, `Source::Pages`). The textures on the pages a call changes, or whose physical page moved, are looked at again at the next submit (`mirrors::take_changed`, `page_moved`), not all of them. Their writes are watched where the pages are. (ivall#1031) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59042fd to
c387de2
Compare
|
Thanks for the run, @IvyNotFound. It matches what I see: textures in GPU views now read their pages, and the frames after loading stay black or flat grey, as on
AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Confirming #1102 (with #1055) on an RTX 3070 (8 GB VRAM) / 16 GB RAM, Windows 11, applied on top of #605 (R9G9B9E5 → R11G11B10, needed so Series S does not assert at startup). Series X (anaconda): with #1102 the retail title now renders fully visible 4K frames — 518400/518400 sampled pixels non-black, real scene colors (dark intro tones) — where before every sampled frame was black. CopyPageMappingsBatchX decode is active (e.g. Series S (lockhart, 1080p — fits 8 GB): stable ~30 fps for 240 s+, no crash, but frames stay black on this setup even with #1102. The per-frame ID3D12GraphicsCommandList10 #126/#142 are still stubbed here, so a visible Series S frame appears to also need those (#616 / #1031 family). Net: #1102 moves GTA VI from all-black to visible with correct textures in Series X. Thanks for this! Tested with Claude Code (AI-assisted). No game data attached. |
|
A note on overlap, from a local change that touches the same textures (not a PR, and I won't open it as it is because of this PR). What I measured: GTA VI 1.0.2.1, RTX 2060 SUPER 8 GB, i5-9400F, 16 GB RAM, The local change: keys a GPU-view page texture's owned pages by the physical page at its CPU-view source (the Why it collides with this PR: those "nothing behind" pages are very likely the ones the title maps with Question: does #1055 keep the GPU-view page → physical page mapping somewhere AI use: Claude Code (Claude Opus 5.5) wrote the diagnostic and the change and ran the measurements on my PC; it also drafted this note. |
|
Fresh Series X (anaconda) on an RTX 3070 (8 GB) / 16 GB RAM: steady 30 fps with visible, correctly-textured frames throughout the 90 s window (0 device removals, 0 crashes). On this 8 GB card the 4K path later hits the known device-removed, but not within the smoke window. Tested with Claude Code (AI-assisted). No game data attached. |
|
Thanks @MKmajster, that's the first report of visible world frames with these two PRs. I'll keep the 8 GB VRAM device removal and the Series S @3L1A5-1, yes: the mapping is kept, and Where it is (
Order: the record is made when the title calls queue #31, on the CPU, in the order of its queue calls. It is not deferred to the GPU timeline, as XCL runs other queue methods. So a submit sees the mappings of every call made before it, which I think is what your "before the next submit" needs. Nothing would tell you that a submit made earlier still reads the old pages. So I'd say: rebase onto #1055/#1102 once they land. Give a NULL tile only where both are true:
Ask me anything about those calls. AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Tested
Not tested Native Windows from this build, or rendered gameplay on this adapter. AI use OpenAI Codex with GPT-6.2-Sol high prepared the integration, ran the tests, and wrote the report. |
|
Tested #1055 (f532d33) and #1102 (c387de2) together on an RX 7900 XT, Windows, main 930e8b4 with the same downstream sparse-release, texture-budget and physical-page changes in both runs. The saved Series X profile and initial XCL caches matched. A was delivered on the rendered Player1 prompt at 33 s. Both runs had DRED and the same 28 GiB Windows job limit. The comparison build called queue method 31 as a stub at 6.213 s and accessed a GPU-view texture at 10.648 s. With the two PRs applied the title exercised the new implementation: at 93.622 s the counters reported 256 calls, 35,111 pages mapped to title-mapped physical pages, 2,368 unmapped, zero elsewhere ignored. The four focused page-mapping and texture-source tests all passed. The comparison run later logged device hung and a DRED page fault. The patched run instead logged command-list Close returning 0x8007000e at 133.130 s, followed by a breakpoint on the same thread. Peak sampled process commit was 28,329 MB, with zero logged device removals in that run. One run each under a memory cap verifies the title reaches the new mapping code; stable gameplay and correction of the comparison GPU fault are still unverified. Follow-up on the same RX 7900 XT with #1422 also applied, a 2048 MB soft texture budget and timed in-process thread dumps disabled. The title again reached world loading. The external observer recorded Windows 0xc0000409 (subcode 7). The faulting thread stack contained Rust allocation-error handling, title_textures::Source::bytes, subresources_of and its worker. The mapped-page path allocates a contiguous scratch buffer for a slice. Peak sampled process commit was 28,294 MB under the same 28 GiB whole-job cap. This localizes an allocation failure under that cap. The allocation size and the rest of the process memory breakdown were not recorded. Local follow-up: I tested a bounded mapped-texture reader that borrows contiguous spans and streams scattered or missing input through 64 KiB regions for detiling and hashing. A byte-for-byte test passed for mip chains, arrays and a volume with non-aligned runs and holes. On the next title run the original texture allocation abort did not recur; at about 180 s a different thread faulted in SDK dxcompiler.dll while XCL was compiling a shader. Peak sampled process commit was 28,416 MB under the same 28 GiB job limit. The scripted A was delivered at 33 s versus 20 s in the previous run, so elapsed time is not a controlled performance gain. World loading remains unresolved. With two DXC workers the bounded-input build next failed allocating the decoded mip output. I then detiled mapped textures directly into checked D3D12 upload footprints. The focused regression verified exact pixel bytes, untouched row padding, and the short last row; the native GPU readback and upload-buffer reuse test passed. In the title, at least 256 direct batches ran. At 228.505 s it exited with DXGI_ERROR_DEVICE_HUNG, DRED GPU VA 0x1b0679000 and a partially completed command list whose next operation was Dispatch. No texture-allocation abort in that run. The playable world remains unverified. |
Integrates upstream PRs xcl-dev#1055 and xcl-dev#1102 (issue xcl-dev#1031) and xcl-dev#1070 (issue xcl-dev#1040). Assisted-by: xcl-ops (deepseek-v4.1-flash) Trace-Issue: xcl-dev#1031
|
A follow-up from an RX 7900 XT on Windows. On a downstream XCL stack carrying this mapping work, I reproduced a texture ownership error after a GPU write and a backing change. The native-adapter fixture uses a 64×64 R8 texture and the public physical-page mapping path.
On this stack the remap scheduled a full upload but kept the old gpu_written flag. The later CPU write was filtered out. My local prototype clears the previous ownership and cached content hash when the upload source changes. A newly recorded GPU copy checks its current backing before claiming ownership. The regression also exercises equal bytes in the old CPU mirror and the replacement page, and the inverse ordering where a GPU write recorded just after the remap must survive a later stale CPU write. All 16 title texture tests passed on the modified build. The game impact remains unverified. Game follow-up, one run each with the same Series X save, controls, starting caches, and application build settings. With the texture fix the last positive present interval ended at 196.1 s; DRED reported a GPU page fault at 0xf000 at 198.0 s. The matching mesh-enabled control last presented at 186.1 s and faulted at 0x6000 at 191.1 s. No allocation was named at either address. The final captured images were dark. The native pixel regression is fixed; this pair does not show a world-loading fix. |
|
Follow-up to my overlap note above: the local change that keys GPU-view page textures by the physical page is now rebuilt on this PR, as you described: a GPU-view page takes its key from the method's record ( Tested
The two runs match within ~20 MB up to 70 s and split when world streaming starts. Not tested
AI use
|
|
Code review on
Items to address before undrafting / merging after
|
|
Measurements for raylitebull's point 1, and a second cost in the same path. At
Both times are what the "view-source recheck" and "hash" parts of the Not tested: Windows ( AI-assisted. Claude Code, Claude Opus 5.5. |
|
The PR shows a conflict with
AI-assisted (Claude Code). No game data attached. |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
|
Tested on RX 7800 XT (RDNA3), Windows 11 Compared clean release builds of parent #1055 at
Both runs reached loading artwork, ended at the time limit with exit Not tested: Playable-frame output, repeated runs, or isolated texture-upload performance. AI use: OpenAI Codex (GPT-6 family, exact variant unavailable) built both revisions, ran the tests and scripted retail comparison, checked the logs and captured frames, and drafted this report. |
|
Test report, RTX 3090: with #1055 + #1102 ported, the block-compressed textures the title's material records name hold the title's bytes on the GPU; those still zero were all evicted by the page budget. This agrees with @MKmajster's textured frames on the RTX 3070 above, checked here texture by texture. Setup
Measured in the captures (block-compressed textures named by the material records of the frame's mesh draws):
AI use: Claude Code (Claude Opus 5.5 coordinating; Claude Opus 5.5 agents ported the two PRs, wrote the capture fields and the replay, and ran the tests and replays; the base tree was assembled earlier by Claude Fable 5.2 agents). The coordinating session ran the in-title runs, looked at the albedo image, and checked the log lines and per-class texture counts quoted here; the byte-for-byte comparison is from the agent's notes. |
|
Test report: with #1055 + #1102 the title's Base:
Each run reached the opening credits (credit text in dumped frames). Runs 48 and 50–52 presented until 237–299 s, at the end of their time limit. On Not established: how the page mappings prevent the removal, and whether they prevent it or only delay it past 300 s. Small samples (4 runs with, 2 without), one GPU and driver. No 3D world scene appeared in any dumped frame behind the credits; the background was grey (run 50 at 106 s showed a garbled tile mosaic, run 52 at 261 s a title art card). AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on the machine above, read the logs and wrote this report. |
bmjask
left a comment
There was a problem hiding this comment.
P1: recheck_source changes e.src but leaves gpu_written and LAST_CONTENT. After a GPU-written texture remaps, refresh_once filters a subsequent CPU write to the replacement page as GPU-owned, leaving GPU data stale/zero. Clear ownership/hash on source change and bind GPU-write claims to current source. P1: Source::Pages::bytes unconditionally allocates vec![0;len] even for contiguous runs, on hashing/detiling submit paths; large streamed textures caused reported allocation aborts/severe allocator cost. Add borrowed contiguous fast path and bounded/scatter-gather scratch for fragmented spans. Also consider caching mirror_source/VirtualQuery across a recheck pass.
The record of the queue's page-mapping method keeps, for each GPU-view page it named, where XCL keeps the shown physical page's bytes. XCL moves those bytes whenever the title maps the page at another address or unmaps it (one place per page), so the place has to follow, on the moving thread and before the memory the page leaves can go: otherwise a reader of the record (and, later, a tile linked to the place) reads an address that was decommitted under it. mirrors::page_at(page, at, tile) moves the place of every GPU-view page that shows the physical page (the reverse index by_page), with by_at and the 16 MiB block counts; its call and its place in the log stay - a move is no change of what the page shows - unless the page gets its first place or loses it (its bytes appear or go). One atomic load while nothing is recorded, and a read-locked lookup before the write lock. mirrors::page_freed(page): the pages that showed a freed page show nothing (a change). kernelx::page_placed calls page_at with the tile flag (a home, unified memory or a graphics reservation) and notes a moved page as a known write at its new address (title_textures::note_known_write): a CPU write made just before the move went with the page. Called, with AWAY held: in move_away after the copy and before release_at, in unmap_away in both branches (before the release), in map_pages at the lazy insert, after the copy from home (before move_home_away can give the home back) and in the zero branch; FreeTitlePhysicalPages calls page_freed for every page of the call. Still not reached by the runtime: the record stays empty until the queue method is turned on. Tested: cargo check -p xcl --tests (no new warnings); cargo test --release -p xcl --lib hle::kernelx: 55 passed, 0 failed, 1 ignored, including the new a_gpu_view_page_follows_its_physical_page (mapped elsewhere, unmapped home with its bytes, mapped at the CPU view's same offset, a page never used mapped elsewhere, a move keeping call and log entry, freed pages showing nothing). Builds on xcl-dev#1102 by Xeltax (c387de2): the reverse index physical page -> GPU-view pages and its hook points (unmap_away, FreeTitlePhysicalPages, map_pages). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What the textures need from the record of the queue's page-mapping method, ahead of their use: which GPU-view pages show something else now, and which GPU-view pages a CPU write reaches. mirrors::changes_since(seen, lo, hi, most) walks the record's log from a reader's cursor: each GPU-view page in [lo, hi) whose content changed (a mapping, an unmap, a free, a page that gets or loses its place), once, with the call that changed it last, in the order of the last change, at most `most`, and the next cursor. Nothing is drained, so each reader keeps its own cursor; one atomic compare when nothing changed. A move is not in it. The changes do not go through GPU_VIEW_MAP_LOG: a change there bumps gpu_view_map_gen, which empties every recording thread's ask cache at every call of the method, and its 4096 entries overflow into a recheck of every texture, each with a VirtualQuery. mirrors::views_of_written(dirty, out): for each written 64 KiB page, the written 4 KiB pages at every GPU-view page that shows the page kept there (the place index by_at), and, for the CPU view of a pair, at the GPU-view page of the same offset when the method never named that page (it shows the CPU view, and keeps today's write tracking); a mapped or unmapped GPU-view page gets nothing from the CPU view under it. One STATE take to copy the pairs, then one PAGES read. shown_blocks (the 16 MiB blocks that hold a place), shown_gen and moved_pages. Not called yet. Tested: cargo check -p xcl --tests (no new warnings); cargo test --release -p xcl --lib hle::kernelx: 57 passed, 0 failed, 1 ignored, including the new changed_gpu_view_pages_are_told_once_in_order (a call of three pages, a remap told again last with its new call, a move told not at all, a page changed twice told once, one at a time, the range, a released view) and a_write_where_a_page_is_kept_is_a_write_to_the_views_showing_it (one page at two view pages, nothing at the address it left, the CPU view under a page never named, mapped or unmapped, the blocks). Builds on xcl-dev#1102 by Xeltax (c387de2): the idea of a list of changed pages that the textures read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kept A texture placed in a GPU view whose pages the queue's page mappings named was read at the CPU view's same offset (or, with a page mapped at the address itself, after a VirtualQuery there). The pages the title mapped into the view are kept elsewhere: in the pool, at their home, or wherever the title mapped them last. Such a texture now keeps its own address as its source (Entry::paged, found by mirrors::touched with no AWAY and no VirtualQuery) and every upload carries a table of where its 64 KiB pages are kept (texture_upload::PageMap, from mirrors::resolve once per due texture). A read takes no lock: one ReadProcessMemory per 64 KiB piece for a mapped page (copy_or_zeros: a physical page is committed whole or not at all), zeros for a page that shows nothing, and today's read for a page the method never named. The comparison of written pages, the detile of the upload, the level-pages check, the frame trace sample and the probe read through such a table; a paged texture counts as watched for the streamed recheck and skips written_pages; a source in a view window adds no coarse watch block. The kinds of the pages read are counted (page_counts). A texture over pages the method never touched takes today's calls unchanged. Tested (cargo test --release -p xcl --lib, software adapter): new texture_upload::tests::an_upload_reads_pages_kept_apart and title_textures::tests::a_texture_over_mapped_pages_is_read_where_they_are_kept; gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes gains a texture registered over a page the queue's page mappings put in the GPU view, which reads the pool page (ran on WARP). Modules texture_upload and title_textures: 42 passed, 0 failed, 0 ignored. Builds on xcl-dev#1102 by Xeltax (c387de2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the queue's page mappings put another page under a texture read through its pages, nothing was written: no write watch fires for a clean, already filled pool page that is newly mapped, so the texture kept the bytes of the page that was there before. recheck_gpu_view_sources now also reads the GPU-view pages whose mapping changed (mirrors::changes_since, 512 a submit: one upload batch; the rest at the next), with one atomic compare when nothing changed. It does not go through GPU_VIEW_MAP_LOG: that bumps the generation that empties every recording thread's ask cache, and its log of 4096 entries overflows into a recheck of every texture. A texture becomes paged when a page under it is first named (pending, as on today's source changes). For a paged texture that is not pending the changed pages' bytes are stale: texture_upload::stale joins them into what goes up again, and the existing AGAIN path sends them with no comparison; the page hashes come to what went up. A shadowed texture is made pending instead. The GPU's write of a texture is noted per PC list as it is recorded (note_gpu_write gains the list) and stamped when the list is submitted (Entry::written_call = mirrors::calls()). A mapping changed by a later call clears gpu_written and sends its pages; one changed before the submit leaves the texture the GPU's. A list submitted again is stamped again; a reset list writes nothing more. Textures read again are counted (rereads). Tested (cargo test --release -p xcl --lib, software adapter): new title_textures::tests::a_gpu_write_counts_from_the_submit_of_its_list; gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes extended with a clean pool page newly mapped, a remap to equal bytes, an unmap and a mapping again (ran on WARP). Modules texture_upload and title_textures: 43 passed, 0 failed, 0 ignored; list_x: 29 passed, 0 failed, 0 ignored. Builds on xcl-dev#1102 by Xeltax (c387de2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Xeltax, two things about 1. A crash when the title frees a page during the read. At 2. What we run locally, in if at != 0 && s < e {
read_committed_into(at + (s - r_off), &mut out[s - off..e - off]);
}A test for 1, which faults on /// A texture's page runs are read while another thread decommits and commits their pages.
#[test]
fn page_runs_are_read_while_their_pages_are_freed() {
use std::sync::atomic::AtomicBool;
use windows_sys::Win32::System::Memory::{VirtualAlloc, VirtualFree, MEM_COMMIT, MEM_DECOMMIT, MEM_RELEASE, MEM_RESERVE, PAGE_READWRITE};
const PAGE: usize = 0x10000;
unsafe {
let base = VirtualAlloc(std::ptr::null(), 4 * PAGE, MEM_RESERVE, PAGE_READWRITE) as usize;
assert!(!VirtualAlloc(base as *const c_void, 4 * PAGE, MEM_COMMIT, PAGE_READWRITE).is_null());
std::ptr::write_bytes(base as *mut u8, 0x5A, PAGE);
let stop = Arc::new(AtomicBool::new(false));
let seen = Arc::clone(&stop);
let freeing = std::thread::spawn(move || {
while !seen.load(Ordering::Relaxed) {
VirtualFree((base + PAGE) as *mut c_void, 3 * PAGE, MEM_DECOMMIT);
VirtualAlloc((base + PAGE) as *const c_void, 3 * PAGE, MEM_COMMIT, PAGE_READWRITE);
}
});
let src = Source::Pages(vec![(0, 4 * PAGE, base)].into());
for _ in 0..2000 {
let b = src.bytes(0, 4 * PAGE);
assert!(b[..PAGE].iter().all(|&x| x == 0x5A));
}
stop.store(true, Ordering::Relaxed);
freeing.join().unwrap();
VirtualFree(base as *mut c_void, 0, MEM_RELEASE);
}
}With the change, the whole suite passes on our tree: Not checked: your tree as it is (the crash and the timings are from our merge); AMD. AI use: Claude Code (Claude Opus 5.5) found and measured both on my PC and wrote this. |
Stacked on #1055: only the last commit (
59042fd) is this PR. I'll rebase it once #1055 is merged.A texture in a GPU view now reads each of its 64 KiB pages from what queue #31 (
CopyPageMappingsBatchX) mapped there:On the retail title of #505 about 43% of the mapped pages had their physical page at the pool address, while the texture read the CPU view's same offset. That offset is not committed, so those parts of textures went up as zeros (#1031, the correction there).
What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs:Sourcereplaces the single address a texture was read from. It is either one address (At, as before) or runs of the texture's bytes from several addresses (Pages; address 0 means zeros). Uploads, the unchanged-content check, the detile and the write watch all go through it.source_of(va, len)builds it. A texture whose pages form one run comes back asAt, so it costs what it did before. A texture outside GPU views, or one whose pages the method never mapped, isAt(mirror_source(va))as before.recheck_gpu_view_sourcesre-reads the source only of the textures on pages the method changed, or whose physical page moved (mirrors::take_changed, found throughby_va). Looking at all of them took 225 ms on 64k textures, and the method is called hundreds of times. A change ofgpu_view_map_gen(physical pages mapped into a GPU view directly) still looks at all of them, as before.crates/xcl/src/hle/kernelx.rs,mirrors:page_moved(page)is called where a physical page is mapped, unmapped (unmap_away) or freed, so a texture follows its page when the title maps it into the CPU view too.a_page_mapped_texture_is_read_page_by_page: runs, zeros, the CPU view for untouched pages, one run as one address, the watched ranges and the dirty check.gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesgets three steps on the GPU, each read back from the PC texture:source_ofreduced to the oldmirror_source(checked).On the retail title (
main67a3735+ #1055, with and without this PR; RTX 4080; A pressed throughXCL_PRESS_AT; one run each)Textures whose memory is all zero.
XCL_TRACE_FRAME=1logs how many textures are all zero in 16 samples of 4 KiB over their memory. The snapshots don't fall at the same moments in the two runs:A texture can be zero on purpose, so this is a trend rather than a count of fixed textures.
Nothing slower. Over the whole run (presents / submits / draws), and when the first
#101and the watchdog come:#10132,768+ textures were kept in step "with its pages", most of them as one run.
The run still ends at the title's watchdog (
+0x23cf683), as onmain. That stop is about stalled GPU work (Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505), not about textures.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on59042fd: 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
XMemMapPhysicalPagesinto the view): the method's mapping wins here, whichever came last.AI use
🤖 Generated with Claude Code