gpu(native): VICTORY_TRACE_PASSES_AFTER opens the pass trace at a shader's first work (#575) #576
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/576"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by alexballvideos-netizen on 2026-11-28T05:52:08Z.
Refs #575
VICTORY_TRACE_PASSESopened its window only after a count of world presents, so work that runs rarely, or only once its pipeline exists, was missed (the ray-traced passes in #541).What changes
VICTORY_TRACE_PASSES_AFTER=<hash>[,<hash>...]: once<skip>world presents have gone by (0for none), the next draw or dispatch of a pipeline holding one of those shaders opens the window. It opens before that work is noted, so the work is the window's firstPASSline, whether it runs or is dropped. APASSWINDOW start after=<hash>line says which shader opened it. The window then lasts<presents>presents more.glue::pass_armis called at the start ofgraphicsandskipped_dispatch, so direct, thread-count and indirect dispatches and every draw are covered. With the variable unset it costs two reads of a set-once value.PASS_LEFT,PASS_WORLD) and theVICTORY_TRACE_PASSESsettings move from statics insidepass_presentto module level, sopass_armcan read them.pipeline::parse_skip_hashestakes the variable's name, so a bad hash in either list is warned about under the right name.docs/native-host.md: the switch is documented in theVICTORY_TRACE_PASSESentry.pass_trace_reads_its_switch_and_stays_off_without_italso checks that with the variable unset a draw arms nothing.Checked
cargo test -p victory-gpu(arm64),cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warningsandcargo xtask policypass, and the change adds no warnings to the macOS build.Two headless runs on main
2f4d81e0, Series X, M3 Max,VICTORY_DEPTH_TWINS=0:VICTORY_TRACE_PASSES=<dir>,100,2,…_AFTER=eee76bf6and the four ray-traced shaders. The window opened ateee76bf6's first dispatch, in the world's first frame (frame 2005). All five are dispatched in that frame (the ray-traced ones are indirect) and all are dropped as "a dispatch without a host compute pipeline".eee76bf6is refused (the divergent cross-lane case #541 lifts). The ray-traced ones log no refusal; they were first bound in that frame, so their pipelines weren't built yet.…,20,2,…_AFTER=the four ray-traced shaders. The window opened at0af6bb55after 20 world presents and lasted 3 presents:0af6bb5552f01bcb67662685caa50df7eee76bf6So the ray-traced passes do run on main once their pipelines are built. But at the window's last present, the R16_UINT target all four write is 0.0000 non-zero. The DXGI 26 target
67662685also writes is 1.7% non-zero (max 10.6).eee76bf6's R16_UINT output is also all zero, as expected while it's dropped. Whether an all-zero result is right for this scene (e.g. no ray hits) or a sign the traversal finds nothing is the next question. I haven't looked into it here.Both runs ended in the usual
0xc0000005atimage+0x55e56f8, which is seen with and without the trace. Run 1 hit it before the window's last present, so it wrote no images.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T17:09:45Z.
Review: APPROVED
Read the diff:
VICTORY_TRACE_PASSES_AFTER=<hashes>arms the pass-trace window at the first draw/dispatch of a listed shader after<skip>world presents, viapass_arm(two set-once reads when unset) with aPASSWINDOW start after=<hash>line; the existing present-count logic is unchanged and now sharesPASS_LEFT/pass_settings(). Wired into the draw/dispatch path (pass_arm call sites present). Verified on the head2acbdfc6: darwinpass_tests 3/3, host-p victory-gpu --lib pass7/7, windows clippy-D warningsclean. Approving.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T18:22:07Z.
Review: APPROVED
Reviewed and verified locally on head
2acbdfc6(worktree /private/tmp/review-576):The change is tight: the window state moves from statics inside pass_present to module level so pass_arm can read it; pass_arm is called at the top of graphics and skipped_dispatch so draws, direct/thread-count and indirect dispatches are all covered; the window opens once via compare_exchange before the work is noted, so the opening work is the window's first PASS line; and with AFTER set, the present-count opening is disabled so the hash list alone decides. Cost when unset is two reads of set-once values, as the PR says. The two headless run tables (window opening at eee76bf6's first dispatch in frame 2005; the 20-present window catching all four ray-traced shaders) are exactly the evidence this needs for #575. Approving.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.