vulkan_replay: a clamped mesh draw's statistics segment is a mesh segment; a batch reads only its own lists (RT-REPLAY-STATISTICS-MESH-SEGMENTS) #2530
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2530
Loading…
Reference in a new issue
No description provided.
Delete branch "rt-replay-statistics-mesh-segments"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: RT-REPLAY-STATISTICS-MESH-SEGMENTS (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231080379)
What and why
Item 2 of @kevincommits' finding in #1608 (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230685285). Thanks for the analysis.
Overlapping statistics queries and a clamped indirect mesh draw (
plan_overlapping_statistics_segments,runtime/src/vulkan_replay.h). A clamped indirect call opens a segment of its own, because the clamp is a helper dispatch. The planner then hardcodedif (draw_command(commands[i]).state) kind = 0;andcontinued, so the new segment was always a vertex segment, even for an indirect mesh draw (everyIndirectMeshDrawis clamped). That draw then ranvkCmdDrawMeshTasksIndirect[Count]EXTinside the full 11-counter pool (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076) with no mesh-primitives query. A mesh draw after it also split the segment again, since the kinds differed. The one-query-at-a-time planner (plan_statistics_segments) already marked the same draw mesh.Change: the clamped call falls through to the draw-kind rule every draw uses, as
has_helper_dispatchalready does. The segment it opened has no kind yet, so a draw sets it (vertex or mesh) and a dispatch leaves it unset.A smaller batch read the stale tail of a larger one (
VulkanQueue::execute,runtime/src/vulkan_backend.h).prepared_keeps the PreparedLists of the largest batch so their storage is reused, and the comment there says only the firstlists.size()entries are read. But the segment kinds for the statistics pool were gathered withfor (const auto& list : prepared). After a batch whose later lists had a mesh segment, a smaller batch with statistics queries could find that stale1. It then createdmesh_poolandprimitives_poolit did not need, or failed asqueue_unsupportedon a device without them.Change: the gather is
batch_statistics_meshinvulkan_replay.h, andexecutepasses it onlystd::span(prepared).first(lists.size()).Overlap: none found among open PRs touching
vulkan_replay.horvulkan_backend.h(#2491, #2489, #2486, #2485, #2469, #2402, #2365 change other functions). Items 1 and 3 of the same finding are #2526 and #2523.Tested
Windows 11, MSVC (VS 18), RelWithDebInfo, on
main431ceba4f. CPU tests, plus the existingd3d12_meshGPU test.replay_query_predication_testgains case 16b, following the repro:plan_statistics_segments): mesh too;batch_statistics_meshover the first list of two leaves the second list's mesh segment out; over both it keeps list order.ctest -R "^(replay_query_predication|replay_query_edges|indirect_topology_and_stats|d3d12_mesh)$": 4/4 pass.gta6rt_d3d12_com(which includesvulkan_backend.h) builds.scripts/check_no_game_data.py: clean.Not tested: the
executepath itself on a device with a multi-list batch followed by a smaller one. The helper it now calls is tested, but not the queue around it. Also no game boot.GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Reviewed at head
202786b51on Windows 11 (MSVC 202219.44).Verification
replay_query_predication_testandgta6rt.replay_query_predication_test: passed (query resolves suspend conditional rendering around fills, copies and dispatches).Notes
vulkan_replay.h:3313-3354).vulkan_backend.h(3456-3466,3533-3547,3568-3575) all consistently restrict to the active list prefix.replay_query_predication_test.cpp:783-835slices the input before calling the helper directly; adding a queue-level test running a 2-list batch followed by a 1-list batch would also guard the production slice atvulkan_backend.h.Approve.
AI-assisted review + local MSVC verification.
#2530 | head 202786b51e3ae4d90c5ea14e78998d7cefa7900c (merged cleanly with main 09c153948386fd658fe2f999f6176efbaa8c8345) |
ctest --test-dir runtime/build -C RelWithDebInfo -R "^(replay_query_predication|replay_query_edges|vk_overlapping_occlusion|vk_overlapping_occlusion_no_statistics|vulkan_mesh_limits)$" --output-on-failure(LEONIDA_VK_VALIDATION=1) | red on main:replay_query_predication_test.cppfails to compile (C3861:batch_statistics_meshmissing; onmain,plan_overlapping_statistics_segmentsforcedkind = 0on clamped indirect mesh draws andVulkanQueue::executereadpreparedpastlists.size()) | green on PR+main:5/5CTests pass (replay_query_predicationin0.07s,replay_query_edgesin0.10s,vk_overlapping_occlusionin0.40s,vk_overlapping_occlusion_no_statisticsin0.33s, andvulkan_mesh_limitsin0.03s) on RTX 3090 withLEONIDA_VK_VALIDATION=1(0Khronos validation errors);check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesReviewed the diff and tested merged onto
main(493867366) with Ninja Release (MSVC).Clamping the indirect mesh draw segment in
vulkan_replay.hand wiringbatch_statistics_meshinvulkan_backend.hlook clean, and the new cases inreplay_query_predication_test.cppdirectly cover the changed paths.Tests run
ctest --output-on-failure -R "^replay_query_predication$": 1/1 passed (replay_query_predication0.03 s).AI-assisted (Antigravity, Gemini).
Tested
202786b51merged (no commit) withmainc8bf0e7b6. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo.check_no_game_data.pyis clean.replay_query_predicationpasses.runtime/src/vulkan_replay.handvulkan_backend.hback tomain, the test does not compile:batch_statistics_meshdoes not exist onmain(replay_query_predication_test.cpp(832),C3861). I did not run a separate runtime mutation (putting the old clamp line back behind the new helper); another tester's red/green covers it.xbox_presentfails, as on plainmainhere.gta6rt.exelinked withoutws2_32.libgivesmain's 26 unresolved Rust-std symbols, nothing new. Its imports are identical tomain's.vulkan_backend.hpart of the change is not covered by it. A queue-level case (a 2-list batch, then 1 list) was suggested in review.vulkan_replay.h.No blocker from my side. AI-assisted (Claude Code).
Merged after TheGeogeo's red/green check (check: green with this PR merged onto
main, red without it;gta6rt.exestill links) and a re-check here: no conflict withmaineb4773b34, same head as checked, not frozen,no-game-datagreen.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.