Repository navigation
Runtime: split pipeline statistics around predication and footprint helpers (D3D-162 follow-up) - #1899
Merged
Conversation
…elpers (D3D-162) Replay refused SetPredication, predicated buffer copies and D24/RGB96 footprint conversions while a pipeline-statistics query was active (ItsNotRexed#1624 added the last), because their compute dispatches would count in the application's CSInvocations. They now get the segment split ItsNotRexed#1519 gave resolves: the statistics query ends its current physical segment right before the helper dispatch and begins the next right after it, and its result is the per-counter sum of the segments. Query resolves and these helpers share one segment numbering. The markers for non-query commands live on detail::Prepared, and emit() places them around capture_predicate, emit_predicated_copy and the depth24 conversion parts, outside any rendering scope. Without a statistics segment pool (the single-list replay(), or a queue without the summation helper), the three commands are still refused while statistics are active, before any helper scratch is allocated (prepare() takes statistics_helpers, false by default) and again in QueryReplay::plan. Tests (Khronos validation on): vk_predicated_copy and depth24_convert run their helpers inside an otherwise empty statistics query. Their results stay byte-exact and all 11 counters are 0. d3d12_predicated_copy compares with WARP the same way. replay_query_predication checks the emitted order for a capture, a predicated copy, a footprint copy and a resolve in one query, and the refusal without a pool. predicated_copy and typeless_rtv check both preparation modes. Co-Authored-By: OpenAI Codex <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Serrambi
approved these changes
Nov 22, 2026
Serrambi
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 0bde4c82 and tested on NVIDIA GeForce RTX 5070 Ti (driver 610.88, Windows 11 Pro, MSVC 19.50.35719.0, Vulkan SDK 1.4.363.0): approve.
Code review (runtime/src/vulkan_backend.h, runtime/src/vulkan_replay.h, and tests/docs)
plan_statistics_segments()cleanly unifiesSetPredicationcaptures, predicated buffer copies, D24/RGB96 footprint conversions (p.has_depth24), and non-timestamp resolves under one physical statistics segment sequence.QueryReplay::plan()refusesstatistics_helpers-marked lists cleanly withReplayResult::unsupportedwhen nostatistics_poolis present, andprepare(..., statistics_helpers = false)continues to reject those helpers inside an active pipeline-statistics query before allocating scratch/descriptors (verified bypredicated_copy_testandreplay_query_predication_testcase 8).- In
emit(),p.has_depth24only runs inside one mutually exclusive upload (p.binding.image) or readback (else) branch arounddepth24_parts, whilePredicationandpredicated_copycleanly bracket their helper dispatches withend_statistics()/begin_statistics(), keepingvkCmdEndQuery/vkCmdResetQueryPool/vkCmdBeginQuerycompliant withVK_EXT_conditional_rendering.
Checks on 0bde4c82
vk_predicated_copy_test.exe(LEONIDA_VK_VALIDATION=1): passed (EXIT=0, 0 Vulkan validation errors)depth24_convert_test.exe,d3d12_predicated_copy_test.exe(LEONIDA_VK_VALIDATION=1): passed (EXIT=0, 0 validation errors)ctest --test-dir runtime/build --output-on-failure -R "^(replay_query_predication|predicated_copy|typeless_rtv|vk_predicated_copy|depth24_convert|d3d12_predicated_copy|vk_overlapping_occlusion|vk_binary_occlusion|d3d12_query_rules)$"(default):8/8passed (depth24_convert,vk_overlapping_occlusion,vk_binary_occlusion,d3d12_predicated_copy,d3d12_query_rules,typeless_rtv,predicated_copy,replay_query_predication)- Same
ctestsubset underLEONIDA_VK_VALIDATION=1(GPU testsdepth24_convert,vk_overlapping_occlusion,vk_binary_occlusion,d3d12_predicated_copy,d3d12_query_rules):5/5passed, 0 validation errors
Contributor
|
Tested
AI-assisted (Claude Code). |
Contributor
|
Tested 0bde4c8 on NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088, Windows 11 build 26300 (MSVC 14.44 / VS 2022 Build Tools, Windows SDK 10.0.26100.0, Ninja, RelWithDebInfo): pass for everything this PR touches.
No game files used. AI-assisted testing. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Claimed in coordination issue #1745 as a follow-up to D3D-162 (#1519) and #1624.
What and why
Replay refused three commands while a pipeline-statistics query was active, because their compute dispatches would count in the application's
CSInvocations:SetPredication: the predicate capture;docs/d3d12_vulkan.mdlisted all three under "Not implemented yet".They now get the segment split #1519 gave query resolves:
statistics_sum.comp).detail::Prepared.emit()places them aroundcapture_predicate,emit_predicated_copyand the depth24 conversion parts. The segment ends and begins all fall outside any rendering scope.replay(), or a queue without the summation helper), the three commands are still refused while statistics are active. The refusal happens inprepare()before any helper scratch is allocated (the property D3D-162: Keep footprint conversions out of pipeline statistics #1624 added), and again inQueryReplay::plan.prepare()takesstatistics_helpers, which defaults to false.Tests
All new GPU checks run under the Khronos validation layer:
vk_predicated_copy: captures, rebinding, executing and suppressed predicated copies inside an otherwise empty statistics query. The bytes stay exact and all 11 counters are 0.depth24_convert: both conversion directions for D24 and RGB96 inside a statistics query. The results are unchanged and all 11 counters are 0.d3d12_predicated_copy: the same check through the D3D12 layer, compared with WARP.replay_query_predication(CPU): the exact emitted order for a capture, a predicated copy, a footprint copy and a resolve in one query, and the refusal without a pool.predicated_copyandtypeless_rtv(CPU): both preparation modes. The refusal path allocates nothing.Tested on Windows 11, MSVC 14.51, Vulkan SDK 1.4.363.0, AMD driver 26.11.2, with
LEONIDA_VK_VALIDATION=1:main6a6704d: CTest 107/109. The two failures,d3d12_compute(device proxy ref count, line 515) andd3d12_draw(vkDestroyPipelinewhile in use), fail the same way on unmodifiedmain6a6704d.LEONIDA_VK_DEVICE=Radeon(TM)): the 9 tests this PR touches or depends on (predication, depth24, typeless RTV, occlusion) all pass.scripts/run_gpu_tests.py: 164/173, 9 skipped, no VUID in the output.No game files. AI-assisted: implemented by OpenAI Codex, then reviewed, rebuilt and tested with Claude Code.
🤖 Generated with Claude Code