Skip to content

D3D12.X: honor placed buffer offsets in CopyTiles - #2953

Open
kotekompotek wants to merge 1 commit into
xcl-dev:mainfrom
kotekompotek:gpu/copytiles-placed-offset
Open

kotekompotek wants to merge 1 commit into
xcl-dev:mainfrom
kotekompotek:gpu/copytiles-placed-offset

Conversation

@kotekompotek

@kotekompotek kotekompotek commented Nov 27, 2026 •

Copy link
Copy Markdown

The console graphics and DMA CopyTiles calls now add the existing placement prefix to the linear buffer's byte offset in both copy directions. Fixes #2908.

This revives the withdrawn #2911 by @CryingLaughing — closed unmerged without explanation despite positive AMD and Intel Arc verifications. The change is cherry-picked byte-identical (tree-verified against the original head 556b1c50, authorship preserved). Rebased 2026-11-27 onto current main 83b00818 (upstream landed #2844/#2924/#2976; only a README.md context conflict, resolved keeping both rows — the code patch is unchanged per range-diff). All verification below is fresh on the rebased head.

What is in it

  • list_x.rs: copy_tiles_x adds real::buffer_delta(buffer) to the linear byte offset (saturating) before calling native CopyTiles; tiled resource and other args untouched.
  • real.rs: DMA slot Olympus: emulate geometry wave64 on wave32 #14 removed from the straight console_remap passthrough; both console slots (graphics Olympus: isolate GameSave async validation test #18, DMA Olympus: emulate geometry wave64 on wave32 #14) routed through the adjustment. Host CopyTiles ABI/offset unchanged.
  • Regression tests: unit console_copy_tiles_adjusts_only_the_linear_buffer_offset and GPU console_copy_tiles_reads_and_writes_placed_buffer_bytes (placed buffer, 4096-byte prefix, one tile both directions through both slots, payload + guards verified).

Tested

  • Windows 10 Pro 19045, Intel Core i5-8300H, GTX 1050 (driver 32.0.15.8228), Rust 1.100.0 MSVC, debug.
  • Discriminating evidence (fix reverse-applied, tests kept):
    • Unit test: PASS on branch; FAIL without fix — recorded offset 4096 where 8192 (4096+4096 delta) expected.
    • GPU test on the real GTX 1050: PASS on branch — zero mismatches in all four cases (slot 18/14 × both directions); FAIL without fix — [65520, 69600, 65520, 69600] mismatched bytes of [65536, 69632, ...], virtually every byte wrong in both directions on both slots. Matches the issue's reproduction table.
  • cargo test -p xcl --lib -- --test-threads=4: 1327 passed, 3 failed, 27 ignored — the 3 failures are the documented unmodified-main baseline (two pipeline_cap_tests need SM 6.6, inbox Win10 D3D12 has 6.5; gpu_retire_queue driver HRESULT on this GPU); +passes vs main are this PR's tests.
  • cargo clippy -p xcl --all-targets (clippy 1.100): zero warnings in the changed lines (line-range cross-checked). The crate has pre-existing clippy noise on unmodified main (3 deny-by-default approx_constant plus style warnings) — unchanged by this PR.

Regression run
The synthetic XCL test title (tests/testtitle, exit 0x0, failures: 0). It never calls CopyTiles — this is a boot/file-IO regression check only; the discriminating evidence is the GPU test above.

main:

xcl-smoke v1
commit: 83b008188efbf954b846667f48d75e3fa9310a01
gpu: NVIDIA GeForce GTX 1050
title: xcl-testtitle
seconds: 2
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 1
device removals: 0
crashes: 0
peak commit: 862 MB

this PR:

xcl-smoke v1
commit: 7a4f0afaae5e3cde7abee4c13b5e0dc3cc5d8a5f
gpu: NVIDIA GeForce GTX 1050
title: xcl-testtitle
seconds: 2
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 1
device removals: 0
crashes: 0
peak commit: 1076 MB

