D3D12.X: track exact per-query byte sizes in ResolveQueryData #3393
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3393"
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 Kalmarv on 2026-11-29T13:02:08Z.
What is in it
query_result_bytes(ty: D3D12_QUERY_TYPE) -> u64incrates/xcl/src/hle/d3d12x/list_x.rssoresolve_query_data_xpasses the exact resolved byte range ((count as u64).saturating_mul(query_result_bytes(ty))) tonote_copy_intofor everyD3D12_QUERY_TYPE:D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0..=3:size_of::<D3D12_QUERY_DATA_SO_STATISTICS>()(16 bytes, previously under-reported as 8 bytes).D3D12_QUERY_TYPE_VIDEO_DECODE_STATISTICS: 32 bytes (previously under-reported as 8 bytes).D3D12_QUERY_TYPE_PIPELINE_STATISTICS:size_of::<D3D12_QUERY_DATA_PIPELINE_STATISTICS>()(88 bytes).D3D12_QUERY_TYPE_PIPELINE_STATISTICS1:size_of::<D3D12_QUERY_DATA_PIPELINE_STATISTICS1>()(112 bytes, previously under-reported as 8 bytes).OCCLUSION,BINARY_OCCLUSION,TIMESTAMP, and other 64-bit queries: 8 bytes.#[cfg(test)]helperreal::set_test_console_bufferincrates/xcl/src/hle/d3d12x/real.rs(mirroringset_test_buffer_delta) and an isolated unit testresolve_query_data_x_notes_exact_result_bytes_for_all_query_typesincrates/xcl/src/hle/d3d12x/list_x.rsverifying the exact recorded write spans inLISTSfor all 10 query types.Tested
resolve_query_data_x_notes_exact_result_bytes_for_all_query_typesfails before the fix (SO_STATISTICS_STREAM0withcount = 2recorded 16 bytes instead of 32 bytes).cargo test -p xcl --lib -j 4 -- resolve_query_data --nocapture): 2 passed, 0 failed, 0 ignored.cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::withXCL_DXC_DIRset to DXC 1.9 on RTX 5070 Ti): 41 test binaries, 2662 passed, 0 failed, 49 ignored, 9 filtered out.SKIPPEDbreakdown (26 total): 21no wave64(RTX 5070 Ti is wave32), 3refused(V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32#1426semantics), 2no heap windows(XCL_HEAP_WINDOWS=1opt-in).Regression run
Not tested
SO_STATISTICS_STREAM0..3,VIDEO_DECODE_STATISTICS, orPIPELINE_STATISTICS1into shadowed committed UMA buffers were not run directly; those paths are covered by the synthetic unit test.test_title_runs_and_game_folder_is_untouched,uma_driver::tests::, wave64 GPU tests, andXCL_HEAP_WINDOWS=1opt-in unit tests were not run in the workspace suite.AI use
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-29T14:20:53Z.
Reviewed and tested at
d65aa896.Looks clean and accurate —
query_result_bytesmatches the exact D3D12 query result struct sizes (includingSO_STATISTICS_STREAM0..3at 16 B,VIDEO_DECODE_STATISTICSat 32 B, andPIPELINE_STATISTICS1at 112 B) withsaturating_mul, and the test verifies all 10 query types throughresolve_query_data_x.Tested locally
32.0.16.2140), AMD Ryzen 7 7800X3D,rustc 1.100.0.cargo test -p xcl --lib hle::d3d12x::list_x::tests::resolve_query_data_x_notes_exact_result_bytes -- --test-threads=1: 1 passed, 0 failed.AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:40:58Z.
merge-check
base:
d0832e614fhead:
d65aa89637merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (list_x.rs +82/-2, real.rs +15). No change to what a title runs by default:
note_copy_intoreturns early unless a committed window fell back to shadowed mode or view windows exist (XCL_HEAP_WINDOWS=1). The per-type sizes match the D3D12 structures: pipeline statistics 88, PIPELINE_STATISTICS1 112, stream-output statistics 16, video decode statistics 32, occlusion / binary occlusion / timestamp / unknown 8. Main recorded 8 bytes for everything but pipeline statistics, so stream-output, video-decode and PIPELINE_STATISTICS1 resolves were under-reported. The test fails on main (stream 0, count 2: 16 bytes instead of 32). Findings: (1) the new test runs in a child process whose output is dropped when it succeeds, so a "no UMA"skip_testthere shows as a plain pass (~11826). (2) AI use names no tool or model ("an AI coding agent"); the PR's suite run skippeduma_driver::tests::andtest_title_runs_and_game_folder_is_untouched(the run above covers them). No smoke run: the default path doesn't reach this code.performance: no smoke run (the default path doesn't reach this change); not measured.
verdict: safe to merge (the description should name the AI model)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:55:36Z.
merge-check
base:
d0832e614fhead:
d65aa89637merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; failing: none (25 SKIPPED lines, all GPU tests on this adapter, e.g. no wave64)
review: Read the whole diff (list_x.rs, real.rs test helper). ResolveQueryData now notes the exact result size per query type (pipeline statistics, SO statistics, video decode, pipeline statistics 1) instead of 8 or 88 bytes, with saturating multiplication. The test checks the recorded write span for ten query types against a fake command list vtable (a no-op function replaces the PC call; the flagged code-loading line is that test stub) in a child process. The video decode size 32 is a hard-coded constant, not checked here against the SDK struct; the test would not catch a wrong value as it uses the same number. The real.rs helper is #[cfg(test)].
performance: no cost by default: a match per ResolveQueryData call; the noted span can be larger for pipeline statistics 1 (more tracked bytes), reasoned, not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report (the diff review is Sonnet's)
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T07:00:33Z.
Merged at the checked head after a combined trial of #3400, #3386, #3393 and #3535 on
maind0832e61(RTX 4080 16 GB,cargo test --workspace --no-fail-fast -- --test-threads=4: 2896 passed, 0 failed, 51 ignored, 25 SKIPPED lines). Two merge checks: Foniass and ours.AI use: Claude Code (Claude Opus 5.5).