Textures: copy readable UMA bytes into owned memory #1390
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1400"
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?
Imported from ivall/xcl. Originally posted by hajduzsolt on 2026-11-24T15:37:49Z.
What is in it
crates/xcl/src/gpu/texture.rs: checked owned UMA copy and synthetic committed, sparse and cross-window checks.Tested
cargo test -p xcl --lib uma_copy_is_owned_and_rejects_uncommitted_memory: 1 passed, 0 failed.cargo test --workspace -- --test-threads=4 --nocapture: 752 passed, 0 failed, 41 ignored. The reported passes include tests that return early.test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state(D3D12 debug layer unavailable).Regression run
main:
PR:
Not tested
Vec<u8>; there are no in-tree callers. The copy is not an atomic snapshot of concurrent guest writes.AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T17:01:45Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
upstream-sync referenced this pull request2026-11-24 21:07:02 +00:00
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:38:06Z.
Triage (#1607) – head
23da9be#1530 makes the same change to gpu/texture.rs::uma_bytes (owned Vec copy instead of &'static [u8], rejecting sparse/uncommitted and cross-window spans); this PR was opened first, merges cleanly and has a test.
Note: uma_bytes has no caller in crates/ on main, so the change has no runtime effect today.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T14:00:20Z.
merge-check
base:
5eaadb54c1head:
23da9be703merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2975 passed, 0 failed, 52 ignored (base: 2974 passed, 0 failed, 52 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none in this run
review: correction: my earlier
safe to mergeon this head missed a flaky test. @vasanex and @stijn-boer are right.uma_copy_is_owned_and_rejects_uncommitted_memoryassertsu.contains(base + 4 GiB), butUma::newdoes not promise that. It picks its address by the first window only, then tries to reserve the sparse windows (reserve_sparse_windows). If anything else holds memory in that range, it goes on without them.gpu::texturemodule and 25 together withgpu::umaat 8 threads). It fails every time when I reserve 64 KiB atbase + 8 GiBbeforeUma::new:assertion failed: u.contains(sparse).!u.contains(sparse), in place of the assert. It then passes with the range taken. In that case the last two checks do not run.uma_bytesitself still reads correct. It has no caller on main.performance: no runtime effect today (no caller). For a future caller, a copy per call instead of a borrow.
verdict: not yet: the new test fails when the sparse windows cannot be reserved; the fix is in the test only
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T00:54:00Z.
merge-check claim
head:
23da9be703Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T01:01:51Z.
merge-check
base:
1c8b551475head:
23da9be703merge: clean (merged tree 71ba8083,
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> two runs on the merge. Run 1: 2909 passed, 1 failed, 51 ignored; failing:
gpu::texture::tests::uma_copy_is_owned_and_rejects_uncommitted_memory, the test this PR adds (texture.rs:797,assertion failed: u.contains(sparse)); it does not exist on the base. Run 2: 2906 passed, 4 failed, 51 ignored; the PR's test passed, and the four failures are in a file this PR does not touch (hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsand the threestream_recheck_*tests that then fail on the lock it poisoned): a timing race between GPU tests that I have seen on main before, not this PR's. SKIPPED: 25 in both runs (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same set as on the base. Base alone, same machine: 2909 passed, 0 failed, 51 ignored. The PR's test alone (cargo test -p xcl --lib uma_copy_is_owned_and_rejects_uncommitted_memory): 3 of 3 passed; thegpu::texturemodule with 4 threads: 6 of 6 passed.review: whole diff read (one file, texture.rs, +39/-6). One finding that should be fixed first: the new test assumes that
u.base() + 4 GiBlies in a window of theUmait has just made (assert!(u.contains(sparse))). That holds only whenUma::newcould reserve its sparse windows there; in the whole suite, where other tests make their own UMA at the same time, it did not hold in 1 of 2 runs here, so the test fails by chance and would cost other PRs their test reports. Taking the address from theUmaitself (a sparse window it reports, and skipping that part when it has none) would make it independent of what else runs. The change itself reads right to me:uma_byteshas no caller on main, so the new return type breaks nothing; the copy goes throughReadProcessMemoryafter the readability check, so a page that goes away in between gives an error instead of a fault; a span that crosses windows or is empty is refused. The first check on this head, on another machine, had no failure.performance: none by default: the function has no caller. A caller would now pay a copy of the texture (up to 256 MiB by the readability helper's limit) instead of borrowing it.
verdict: not yet: the test this PR adds fails by chance in the whole suite (
u.contains(sparse), 1 of 2 runs with --test-threads=4 on this machine)hardware / tool and model: NVIDIA GeForce RTX 3080 10 GB (driver 621.40), AMD Ryzen 9 7950X, Windows 11 Pro 26200, rustc 1.100.0, debug / Claude Code with Claude Fable 5.2. Run and posted without a human check of each point.
Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T16:44:41Z.
merge-check
base:
5eaadb54c1head:
23da9be703verdict: not yet: the focused UMA test passed 12 of 12 isolated runs and the workspace and smoke exits reproduced on main. Independent reports on this head found an intermittent failure in the PR's new UMA test when sparse windows could not be reserved (suite report).
Windows / AMD RDNA4 (native D3D12) — workspace suite and retail smoke on
23da9beClean merge onto
mainat5eaadb54(merge commit0b97c25c36ad7e5cbb6cfcdb0761371613f3f04d).git diff --checkwas clean.Setup
d3d12SDKLayers.dll, DXC 1.9.2609.5Tested
cargo build --workspacepassed on both builds.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputexited 101 on both.SKIPPEDnoticesmainCounts are partial because two test processes aborted on each build.
main— none observed in the comparable results.uma_copy_is_owned_and_rejects_uncommitted_memorypassed 12 of 12 isolated invocations.uploads_start_from_each_subresources_statepassed on both builds.Shared failures and process aborts
fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3, andtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsreported failures on both builds.gpu_compute_e2etest processes exited with0xc0000409on both builds.Retail smoke
Ran
scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>withXCL_UMA_DRIVER=mixedfor title hash2c508222.main0xc00004090xc0000409Diff review
The isolated test checks ownership and rejects unreadable ranges. The merged tree has no runtime caller of
uma_bytes.Not tested
Tests after the aborts and retail frame performance remain unverified.
AI use
Codex (GPT-6) ran the builds and tests, reviewed the diff, compared the results with
main, and drafted this report.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T17:11:26Z.
@hajduzsolt I have corrected my check from
safe to mergetonot yet: the new test fails whenever the sparse windows cannot be reserved. I could make it fail every time, and a small change in the test fixes it: https://github.com/xcl-dev/xcl/pull/1400#issuecomment-7313539534Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-12-02T17:12:58Z.
Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on
23da9beMerged onto
main5eaadb54(clean merge) and compared withmainrun twice on the same machine.Setup
v3.1-83-gcae8353edand DXVKdxgi.dllfrom GE-Proton11-16, DXC 1.9.2609.5x86_64-pc-windows-msvcwithcargo-xwin; test binaries run under WineTested:
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>main5eaadb54main: none.uma_copy_is_owned_and_rejects_uncommitted_memory).About the failures on
mainand the 31 skipped tests (same for every PR in this batch)main's 177 failures under Wine come from #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests getE_INVALIDARG(0x80070057). Running vkd3d-proton master with its vtable check taken out,hle::d3d12x::sparse::testsgoes from 106 passed / 38 failed to 144 / 0.std::terminate()(Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests,gpu_compute_mode_dispatch_abi,gpu_compute_thread_limits_leave_the_lanes_past_them_out, the twogpu_mesh_mode_*tests, andconsole_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plusserialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv93ab44c5).mainwas run twice: same counts, same failure set.SKIPPEDlines (same asmain): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).Not tested: Windows, NVIDIA, a retail title /
scripts/smoke.ps1, a review of the diff. This is a test report, not amerge-check.AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with
main, and drafted this report. The user asked for it to be posted.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.