You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D3D12.X: track exact per-query byte sizes in ResolveQueryData - #3393
Add query_result_bytes(ty: D3D12_QUERY_TYPE) -> u64 in crates/xcl/src/hle/d3d12x/list_x.rs so resolve_query_data_x passes the exact resolved byte range ((count as u64).saturating_mul(query_result_bytes(ty))) to note_copy_into for every D3D12_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_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.
Add a #[cfg(test)] helper real::set_test_console_buffer in crates/xcl/src/hle/d3d12x/real.rs (mirroring set_test_buffer_delta) and an isolated unit test resolve_query_data_x_notes_exact_result_bytes_for_all_query_types in crates/xcl/src/hle/d3d12x/list_x.rs verifying the exact recorded write spans in LISTS for all 10 query types.
Tested
Verified resolve_query_data_x_notes_exact_result_bytes_for_all_query_types fails before the fix (SO_STATISTICS_STREAM0 with count = 2 recorded 16 bytes instead of 32 bytes).
Targeted tests after the fix (cargo test -p xcl --lib -j 4 -- resolve_query_data --nocapture): 2 passed, 0 failed, 0 ignored.
Full workspace suite (cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests:: with XCL_DXC_DIR set to DXC 1.9 on RTX 5070 Ti): 41 test binaries, 2662 passed, 0 failed, 49 ignored, 9 filtered out.
SKIPPED breakdown (26 total): 21 no wave64 (RTX 5070 Ti is wave32), 3 refused (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32#1426 semantics), 2 no heap windows (XCL_HEAP_WINDOWS=1 opt-in).
Retail titles resolving SO_STATISTICS_STREAM0..3, VIDEO_DECODE_STATISTICS, or PIPELINE_STATISTICS1 into 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, and XCL_HEAP_WINDOWS=1 opt-in unit tests were not run in the workspace suite.
AI use
Authored, verified, and tested with an AI coding agent; all changes and test results were verified directly against the local repository, compiler, test suite, and 150 s smoke run.
Looks clean and accurate — query_result_bytes matches the exact D3D12 query result struct sizes (including SO_STATISTICS_STREAM0..3 at 16 B, VIDEO_DECODE_STATISTICS at 32 B, and PIPELINE_STATISTICS1 at 112 B) with saturating_mul, and the test verifies all 10 query types through resolve_query_data_x.
Tested locally
Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver 32.0.16.2140), AMD Ryzen 7 7800X3D, rustc 1.100.0.
merge-check
base: d0832e6
head: d65aa89
merge: 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_into returns 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_test there shows as a plain pass (~11826). (2) AI use names no tool or model ("an AI coding agent"); the PR's suite run skipped uma_driver::tests:: and test_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.
merge-check
base: d0832e6
head: d65aa89
merge: 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)
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area:d3d12D3D12.X runtime, command lists, resources, sparse memorygpu:bothCode affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)ready-to-mergeHas 2 independent safe merge-checks on current head (#3041)
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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