Repository navigation
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Audited and verified. Clean-room compliant.
- Coalesces contiguous physical page mappings into single virtual memory placeholder view mappings via map_view_run in runtime/shims/xmem.cpp.
- Handles partial unmapping inside coalesced views by splitting into prefix/suffix views.
- Test coverage in test_coalesced_run_partial_unmap (xmem_test.cpp) verifies preservation of unmapped/remapped physical backing.
|
Independently tested All 11 new XMem checks pass, The mapping improvement is substantial (4,096 pages: 150.65 ms → 0.60 ms), but I found a significant bulk-unmap regression:
The remap race test also increased from 249 ms to 2,404 ms. The apparent cause is page-by-page Could we introduce a range-aware unmap helper that unmaps each intersecting view once and reconstructs only surviving prefixes and suffixes? That should preserve the mapping speedup without introducing the bulk-unmap regression. |
|
Implemented
AI-assisted: yes |
|
Tested
The wineserver's side of the stall, which I have not seen posted: sampled once a second from outside the sandbox ( One of the four runs had #939's file-backed section switched off ( Not checked here: |
|
Correction to my comment above: the two runs with this pull request presented 5,473 and 6,055 frames, not 10,946 and 12,110. Each present writes two trace lines that contain |
|
Closing as superseded — coalesced physical page views and range-based |
…nt 2D mip loads, Win11 timer opt-out Translator (tools/rdna2spirv.py) - ubiquitarianism/leonida#1585 (whoalin1, GPL-3.0): the low-16 mask of every int-derived value merged into a preserved 16-bit half is OpBitFieldUExtract (base 0, count 16), not OpBitwiseAnd & 0xFFFF, which NVIDIA's compiler miscompiles (the kept high half corrupted). Six sites: VOP3 16-bit integer results, mad_i16/u16, min/max/med3, signed cvt_i16_f16 / cvt_norm_i16_f16, signed saturate_int16. Two tests that pinned the old shape updated; new tests/semantic/test_nv_and16_extract.py (shape census + interpreter values, negative control; fails on the previous translator). - ubiquitarianism/leonida#1572 (tedin7, GPL-3.0), refined: 2D image_load_mip with glc reads the coherent storage view for mip 0; any other mip takes the sampled fetch at that level instead of upstream's zero-fill, which is only right for a single-level T#. Other dims and tfe/lwe stay Unsupported. CoherentMipLoad tests + spirv-val on four forms; design.md row updated. Decoder (tools/rdna2_decode.py + native port) - ubiquitarianism/leonida#1525 / #1524 (GPL-3.0): inline constants 240..248 on 16-bit integer operands decode to their binary16 patterns (LLVM printImmediateInt16), so the translator no longer reads f32 bits there; ds_condxchg32 keeps one offset; ds_swizzle omits offset 0 and prints ROTATE/FFT as LLVM does. Ported to tools/rdna2_decode_native (tables passed through the blob, _src_is_int16 added to the fingerprint). Runtime (runtime/src/main.cpp) - FVF-07, after ThatRecompDev/five-star-recomp@344f05b (GPL-3.0): ScopedTimerResolution also opts out of Windows 11 timer-resolution throttling (PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION) and hands it back to the system with timeEndPeriod. Guard only: Marvisak/VIctory#2091's Wave32 scalar-mask fix is already how this translator works (EXEC is a per-lane flag, scalar ops unmasked, wave-uniform branches); tests/semantic/test_wave32_scalar_mask_branches.py pins it. Skipped: ubiquitarianism/leonida#742 (XMem view coalescing). Natively it saves about 230 ms once at startup (99,776 per-page views 233 ms vs 4 MiB views 4 ms), but every partial unmap would then tear down up to 63 neighbouring pages, including GPU host-pointer imports and pages under in-flight I/O. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h commit (#1707), MSVC SEH helpers (#1499) Wave 9A (GPL-3.0 direct adaptations from ubiquitarianism/leonida): - ProjectLeonida/mandy#742 (madhyn): coalesce contiguous physical-page runs into single MapViewOfFile3 views in XMemMapPhysicalPages and copy_page_mappings, splitting multi-page views on partial unmap/remap, coalescing split placeholders on remap, and avoiding O(N^2) splits during TitleVirtualFree window teardown. Preserves GPU-only <-> CPU-view pair mirroring, PageTrack write tracking, and pre/post unmap remap_epoch bumps. - ProjectLeonida/mandy#1707 (Tortoche): 64-page-aligned (4 MiB) fault-ahead batch commit in commit_mapped_page with view-end clamping, single-page VirtualAlloc fallback, PageTrack committed/change propagation across every newly committed page in the batch, and PAGE_READONLY/PAGE_GUARD preservation (keeping tiny 1..3-page views demand-committed per page so sparse shadow/stamp tests do not over-commit neighbors). - ProjectLeonida/mandy#1499 (huangzhuoyue): replace per-#UD VirtualQuery kernel transitions in rt::cpu_emulation::handler and apply(Op::clzero) with MSVC SEH helpers (read_code_seh / zero_line_seh) while retaining writable()/readable() for try_clzero_loop and non-MSVC/clang-cl builds. - Tests: added test_coalesced_run_partial_unmap, test_fault_batch_commit, and test_page_edge_faults. Verified xmem (500 checks), cpu_emulation, d3d12_xmem_placed, and d3d12_xmem_shadow (4/4 CTest passed) + gta6rt build + check_no_game_data.py.
What and why
During retail startup (1.0.2.1), after
CopyDescriptorsSimple, the title callsXMemMapPhysicalPageswith 99,776 contiguous pages (6,236.0 MiB) in a single call. Mapping them one 64 KiB page at a time issues ~100k separateVirtualFree(MEM_PRESERVE_PLACEHOLDER)+MapViewOfFile3calls, which under Wine 11.22 takes longer than 30 seconds and triggers the title's internal 30 s watchdog assert (0x142215c35).This change coalesces contiguous runs of pages from the same
Sectionand consecutive offsets into a singleisolate_placeholder+MapViewOfFile3call, while preserving per-page unmap/remap semantics:MappedPagerecordsview_base,view_pages, andview_protect.unmap_pagesplits a multi-page view when a middle page is unmapped or overwritten, re-mapping the surviving prefix and suffix runs while keeping their backing data intact.map_view_runfails (e.g. pre-split placeholders),XMemMapPhysicalPagesfalls back to mapping that run page-by-page.Testing
test_coalesced_run_partial_unmapinruntime/test/xmem_test.cpp(maps 4 contiguous pages, unmaps a middle page, verifies prefix/suffix data survival, remaps the middle page back, unmaps and frees).ctest -R xmemunder Wine 11.22 (Arch Linux):d3d12_xmem_placed: passed.xmem: 223/228 checks passed, including all 11 checks oftest_coalesced_run_partial_unmap(the 5 existing failures are Wine 11.22VirtualQuery/PAGE_READONLY/ commit-charge checks that also fail onmain).gta6rt.sh --run(with d3d12_xs: device slot 74 returns S_OK instead of reaching ShaderCacheControl, again (RT-SLOT74) #385 + d3d12_xs: accept Xbox ID3D12GraphicsCommandListX IID in CreateCommandListX #445 stack): the 99,776-page (6,236 MiB)XMemMapPhysicalPagescall dropped from >30,000 ms (watchdog hang) to 14 ms, advancing boot through device slot 74,dstorage(CreateStatusArray,CreateQueue1, CPU zlib inflate), and reaching device slot 108.AI-assisted: yes