D3D12.X: a partly read-back sparse chunk is uploaded again #1740
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!1740
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1740"
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?
@b3IKK on GitHub · 2026-11-24 20:06 UTC · original
b3IKK:d3d12x/sparse-partial-chunk-readback→main· +50 −7 · 1 files · 1 commits · openAddresses
XCL-BT-033from #1488.readback_rangescopies a GPU-written range into the CPU view and thensync_sent_rangemarked every 64-byte chunk the range touched as sent, hashing the chunk's whole content. The bytes of such a chunk that the readback did not write may be CPU writes that were never uploaded — hashing them as sent made the nextbefore_executeskip the chunk for good: the GPU never had those bytes, and the CPU's view kept them until a later readback replaced them with the GPU's.This marks a chunk sent only when the range covers it whole; a partly covered chunk is given a hash it cannot have, so the next submit uploads it (the GPU end gets the CPU's view, which now also holds the read-back bytes).
What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:mark_read_back()does the per-chunk rule;State::sync_sent_rangecalls it; add testa_partly_read_back_chunk_is_uploaded_again(a 4-byte readback inside a chunk with a 4-byte CPU write: the chunk must be uploaded; a range covering chunks whole must not be; the page's last chunk too). Fails onmainwithleft: [], right: [(0, 64)]— the CPU's write was dropped.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required)). The one#[ignore]d test in the module (early_commit_timing) is pre-existing.cargo test -p xcl --lib sparse: 18 passed, 0 failed, 1 ignoredRegression run
main (
c4d37be, clean tree, no local changes):PR (
294f565, clean tree, no local changes):Not tested
before_executeand a GPU readback of the same cacheline (the test drivesmark_read_backdirectly)AI use
XCL-BT-033againstreadback_ranges/scan_page, wrote the fix and test (and confirmed it fails without the fix), rebased ontoc4d37be, ran the test suite andscripts/smoke.ps1regression runs with #677's title hashing, and drafted this PR description.@thatirishguyyy on GitHub · 2026-11-24 20:21 UTC · original
Independent AMD check on Windows, RX 9070 XT. I cherry-picked #1740 head
36371bdontob9b6ea6(local259499b).cargo test -p xcl --release --locked --offline --lib hle::d3d12x::sparse::tests -- --nocapture --test-threads=1returned 15 passed, 0 failed, 1 ignored.a_partly_read_back_chunk_is_uploaded_againpassed. This is a focused suite result.AI-assisted with Codex for setup, execution, and reporting.
@b3IKK on GitHub · 2026-11-24 21:38 UTC · original
Rebased onto
c4d37beand re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 960 passed, 0 failed, 43 ignored.@DavidM1911 on GitHub · 2026-11-24 22:44 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. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@JJAutoCompare on GitHub · 2026-11-25 03:43 UTC · original
PR #1740 compatibility verification
Tested head
294f5655c918446b9732858a8e09f13f0ce8fddaon STOR-WINLAB. The sparse read-back regression passed. The full workspace suite exited 101 with failures in the GPU library tests and the synthetic test title.Environment
Windows 11 Enterprise Evaluation build 26200.9974, Ryzen 7 3800X, Intel Arc A770 16 GiB with driver 32.0.101.9175. Wave range 8–32,
DoublePrecisionFloatShaderOps=0, andd3d12SDKLayers.dllunavailable. Rust 1.100.0 (0ef1bc386), DXC/DXIL 1.9.2609.5, unoptimized profiles with debug info and incremental compilation disabled. The suite log confirms the real Arc A770 backend.Tested
cargo build --workspaceandcargo test --workspace --no-runboth succeeded. Allcargo testinvocations used the shared Arc lock.cargo test -p xcl hle::d3d12x::sparse -- --nocapture --test-threads=1reported 15 passed, 0 failed, 1 ignored, 0 SKIPPED. The new unit test passed in both runs. It checks that a partial GPU read-back leaves the 64-byte chunk queued for one re-upload, including at the page boundary, and that a fully read-back chunk stays clean.cargo test --workspace --no-fail-fast -- --test-threads=4reported 941 passed, 19 failed, 43 ignored over 20 result summaries, with 22 SKIPPED lines. Skip markers are excluded from GPU coverage.Failures and skips
0x80070057), including FP64 cases, plus four result mismatches covering fused FMA, implicit sample LOD, the high half of an FP16 lane, and a pixel-shader wave reduction.RSSetDepthBiasXcheck produced blue where green was expected.Not tested
Paired retail-title smoke runs, other GPUs or drivers, and D3D12 debug-layer behavior. No
maintest baseline was collected, so the suite failures establish the observed behavior at this head only.AI use
T3 Code / Codex (
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1740-suite.logand published this report.@thehollowedone on GitHub · 2026-11-25 10:50 UTC · original
Independent Windows run on 294f565. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, debug.
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturefinished with 960 passed, 0 failed, 43 ignored and 23 runtime skip notices included in Cargo’s counts.I extended
ensure_mapped_with_query_holes_skips_uncommitted_pages_on_readbackin a scratch copy to read back 72 bytes across a page boundary on the native D3D12 adapter. The next scan queued exactly the two partially covered 64-byte chunks for upload and kept the fully covered chunk out of the queue. A second GPU readback matched all 192 bytes, including the CPU writes at both ends. With the old hash update restored, the same scan queued zero chunks and the test failed at that assertion.cargo test --offline --locked -p xcl --lib ensure_mapped_with_query_holes_skips_uncommitted_pages_on_readback -- --nocapture --test-threads=1passed 1/0/0 with zero fixture skips. Synthetic test coverage only. AI-assisted. Codex (GPT-6, exact variant unavailable) extended the fixture, ran the tests, and drafted this report.@Royalflamejlh on GitHub · 2026-11-25 11:52 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA, the title, 100 s runs: the case this fixes did not come up here. In 4 runs of
mainwith a counter added, no read-back range covered a 64-byte chunk in part. In 3 runs with #1740 merged the title ran as onmain: no fault, and the last present within the range of themainruns. The one fault, in amainrun, is the one #751 is for, on a path #1740 does not change.Setup:
294f565and #684 (e56dbc3) merged locally ontomainf087b99(local mergec5c9f58). The counting copy ismainf087b99+ #684 + a counter insync_sent_range(local67e229e; its first run was on local0724148, which counted only partly covered chunks). RTX 4070 12 GB (615.71.09), Ryzen 9 9950X3D, Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch,VKD3D_CONFIG=ignore_shared_fence, release. Series X profile, first-run screens done once, no story progress, A pressed at 16.2 to 16.5 s in themainruns and at 16.4 to 18.5 s with #1740 (--press-a-when-ready),XCL_PSO_PRELOAD=0,WINEDEBUG=err+all,fixme-all. The two trees ran in turn.main+ counter (4 runs)msvcrt.dll+0xa52b, a read withtiling::Chain::detile_levelandtitle_textures::subresourceson the stack at 58.7 s (the fault #751 is for), then the title's watchdoggame+0x23cf683at 89.3 smark_read_back(sparse.rs:369) makes. The range counter logs its 1st to 4th and then each power of two: all 11 or 12 ranges it printed per run were 64-byte aligned at both ends (for example0x863a40000+0x4000). So here #1740 would give every chunk its real hash, asmaindoes, and changes nothing on this path.sparse::testsunder Wine: 16 passed, 1 ignored with #1740 (a_partly_read_back_chunk_is_uploaded_againamong them); 15 passed, 1 ignored onmain+ #684.Not tested: the rest of the suite; Windows; AMD and Intel; runs past 100 s.
AI use: Claude Code (Claude Opus 5.5) read the change, wrote the counter, ran the title and the tests, and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
@ClosetPie107 on GitHub · 2026-11-25 20:46 UTC · original
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
294f5655c918446b9732858a8e09f13f0ce8fdda(merged cleanly ontomain6d12f58).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug for tests, release for retail)Unit / GPU tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)hle::d3d12x::sparse: 18 passed, 0 failed, 1 ignored (0 skipped)Combined retail sanity run (
main6d12f58+#2068,#1771,#1740,#1256merged together;XCL_DIRECT_DXIL=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PSO_WAIT_MS=50,XCL_SPLIT_MIDLIST_WAIT=0,XCL_COHERENT_MB=1024,VKD3D_CONFIG=ignore_shared_fence,XCL_PSO_PRELOAD=0,XCL_NETWORK=0)exit=0) with 0 crashes and 0 device removals (11.55 GiBpeak VRAM / 0 GTT spill,13.35 GiBpeak RSS,1,800+frames presented,16,442translated draws,4,499dispatches,11,257Opus packets).Not tested
AI use
main, ran the tests and combined retail run under Proton on this machine, and drafted this report.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.