upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/xmem_test.cpp
AgeCommit message (Collapse)Author
9 daysd3d12, xmem: remove remap release and the console heap mirrorJan Trencansky
Both came in with #2350 as additions on top of stopgap mechanisms, broke world runs (remap release: a GPUVM page fault and a lost device; the mirror: a GPU hang) and were made opt-in by #2356. They go completely; with both variables unset, main behaves as before. Remap release (LEONIDA_GEOMETRY_REMAP_RELEASE, from 36771ec53): - xmem.cpp: RemapReleases, remap_releases_enabled() and the page recording in unmap_range_locked; the four call sites (XMemMapPhysicalPages, the scatter call, both copy_page_mappings). - xmem.h/xmem.cpp: the test seam rt::xmem::reload_remap_release_setting(). - xmem_test: test_remap_releases (and the title_geometry_watch.h include only it used). - README row, the docs/d3d12_vulkan.md paragraph; comments that named it. Console heap mirror (LEONIDA_HEAP_MIRROR, LEONIDA_HEAP_MIRROR_CHECK, from 746059011): - src/console_heap_copy.h goes. ConsoleHeap::copy is a plain std::uint8_t* again, written with memcpy/memset as before the mirror, including the zeroing site that #2350's merge of #2162 resolved as heap.copy.zero(); the compute-input probe reads it directly again. Without the mirror, view() was the copy itself, so nothing changes. - heap_mirror_enabled(), heap_mirror_check_enabled(), check_console_heap_mirror(), the per-heap check counters and log line, and the test API console_heap_mirror_mismatches() (d3d12_com.h). - Tests console_heap_copy, d3d12_console_heap_mirror, _off and _default with their CMake entries; README rows and the docs/d3d12_vulkan.md sentences. Kept, because other paths use them or main's behaviour with the variable unset depends on them: - LEONIDA_GEOMETRY_HOST and its DeviceState memory-type assert (dc9ef1a0b). - The final copy at retirement (GeometryViews::retire_range's final_copy, "copied at retirement" in the geometry buffers line): XMemFree of a title heap block (free_title_block) reports a release while the block's memory stays committed and readable, so that copy is still made without remap release. Comments now say that instead of naming remaps; geometry_views_test case 15 stays. - forget_pool_span and "retired with their copy" in the title memory line: any retirement (free, decommit, unmap) feeds it. - The release queue's joining of touching ranges (title_geometry_watch.h): unmaps report page runs too; geometry_views_test case 16 stays. - LEONIDA_CONSOLE_RELEASE_FILTER, which predates the mirror; its sweep reads the copy again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysxmem: read LEONIDA_GEOMETRY_REMAP_RELEASE once, with a test seam to read it ↵Jan Trencansky
again GetEnvironmentVariableA at every remap ran under g_phys_mutex in every scatter call; with it, xmem_test's split race ("the reader of the views' last pages never faults or misreads") failed in two full Wine runs in a row, where main passed it twice. The value is cached as before #2350's default changed; rt::xmem::reload_remap_release_setting lets test_remap_releases switch it. Two full runs since: no change against main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysxmem: a remap retires geometry copies only with LEONIDA_GEOMETRY_REMAP_RELEASE=1Jan Trencansky
Since #2350 a remap of physical pages that gives a page another frame retired the geometry copies over it, on by default. In the first world run of that main on an RX 7900 XTX (RADV) the copies were retired by the thousand (evicted 15010 in about 40 s) and the run ended in a GPUVM page fault (TCP read) and a lost device; the same build settings without it ran eight minutes with evicted 0 and no fault. A remap leaves the address valid on the console, so the title keeps using what names it, and not everything that names a copy's address is rewritten when the copy goes: - a root view is resolved while its list is recorded (d3d12_com.cpp, GraphicsCommandList::address); a list recorded before the retirement and executed in an ExecuteCommandLists begun after it is not among the replays the retirement waits for (kAfterExecutes covers only those in progress), so it reads the freed copy; - a placed buffer view written outside a console heap carries the copy's address for as long as the descriptor lives. The remap release is now off unless the variable is 1, read at every remap; the copies follow the new pages through the refresh, as before #2350. Freeing, decommitting and unmapping still retire copies. Tests: xmem_test test_remap_releases checks that a remap releases nothing by default and with 0, then the existing checks with 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysMerge #1972 from kurrutako: a slot-31 copy leaves the title's own mappings ↵Jan Trencansky
at the paired CPU range (RT-SLOT31-CPU-TWIN-TITLE-PAGES) Head 28fc0262d. Closed by its author as incomplete; merged because world run 41 had it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysMerge #2240 from zmasi: sync TitleTexture readability against ↵Jan Trencansky
title_memory_map between passes (RT-TITLE-TEXTURE-MAP-GEN) Head d088ea79b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysd3d12: geometry copies in system memory, and retired when the title remaps ↵Jan Trencansky
their pages Geometry copies held 4.4-6 GB of VRAM in world runs and were never evicted: a view retired only when its range was freed, decommitted or unmapped, and the title streams by remapping the frames of its pools. - LEONIDA_GEOMETRY_HOST (unset by default): 1 puts the copies in system memory outside VRAM, write-back where the device offers a cached host type; 2 write-combined. The memory type is picked among the host-visible types that are not device-local (memory_type_order alone would give the BAR first); a device with none keeps its types. Logged once and in the geometry buffers line. - LEONIDA_GEOMETRY_REMAP_RELEASE (on by default, 0 off): XMemMapPhysicalPages with pages, the scatter call and CopyPageMappingsBatchX report the pages whose frame changed (or went) as released (xmem's RemapReleases, collected under the fault lock, reported after it), so GeometryViews retires the copies over them through #2094's drain_released and kAfterExecutes reaping. A page mapped again to its own frame is no change. - A retired view is copied once more from its pages when they are readable: a list recorded before a remap that took the view's address reads the new bytes, as the refresh this replaces would have given it. - A stream-pool extent backed by a retired copy leaves pool_spans (it was kept for the device's life). - A full release queue joins touching ranges before it collapses into one covering range. Tests: geometry_views_test cases 14-16, xmem_test test_remap_releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysSync title texture readability with map journal between refresh passesZack
Between periodic refresh_title_textures passes, synchronous slot-70 view creation and the async fill worker checked TextureReadability with a constant generation, missing title_memory_map range changes since the last pass. Track the map generation on TextureReadability and consult title_memory_map::changes_since outside refresh passes so unmapped or decommitted pages defer before hashing and newly mapped pages publish immediately without waiting for a submission. Also mark mix_words and hash_bytes LEONIDA_GUARDED_NO_BUILTIN using an unaligned 64-bit load so clang-cl cannot emit CRT memcpy calls inside the __try frame, and classify non-title read faults over unmapped title pages in xmem::physical_page_fault as FaultExit::passed_guarded.
10 daysxmem: a slot-31 copy leaves the title's own mappings at the paired CPU rangekurrutako
copy_page_mappings (queue slot 31, CopyPageMappingsBatchX) mirrors every page it maps or unmaps at a GPU-only destination onto the paired CPU range (title_gpu_views::to_cpu). It did so even where the title had mapped that CPU page itself with XMemMapPhysicalPages or XMemMapPhysicalPagesScatter: a copy replaced the title's page, and an unmap (kind 2) left the title's CPU page reserved. The title's next read of it faulted, and the run ended. The console's CopyPageMappingsBatchX edits only the GPU-only range's page table, so a CPU page holding a mapping of the title's (physical, scatter or a slot-31 copy onto that address) is now left as it is. Pages the mirror made itself, zero plants and pages with no mapping still follow the GPU-only range, so the D3D12 layer's reads at the CPU view keep working. Each page kept is counted and the first ones are logged. The unmaps these paths make are now labelled in the read-fault report (CopyPageMappingsBatchX unmap / paired CPU page / remap / hole, XMemMapPhysicalPagesScatter unmap / remap) instead of the default "unmap". xmem_test: test_copy_page_mappings_cpu_view now checks that a copy onto, and an unmap of, a GPU-only page whose paired CPU page the title mapped keep the title's bytes at the CPU page. Both checks fail on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysIntegrate post-story-load memory, queue and Vulkan runtime changesMoriz82
Preserve physical window aliases across remaps, order console list values, and replay bounded indirect graphics with captured draw state. Coordinate pipeline lifetime, texture refresh and queue teardown. Add synthetic CPU and GPU coverage for the integrated paths. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
10 daysMerge main (0aecc5efa: #984 and #968) into the #939 mergeJan Trencansky
main now holds the #984 merge (18a22c1ae) and #968, queue slot 31 as CopyPageMappingsBatchX. Two conflicts: the include list of d3d12_xs_device.cpp (both includes kept) and the call order in xmem_test.cpp (the two page-mapping tests of #968 run after test_physical_pages, after the early return of #939's file-pools mode). The slot 31 dispatch of #968 stays ahead of the presentation routes, so #939's rule for queue slots 30 to 32 on a device that had a presentation handler does not reach it where xmem is linked. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 daysMerge main (with #984) into RT-QUEUE31 (#968)Jan Trencansky
main now contains the #984 merge this branch was built on, plus its last commits (the five tests of #984 settled under Wine, and the title's hang watchdog staying armed by default). No conflicts: runtime/test/xmem_test.cpp and docs/d3d12_vulkan.md merged cleanly, with test_copy_page_mappings and test_copy_page_mappings_cpu_view each defined and called once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysMerge the #984 result as of 71a783e56 into the #939 mergeJan Trencansky
Fourteen commits the #984 merge gained after 8a242efeb: its own failing tests (xmem_test under Wine, check_tls_index0, vk_bindless_grow, xs_present_lazy_test), the console-heap probe and the poke experiment behind their switches, Python tool fixes, and the title watchdog default. No conflicts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 daysMerge the #984 result (main + RT-PROTON-STORY-LOAD) into #939Jan Trencansky
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the two solve one problem in two ways the base's is the frame and #939's plugs into it. A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease, raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages), the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in. A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow #939's rule that a device which ever had a handler has no queue fallback. B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h, pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad lists as triangle indices. B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list, shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch, executable shaders, default A8 views). C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h, rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp, replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the label fence on the base's submit. D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test, main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with #939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's answering first; --first-run-ui kept without host speech in its profile. E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py, scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the base's executable-shader step with #939's cache fix; 366 registered tests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 daysxmem_test: view checks that hold under Wine, and say what Wine cannot showJan Trencansky
Three checks of the physical-page views fail under Wine, two of them on main as well (xmem is a known Wine failure there) and one that #984 adds; with #984 registering the test twice more (xmem_write_watch, xmem_no_write_watch) that made three red tests. Measured under Wine 11: a page of a reserved section view that has been written and reads back is still reported by VirtualQuery as MEM_RESERVE with protection 0 (type MEM_MAPPED, allocation protection PAGE_READWRITE), where Windows reports MEM_COMMIT and PAGE_READWRITE. - 'unmapping one of them afterwards keeps the others' memory' (#984) asked whether the neighbours were still mapped through reserved_only(), which is the reported state. It asks for the view itself now (in_view: the region's type is MEM_MAPPED), which is what the check is about, and also that the unmapped page is no longer in one. Same on both hosts. - The two checks of the reported state and protection of a written view page print SKIP with the reason when the host is Wine and gives exactly that answer; the first then still checks that the page is a read-write view holding what was written. On Windows both run as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 daysxmem: map slot-31 copies at the GPU-only range's paired CPU view tooJan Trencansky
Applies the fix oscarlosu-lab proposed on #968: https://github.com/ubiquitarianism/leonida/pull/968#issuecomment-7142206199 What was wrong: queue slot 31 (CopyPageMappingsBatchX) targets the title's GPU-only reservation, but the D3D12 layer reads that memory at its paired CPU view (title_gpu_views::to_cpu). copy_page_mappings mapped the pages only at the GPU-only address, so the paired CPU view stayed reserved and the layer's reads of that memory (the slot-70 views waiting for readable memory) never became possible. The change, in copy_page_mappings: - when the destination is in a paired GPU-only range and its CPU range is a physical-page window, every page mapped or unmapped at the destination is mapped or unmapped at the CPU address as well, with that window's protection; - a source page not mapped at a GPU-only address is looked up at its CPU address. Cost: a second view per copied page, so such a page is mapped at three addresses (pool, GPU-only, CPU) and counts as aliased: the shadow tracker copies it at every submission. Risk: the pairing is a heuristic (the CPU reservation of the same size made just before the GPU-only one); if it is ever wrong, the mirror replaces the title's own mappings in that CPU range. The comment reports 9 alias checks but does not give them, so the test is new: xmem_test's test_copy_page_mappings_cpu_view reserves a CPU + GPU-only pair and checks that after a batch copy onto the GPU-only range the CPU range is committed and shows the same bytes (and a write there is one memory with the pool), that a GPU-only source mapped only at its CPU range is found there, and that a null source unmaps both ranges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysMerge main with #984 into RT-QUEUE31 (#968)Jan Trencansky
Merges the local m984-on-main (1d89b20c5f26f1078b50fef7e2c9cd5fbe2372d6), main with #984 merged, into #968's head f2268abea. Conflicts and their resolutions: - runtime/shims/xmem.h: both sides appended to the end of rt::xmem. Kept geometry_aliases and transfer_physical from #984 and appended #968's CopyPageMappingsFn typedef and the inline copy_page_mappings_fn after them. - runtime/shims/xmem.cpp: copy_page_mappings and the self-registering g_copy_page_mappings_set stay right after XMemMapPhysicalPagesScatter, followed by #984's shadows_write_watch. One-line port: #984's g_mapped stores the page number itself (HostUnorderedMap<uintptr_t, uint64_t>), so `it->second.page` becomes `it->second`. - runtime/shims/d3d12_xs_device.cpp: - includes: #968's "xmem.h" beside "d3d12_trace.h", then #984's includes; - constants: #984's block kept, kQueueCopyPageMappingsBatchX = 31 added after kQueueExecuteCommandListsX and its static_assert; - the slot-31 section (ConsolePageRange/Batch, copy_console_page_range, queue_copy_page_mappings) goes after #984's queue_execute_command_lists and before the "PresentX is at queue slot 30" comment; - child_slot: #984's queue block kept; the slot-31 dispatch (beyond the PC table and with xmem's hook set) goes just before the qroutes lookup, ahead of the presentation routes and the console-only S_OK tail. Newer-layout PresentX is 32, so 31 does not clash. - runtime/test/xs_proxy_mock_test.cpp: - includes: "../shims/xmem.h" beside #984's d3d12_xs_frame_events.h; - #984's descriptor-heap and later checks kept, check_queue_copy_page_mappings after them. Without xmem the merged proxy answers slot 31 with the console-only S_OK, so that check's `== E_NOTIMPL` becomes `== S_OK` (and its summary line says so); - main: `|| check_queue_copy_page_mappings()` appended after check_presentation_wiring(). runtime/test/xmem_test.cpp merged without conflict: test_copy_page_mappings runs after test_physical_pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysMerge main into RT-PROTON-STORY-LOAD (#984)Jan Trencansky
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted; this commit is the resolution only. Build and test repairs follow in their own commits. Rule of resolution: where both sides added different things, both stay; where both made the same change in two forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two changed the same code for different purposes, both purposes are kept. Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, registry.cpp): - d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and list slot 139 (#396). - Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider pc_resource_desc, S_OK for queue slots past the PC table. - Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base list proxy, its null-view slot 70 and its refusing slot 133. Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp): - Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra cases added; main's --env-slots-74 and #984's --env-slots-70. - Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy, the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases. D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h, frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp, d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp, vk_pipeline_check.cpp, vk_test_device.h): - Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's origin, so both pools run on disjoint sets of textures. - frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter. - main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4 stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980). - shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it. - Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it. Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp, runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp): - ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file. - gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries. - Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped. Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1, make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py, runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md, runtime/README.md): - Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake. - rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped. - shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags. - shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants. One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
11 days[integration] Linux/Proton and native Windows: boot through the story load ↵Moriz82
(RT-PROTON-STORY-LOAD) One squashed commit of a fork that was developed on a Linux/Proton machine and tested on two native Windows machines. On all of them the retail 1.0.2.1 package now launches, shows its launch movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its artwork, and enters the world phase. A first world frame is not verified yet. docs/linux_proton.md has the setup, a healthy boot's timeline, the machines and where it stops. Runtime: frames in the title's own window; DirectStorage pinned reads, page-list scatter/gather, BCPack and unshuffle with a locally generated predictor file; pooled, device-local and deferred image backing for streamed and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table that degrades instead of refusing a submission; a descriptor hash finalizer (off until a library carries it); directly indexed heap offsets for compute dispatches and VS/PS/GS draws; title buffer windows outside a fragmented arena; opt-in device-local copies of streamed buffer views; write-fault retries under the tracker lock, shared trackers and write-watched title memory for native Windows; device-loss, compute-input and memory probes. Translator: loop bounds at structured exits, the eight FidelityFX programs that use a packed-dot form the disassembler skips, buffer bounds modes per view kind, a compaction option, the hash finalizer option. Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows boot script, the paired compute translation script. No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted by people on the machines named in docs/linux_proton.md. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
11 daysd3d12_xs: queue slot 31 is CopyPageMappingsBatchX, mapped through xmem ↵CLHelper
(RT-QUEUE31) The retail title calls its command queue's slot 31 (game_scarlett_master.exe+0xf2cc7f) with a batch count, 24-byte batches {destination, range count, ranges}, the base and page count of its physical-page pool, and 0. Each 12-byte range {kind, start, count} maps pool pages at the destination: 0 a run, 1 one page repeated, 2 unmapped, 3 unchanged. main refused the slot with E_NOTIMPL; the title does not test the result and goes on to read the destinations. Each range now reaches rt::xmem::copy_page_mappings_fn, which maps the physical page behind every source page at its destination page (a second view of the same section, so both addresses are one memory) and unmaps where the source has nothing or the kind is 2. The hook is set by xmem.cpp; tests that compile the proxy alone keep the old refusal. Tests: xmem_test (a run, one page repeated, an unmapped source page, a null source, an overlapping range, bad addresses) and xs_proxy_mock_test (the four kinds, a range past the pool, an unknown kind, xmem refusing, no xmem). AI-assisted.
11 daysruntime: connect native pipelines and title resources to the offline ↵Rain156
first-run UI Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic. The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
11 daysruntime: honor LEONIDA_TITLE_MEMORY_MB in XSystemGetAppMemoryUsageLimit and ↵Juju
XMemGetWorkingSetStatistics
11 daysxmem_test: the write-combine window's page is written before its view is queriedMumogg
main's xmem commits a physical page on first touch, so the check added with the view-protection fix has to touch the page first, as the read-write case above it does. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
11 daysxmem: map physical pages without a cache modifier in the view protectionhcristosm
Three of the retail executable's five physical-page windows carry 0x400 (PAGE_WRITECOMBINE on the PC) next to PAGE_READWRITE. host_protect drops only the PAGE_GRAPHICS_* range, so map_page passed PAGE_READWRITE | PAGE_WRITECOMBINE to MapViewOfFile3, which refuses it with ERROR_INVALID_PARAMETER: the first XMemMapPhysicalPages into such a window failed and the title's descriptor-heap setup returned false. view_protect now drops PAGE_WRITECOMBINE, PAGE_NOCACHE and PAGE_GUARD. xmem_test maps a page into a window reserved with that protection. AI-assisted. (cherry picked from commit 7e8e3c1db1dc3c4c44cc56e2e586f99de2e65ae2)
12 dayslocal: merge #7584 (docs conflict: ours)Mumogg
12 daystest(xmem): multi-page unmap across views, remap inside a live run, freed ↵Gustavo Kissel
page refused The coverage gaps isfcrctfs listed on #7584.
12 daysfix(xmem): cap host views at 1024 pages so a single-page unmap stays cheapGustavo Kissel
unmap_range splits a view by unmapping it and remapping both sides; with one view per run that cost grew with the run (review on #7584). Capping views at 64 MiB bounds it.
12 daysxmem: judge a fault on a committed page by the protection at the faulting ↵Logan
address The handler queried the protection at the start of the 64 KiB page, so a write to a 4 KiB part the title had made read-only looked allowed and was resumed, faulting again forever instead of reaching the title's own handler. It now looks the record up by the page and the protection up by the faulting address. xmem_test writes to a read-only 4 KiB part of a read-write page and expects the fault.
12 daysxmem: map a run as one view per host placeholder it spansGustavo Kissel
After a partial unmap or remap, a run of consecutive pages can lie across several host placeholders, and MEM_REPLACE_PLACEHOLDER needs the view to fill one placeholder exactly, so mapping the whole run again failed with ERROR_INVALID_PARAMETER. map_view now maps one view per placeholder the run spans; a fresh window is still one view. Found and fixed by dotaku22 in review; xmem_test gains their check (the whole run maps again over a split range).
12 daysxmem: take the fault lock before reading or changing a mapped page's recordLogan
unmap_page moved the record out of g_mapped before taking the exclusive lock, so a first-touch fault on that page could read a moved-from section, and map_page made the view live before recording it, so a fault in between was not recognised. unmap_page now holds the exclusive lock from the lookup to the erase, and map_page holds it across mapping the view and recording it. xmem_test adds four threads writing into a window while 256 slices of pages are mapped and unmapped under them. Reported by tupacfan04 in the review of #7556.
12 daysxmem: rt::xmem::commit_physical_pages commits pages by page numberLogan
A writer that copies into physical pages through its own view of their section (a DirectStorage destination given as page numbers, #7652) sees reserve-only memory for pages the title has not touched yet, and no fault handler can resolve that address. commit_physical_pages commits the given pages through each section's own view, one VirtualAlloc per contiguous run, so such a writer can commit before it copies. Raised by nurtrino in #7599.
12 daysxmem: map consecutive physical pages as one view, so a 100,000-page ↵Gustavo Kissel
XMemMapPhysicalPages fits the title's hang watchdog under Wine One view per page cost a placeholder split and a MapViewOfFile3 per 64 KiB page. Under Wine that took 0.36 ms a page and more as views accumulate; the retail boot's 99,776-page call ran past the title's 30-second hang watchdog. Consecutive pages of one allocation now map as one view. A page remapped or unmapped later splits its view and the neighbours are mapped again from the same section.
12 daysxmem: commit physical pages on first touch, not when they are allocatedLogan
XMemAllocatePhysicalPages backed each call with one SEC_COMMIT section, so the title's ~6.1 GiB page-pool request after boot stop 17 was charged in full at once and fails with ERROR_COMMITMENT_LIMIT on a 16 GB machine. Mapping the pages right away (as the title does) would charge most of it within seconds too, so the commit now follows first access. The section is SEC_RESERVE. A vectored handler commits the faulting 64 KiB page through a reserve-only view of the whole section when the address lies in a live mapping, so every view of that page sees it. Faults on committed pages whose protection forbids the access, and faults outside the mapped pages, go on to the next handler, and a failed commit is not swallowed. rt::xmem::commit_physical_range commits a range up front for shims that hand guest memory to the kernel. Reported by controldebils and rafaelpssz in #7333.
12 daysxmem: map physical pages without a cache modifier in the view protectionhcristosm
Three of the retail executable's five physical-page windows carry 0x400 (PAGE_WRITECOMBINE on the PC) next to PAGE_READWRITE. host_protect drops only the PAGE_GRAPHICS_* range, so map_page passed PAGE_READWRITE | PAGE_WRITECOMBINE to MapViewOfFile3, which refuses it with ERROR_INVALID_PARAMETER: the first XMemMapPhysicalPages into such a window failed and the title's descriptor-heap setup returned false. view_protect now drops PAGE_WRITECOMBINE, PAGE_NOCACHE and PAGE_GUARD. xmem_test maps a page into a window reserved with that protection. AI-assisted.
12 daysxmem: physical pages, default allocators, XMemIsToolsMemAvailable; ↵NiiRoZz
XMemVirtualAlloc takes 2 MiB pages and placeholders (#6919) Squash-merged after diff review of PR #6919
12 daysxmem: record XMemVirtualAlloc's attribute word and drop the PAGE_GRAPHICS_* ↵quackottu
protection bits (retail exe GPU pools) (#6908) Squash-merged after diff review of PR #6908 - xmem: record XMemVirtualAlloc's attribute word and drop the PAGE_GRAPHICS_* protection bits (retail exe GPU pools)
12 daysxmem: serve XMemTransferMemory (RT-449) (#6351)cynbun
Squash-merged after review of PR #6351 - xmem: serve XMemTransferMemory (RT-449)
12 daysRuntime test clashes: typeless clears accept WARP's nearest-even tie (#521), ↵ItsNotRexed
three close-parity copies now match WARP, the source-size checks start from 300x200 again after ResizeTarget, one test_attribute_trace in xmem_test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #2401 from Sc4rosItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge remote-tracking branch 'origin/main' into triage-r43ItsNotRexed
# Conflicts: # docs/runtime_imports.md # runtime/CMakeLists.txt # runtime/shims/xgameruntime.cpp # runtime/test/xmem_test.cpp # tools/rdna2spirv.py
13 daysMerge pull request #3401 from 0xTehutiItsNotRexed
13 daysRuntime: record each distinct XMemAlloc/XMemFree attribute word in --traceSc4ros
xmem.cpp ignores the attributes argument, and the bits of the Scarlett XALLOC_ATTRIBUTES word are not known yet. With gta6rt --trace FILE, the first XMemAlloc and the first XMemFree for each distinct raw attribute word now write an "xmem_attributes" event (api, the word, the size for an allocation, the caller as module+RVA), so the bits can be decoded from a real run without logging every allocation. Off: one relaxed load per call. xmem_test opens a trace and checks one event per word and API, the size of the first call, a caller on every event, and nothing recorded while the trace is off. README.md documents the event. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 daysSeven fixes from an outside contributor (sent as patches, applied without ↵ItsNotRexed
the author's name) - rdna2spirv: declare each packed vertex input register once; a register whose elements disagree on the component type is refused (SHADER-644). - runtime: a title's VirtualAlloc drops the console's MEM_GRAPHICS / MEM_TITLE type bits the host rejects (RT-217). - runtime: XPersistentLocalStorageImpl is served from <overlay>\persistent with the package's 2048 MB quota (RT-219; layout from the public docs, not measured in a caller). - runtime: G:\ names the package and T:\ a scratch folder in the overlay; paths under the configured folders and every path with no folders configured stay host paths (RT-218). - winhttp_offline: header blocks and timeouts the host WinHTTP rejects are rejected the same way. - cfg_structure.run: a limit of zero or less runs no blocks. - shader_meta: an s_movk_i32 with a register operand and a float immediate beyond float32 are left unknown instead of raising. Each comes with a test that fails on the old code. Conflicts with main resolved here (internal_dir() hides T:'s folder; both file_system_test blocks kept). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysxmem: strengthen registry +0 test against ullTotalPhys and qualify telemetry ↵0xTehuti
evidence (RT-220)
13 daysxmem: write title memory limit at +0 in XMemGetWorkingSetStatistics (RT-220)0xTehuti
13 daysRuntime: record each distinct XMemAlloc/XMemFree attribute word in --traceSc4ros
xmem.cpp ignores the attributes argument, and the bits of the Scarlett XALLOC_ATTRIBUTES word are not known yet. With gta6rt --trace FILE, the first XMemAlloc and the first XMemFree for each distinct raw attribute word now write an "xmem_attributes" event (api, the word, the size for an allocation, the caller as module+RVA), so the bits can be decoded from a real run without logging every allocation. Off: one relaxed load per call. xmem_test opens a trace and checks one event per word and API, the size of the first call, a caller on every event, and nothing recorded while the trace is off. README.md documents the event. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 daystest: cover XMem virtual allocation APIsedupode
13 daysFSR: Xbox backend descriptor, console command-list map, ↵omardev29
XMemGetWorkingSetStatistics and device slot 67 amd_fidelityfx_upscaler_xbox.dll, measured with Ghidra 12.2 (through REA) and run by fsr_dispatch_test on PC devices (RTX 2000 Ada and WARP) behind the Xbox-ABI proxy. Backend descriptor: the provider's create walks the chain for type 0x01000002, {header, device} with the device at +0x10, and ends in FFX_API_RETURN_ERROR without it (what RT-3 got with 0x0200000x). With it the DLL creates its backend through the proxy: device slots 14, 15, 18, 19, 27, 38 and 76 and heap slot 9, at the shapes the PC order and the measured overrides predict; slot 76 takes the seven CreateCommittedResource arguments. No earlier test here reached slot 76 or heap slot 9. Two runtime bugs it found: - XMemGetWorkingSetStatistics takes (kind, stats*): all seven call sites pass kind 0x20000001 in ECX and a stack buffer in RDX. The one-argument shim wrote to address 0x20000001. - Device slot 67 is a console-only compute-pipeline call (a code blob in its desc), not the PC CreateProtectedResourceSession1 the proxy forwarded it to. The proxy now refuses it (E_NOTIMPL). The context: on the RTX 2000 Ada the create stops at the DLL's HRESULT check, because the driver refuses its R9G9B9E5_SHAREDEXP texture with ALLOW_UNORDERED_ACCESS (WARP takes it). The test reports that stop and retries with one PC stand-in (that texture as R32_UINT). On the context it records one ffxDispatch into a logging command list that is never executed. The console command list, from that run and the DLL's recorder (RVA 0x59a0), the same 13 calls on both devices: slots 14, 15, 25 and 26 at their PC positions, then SetDescriptorHeaps at 32 (PC 28, seen in the run), SetComputeRootDescriptorTable at 35 (PC 31), ClearUnorderedAccessViewUint at 53 (PC 49, seen in the run), ExecuteIndirect at 61 (PC 59), and console-only methods at 85 and 141. 33 and 41 fit SetComputeRootSignature and SetComputeRootConstantBufferView by shape; the docs mark them inferred. The logging list forwards only measured slots. The list object also carries a write cursor and limits (+0x18, +0x28, +0x30) the DLL writes root arguments and dispatches through while there is room; with the cursor at the limit every command takes the vtable. These are the fields docs section 3.4 measured in the BVH builder without a meaning. The dispatch stops at the DLL's compute pipeline: its 29 shaders are DXBC with an ACCC part (payload tag FSPX) and no DXIL, and the PC runtime refuses them at slot 62; the dispatch goes on with the null pipeline and faults, which the test reports as the documented PC limit. Its C++ `throw` also shows the loader gap: _CxxThrowException finds no image base for a manually mapped image. The test's fault report gives the faulting module and RVA, the access, the C++ throw's ThrowInfo, image base and unwound stack, and the HRESULT the DLL formatted with the DLL frames that made the failing call. Docs: d3d12_vulkan.md Appendix A.3 and open question 2, d3d12_command_objects.md 3.4 and 3.5a, design.md and runtime/README.md.
14 daysRuntime: tests for the measured xmem shim ABIKam471