Not tested
Retail titles (none available on this machine); the 2 s synthetic run does not exercise CopyTiles.

AI use
Implementation by the original author; revival, verification and this write-up AI-assisted (Devin / SWE-2.1).

@luckyteagirl

Copy link
Copy Markdown
Contributor

Cross-adapter check on exact PR head 44ce003078ebdb6a42467c9612c266136b849552 (Windows 11 build 26200, Rust stable/MSVC):

  • cargo +stable test -p xcl --lib console_copy_tiles_adjusts_only_the_linear_buffer_offset -- --nocapture: 1 passed, 0 failed, 0 ignored. This is the console-slot offset unit fixture.
  • cargo +stable test -p xcl --test d3d12_resource_and_sync console_copy_tiles_reads_and_writes_placed_buffer_bytes -- --nocapture, XCL_REQUIRE_GPU=1, XCL_ADAPTER=AMD Radeon RX 6800M: 0 passed, 1 failed, 0 ignored, no skip. The test printed CopyTiles adapter=AMD Radeon RX 6800M. Slot 18 (graphics) reported 0 mismatches in both directions; slot 14 (DMA) reported 49,152 mismatches on upload and 48,960 on readback. A second run on the same adapter reproduced all four counts exactly.
  • The same integration command with XCL_ADAPTER=AMD Radeon(TM) Graphics selected the integrated Radeon and produced the same result: slot 18 0/0, slot 14 49,152/48,960 mismatches; 0 passed, 1 failed, 0 ignored, no skip.
  • In a separate, uncommitted test-only control on the RX 6800M, I replaced the DMA call_console(raw, 14, ...) invocation with the typed list.CopyTiles(&tile, &start, &region, &placed, 4096, flags) call on the same DMA list. The mismatch counts stayed 49,152/48,960. This control changes only the fixture and does not establish a passing PR run.

The device remained live and both DMA fences completed in the fixture. This establishes a repeatable result on this laptop's two AMD adapters; the control does not isolate the fixture's copy-queue setup, the placed resource, or the driver. The PR's GTX 1050 result remains a separate passing result. I did not run the full workspace suite or a retail title for this PR.

AI use: OpenAI Codex (GPT-6, exact serving variant unavailable) checked out the exact head, selected both adapters, ran the focused fixtures, repeated the RX 6800M failure, ran the uncommitted DMA control, and prepared this report.

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent NVIDIA check on #2953 head 44ce003078ebdb6a42467c9612c266136b849552, following the AMD copy-queue failure report.

Windows 11 build 26300, RTX 3080 Ti (driver 621.35), Rust 1.99.1 MSVC, debug:

  • XCL_REQUIRE_GPU=1; cargo test --offline --locked -p xcl --test d3d12_resource_and_sync console_copy_tiles_reads_and_writes_placed_buffer_bytes -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, no GPU skip. It selected the RTX 3080 Ti and confirmed the 4096-byte placement delta. Both graphics slot 18 and DMA slot 14 returned 0 mismatches in upload and readback, for all four cases.
  • cargo test --offline --locked -p xcl --lib console_copy_tiles_adjusts_only_the_linear_buffer_offset -- --test-threads=1: 1 passed, 0 failed, 0 ignored.

This adds a second NVIDIA adapter result. It does not resolve the AMD DMA mismatch or establish its cause. I did not run the full workspace suite or a retail title on this PR. The PR currently conflicts with main, so these counts apply only to the linked head.

AI use: Codex (GPT-6.2 Sol) selected the exact head, ran the tests on the hardware above, checked the output, and drafted this report.

Use the console placement prefix in both directions for graphics and DMA lists. Verify native readback and keep host CopyTiles offsets unchanged.

Fixes xcl-dev#2908
@kotekompotek
kotekompotek force-pushed the gpu/copytiles-placed-offset branch from 44ce003 to 7a4f0af Compare November 27, 2026 08:16
@kotekompotek

