kernelx: commit a mapping call's sparse pages once per run, not per page #1792
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1792
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1792"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@gavinnolan on GitHub · 2026-11-24 20:50 UTC · original
gavinnolan:kernelx-batch-sparse-commits→main· +80 −2 · 1 files · 1 commits · openA
MapTitlePhysicalPagescall toldsparseabout every 64 KiB page it mapped in a sparse window on its own: oneUpdateTileMappingsand one fenceSignalper page, about 0.5 ms a page on NVIDIA. In Series S mode (device_type = "lockhart") the retail title maps about 3.6 GB in one call at boot. Its main thread stayed in that call for 24 s, and the title's stall check ended it with the null write at+0x2215c35at 34 s, before the first frame.map_pagesnow gathers neighbouring sparse pages into runs and commits each run with onesparse::committedcall. A run is committed early whenever the same call is about to decommit one of its pages: a page moving away from an address still in the run, or homes being given back. Part of #232.What is in it
crates/xcl/src/hle/kernelx.rs:SparseRun(add / holds / flush) used bymap_pages, flushed beforemove_away/move_home_awaycan decommit a page in the run, on both error returns and at the end of the call.GIVE_BACK_PAGESnames the existing 4096. Unit testsparse_pages_are_committed_once_per_run.Tested
cargo test --workspace -- --test-threads=4with DXC 1.9.2609 (XCL_DXC_DIR): 892 passed, 0 failed, 42 ignored.SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(needs Developer Mode).scripts/smoke.ps1 -Seconds 120, sparse pools from theXCL_ACTIVITYmemory lines:main4178e88: sparse pools grow 256 MB every 2 s from 10 s to 34 s (3648 MB), no present, then0xc0000005at+0x2215c35at 34.3 s.0x80000003at+0xcc2834), which this PR does not touch (#242 / #605 address it).Regression run
main (
4178e88):this PR (
f03d411):Both runs loaded DXC 1.6 from the Windows SDK: the DXC 1.9 folder is on
D:, which the defaultD:console mount hides onmain(#833).Not tested
UpdateTileMappingscost per call is as high.AI use
@futurepro62 on GitHub · 2026-11-24 21:30 UTC · original · edited 2026-11-24 21:50 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
f03d411(on its base4178e88).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 890 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.sparse_pages_are_committed_once_per_run.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 892 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)).--skipon NVIDIA. Both fail on main7f7e768too, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures.heap_window_out_of_memory_falls_back_to_the_switch_formskips whenXCL_HEAP_WINDOWSis unset (#1651), andshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordskips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not setXCL_REQUIRE_GPU, so there both just print SKIPPED.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 23:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.Thanks!
@Royalflamejlh on GitHub · 2026-11-25 00:37 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA test of
f03d411in Series S mode, 2 runs of 60 s each way of a retail title onmain80f4819+ #684: with it the first present came in the 2 s activity line ending at 6 s in both runs, without it in the line ending at 8 s; the other run without it (14 s) was the first of the batch and started late throughout. The failure the description gives (24 s in one call, then the null write atgame+0x2215c35before any present) did not happen here without the change either.Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch. RTX 4070 12 GB (driver 615.71.09), Ryzen 9 9950X3D, 62 GB RAM. Release, cross-compiled to
x86_64-pc-windows-gnu(rustc 1.98.0),XCL_NETWORK=0,XCL_PSO_PRELOAD=0. Retail title 1.0.2.1, the first-run screens completed once and no story progress,device_type = "lockhart"inxcl.toml(the log saysconsole: Xbox Series S (lockhart) (title memory 8192 MiB, mode advanced)). The harness pressed A when the title presented steadily: once in two runs (18.4 s, 20.0 s), twice in one (12.4 and 20.1 s) and three times in one (18.3, 21.5 and 31.8 s).f03d411merged ontomain80f4819+ #684 (e56dbc3) without conflicts. Order: without, with, with, without. The first run of the batch (without the change) took 3.4 s from launch to XCL's first log line against 1.2 to 1.3 s in the others, as the first Series X run did.Tested
cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu sparse_pages_are_committed_once_per_run -- --test-threads=4under Wine, on the merge: 1 passed, 0 failed.80f4819+ #684, run 1 / 2f03d411, run 1 / 20x80000003atgame+0xb18de7Every 30th frame was dumped and all were black in all four runs (0 of 129,600 samples not black), with and without the change. In Series X mode the same dump has picture from frame 140.
From XCL's "UMA opened" line to "textures in title memory" took 6.2 s and 3.3 s without the change and 1.8 s and 1.7 s with it. Without it the pools grew by 1,152 to 2,496 MB per 2 s line once the growth was under way, against the 256 MB per 2 s in the description. At that rate the growth is over in 3 to 6 s, which I take to be why the 24 s stall does not appear here.
The breakpoint at
game+0xb18de7came 3.1 to 3.9 s after the last A press. It came in all four runs, with and without the change, so it is not this change's; the title went on presenting after it, and I have not looked into it.In the default Series X profile (
main689f2db+ #684, 2 pairs of 40 s, the run with it first in each): the second pair had its first present at 4.0 s and 50 presents or more from 14.0 s on both sides, and 939 frames with it against 940 without. With it, one tile fewer was mapped at 2,048 sparse submits in both pairs (15,224 against 15,225); I did not find which tile or why. The first run with it started 6 s later throughout (first present at 10.0 s). It was the first run of its batch, and the first run of the Series S batch was late the same way. I do not know the cause.Read
kernelx.rs:990(SparseRun) and:1359,:1418: neighbouring pages are gathered and committed once, and:1370flushes the run before a move can decommit one of its pages, as the description says (lines as merged onto80f4819;:934,:1297,:1356and:1308at the head).Not tested: the length of the title's one call (the memory lines show only the pools' growth); why every dumped frame is black in Series S mode; Series S past 60 s; the rest of the suite; AMD and Intel.
AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the test and the eight runs and wrote this report.
Posted without review by a person: the account owner was away and reads replies later.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.