Copy link
Copy Markdown
Author

Rebased onto current main 83b00818 (upstream landed #2844/#2924/#2976) — the only conflict was README.md context, resolved keeping both rows; the code patch is unchanged per git range-diff. Full re-verification on the new head 7a4f0afa: suite 1327 passed / 3 failed (baseline-only), unit + GPU integration CopyTiles tests pass, discrimination re-confirmed (offset 4096 vs 8192 without the fix), fresh smoke pair in the description. Verifications of the previous head 44ce0030 apply to identical code.

@SlopTart

Copy link
Copy Markdown

Linux (Wine) dual-lane run at 44ce0030: your new lib test green on both stacks, no regressions.

real::readback_routing_tests::console_copy_tiles_adjusts_only_the_linear_buffer_offset: ok on rig and boxb in-suite.

  • Rig (Ryzen 9 9900X, RX 7900 XT, Mesa 26.2.5 RADV, Arch, wine-11.0 Proton + vkd3d-proton): 607/2 = exactly the standing two, nothing else moved.
  • Boxb (i5-10600K, GTX 1070, 550.163.01, Debian 13, wine-10.0, xvfb): 605/4 = standing three + a known sparse load flake (solo-green across runs, not yours).

Heads-up on coverage: console_copy_tiles_reads_and_writes_placed_buffer_bytes lives in crates/xcl/tests/d3d12_resource_and_sync.rs - an integration target our --lib suite never compiles, so it was NOT run here. Running that target against your head now; will post the result separately.

Head sits on main 8b957bec (3 behind current tip; merge-base verified), baselined same-day on the same machines (rig 606/2, boxb 605/3).

Suite: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::.

AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

@SlopTart

Copy link
Copy Markdown

Follow-up to my earlier row: the integration-target test I flagged as uncovered by --lib suites is green on both Wine lanes at your current head 7a4f0afa.

cargo test --release --locked -p xcl --test d3d12_resource_and_sync --target x86_64-pc-windows-gnu -- console_copy_tiles:

  • rig (RX 7900 XT, Mesa 26.2.5 RADV, wine-11.0 Proton): console_copy_tiles_reads_and_writes_placed_buffer_bytes ... ok (1/1)
  • boxb (GTX 1070, 550.163.01, wine-10.0, xvfb): same, ok (1/1)

So: lib test green (my earlier row, at 44ce0030), integration test green at 7a4f0afa, no regressions on either lane.

AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

@Decodere

Copy link
Copy Markdown
Contributor

Independent desktop NVIDIA verification of PR #2953 at head 7a4f0afaae5e3cde7abee4c13b5e0dc3cc5d8a5f (1 commit; exact parent & merge-base: 83b008188efbf954b846667f48d75e3fa9310a01 on main, clean merge-tree against 623d02e465a1).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (7a4f0afa)

Command Result
cargo test --release -p xcl --test d3d12_resource_and_sync -- console_copy_tiles_reads_and_writes_placed_buffer_bytes --exact --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 3 filtered out × 3 (0.40s × 3, 0 skipped — live RTX 4060 readback with placement_delta=4096: mismatch=0 across graphics slot=18 upload read=65536 & readback read=69632 and DMA slot=14 upload read=65536 & readback read=69632)
cargo test --release -p xcl --test d3d12_resource_and_sync -- --test-threads=1 --nocapture (3 consecutive runs) 4 passed; 0 failed; 0 ignored × 3 (0.47s, 0.46s, 0.45s, 0 skipped)
cargo test --release -p xcl --lib -- hle::d3d12x::real::readback_routing_tests::console_copy_tiles_adjusts_only_the_linear_buffer_offset --exact --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1356 filtered out × 3 (0.00s × 3, 0 skipped)
cargo test --release -p xcl --lib -- hle::d3d12x::list_x:: --test-threads=1 --nocapture (3 consecutive runs) 40 passed; 0 failed; 0 ignored; 1317 filtered out × 3 (1.23s, 1.23s, 1.26s, 0 runtime skips)
cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=1 --nocapture (3 consecutive runs) 64 passed; 0 failed; 0 ignored; 1293 filtered out × 3 (1.98s, 1.99s, 1.97s, 0 runtime skips)
cargo build --release -p xcl Clean build (1m 48s, exit 0, 0 new warnings in list_x.rs / real.rs)

Paired quiet 60 s retail smoke (title: 29640639, XCL_PREPARE=0 XCL_NETWORK=0)

Exact parent & merge-base (83b008188efbf954b846667f48d75e3fa9310a01, XCL_PREPARE=0 XCL_NETWORK=0, cached baseline on the same machine):

xcl-smoke v1
commit: 83b008188efbf954b846667f48d75e3fa9310a01
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1609 (PresentX 1609)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14027 MB

PR #2953 (7a4f0afaae5e3cde7abee4c13b5e0dc3cc5d8a5f, XCL_PREPARE=0 XCL_NETWORK=0):

xcl-smoke v1
commit: 7a4f0afaae5e3cde7abee4c13b5e0dc3cc5d8a5f
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1610 (PresentX 1610)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14007 MB

Limits of coverage

  • Directly verified on-GPU D3D12 CopyTiles upload and readback with a 4096-byte console-placed buffer prefix on both graphics (slot=18) and DMA (slot=14) queues via console_copy_tiles_reads_and_writes_placed_buffer_bytes (0 byte mismatches across all 4 paths, 3/3 on RTX 4060), plus console_copy_tiles_adjusts_only_the_linear_buffer_offset, list_x:: (40/40 × 3), and real:: (64/64 × 3).
  • Paired 60 s retail smokes ran with XCL_PREPARE=0 (XCL_NETWORK=0), bypassing startup prepare_for_launch shader precompilation, and did not separately verify whether title: 29640639 invokes console CopyTiles during its 60 s startup/menu window.
  • Non-Windows / Wine hosts and native 64-lane AMD GPUs were not tested on this machine.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows RTX 3080 Ti check of #2953 head, paired with clean main. Windows 11 build 26300, NVIDIA 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC.

  • cargo build --offline --locked -j 4 --workspace: passed.
  • XCL_REQUIRE_GPU=1 cargo test --offline --locked -j 4 -p xcl --test d3d12_resource_and_sync -- console_copy_tiles_reads_and_writes_placed_buffer_bytes --nocapture --test-threads=1: 1 passed, 0 failed, 0 skipped. Graphics slot 18 and DMA slot 14 passed both copy directions, with zero mismatches in the fixture readbacks.
  • cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,459 passed, 0 failed, 47 ignored, 25 GPU skip notices. Those skips are not coverage.

Clean-commit paired scripts/smoke.ps1 runs used the same title, RTX 3080 Ti, 60 seconds, XCL_PREPARE=0, XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=1, and XCL_PSO_PRELOAD=0. Both exited normally; these are the script-generated blocks for the PR description. The run reached the menu; world-load and AMD behavior were not tested here.

Main:

xcl-smoke v1
commit: 81693f020768ec47dbfe9eefba5eec0ab9aeda6c
gpu: NVIDIA GeForce RTX 3080 Ti
title: sample
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14234 MB

PR head:

xcl-smoke v1
commit: 7a4f0afaae5e3cde7abee4c13b5e0dc3cc5d8a5f
gpu: NVIDIA GeForce RTX 3080 Ti
title: sample
seconds: 60
exit: 0x0
frames shown: 1665 (PresentX 1665)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14189 MB

AI use: Codex (GPT-6.2 Sol) ran the tests and drafted this report; Codex (GPT-6.2 Astra) checked the CopyTiles offset path in source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3D12.X: CopyTiles ignores the console-placed linear buffer prefix

6 participants