Port GPU amplification-stage indirect mesh launch (VICTORY_MESH_LAUNCH) #275
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!275
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-275"
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?
@Vladimir-Human on GitHub · 2026-11-27 13:22 UTC · original
Vladimir-Human:perf/mesh-launch-amplification→main· +60504 −5300 · 202 files · 638 commits · closed without mergingSummary
Ports
VICTORY_MESH_LAUNCH(adapted fromfxceless/victory-forkcommitsb1d777a,0e006f0andkelvaroqpatch0041-mesh-launch-wide-hash.patch) intovictory-shaderandvictory-gpu.Instead of inserting a compute clamp dispatch and full barriers before every single-record indirect mesh draw, this change pairs translated mesh pipelines with a programmatically emitted
as_6_6amplification stage (victory_shader::emit::mesh_launch_as) that loads the 3-dword indirect dispatch record directly on the GPU, bounds it identically tocrate::indirect, charges the list's work budget atomically, and dispatches the mesh groups.Key Changes
as_6_6DXIL emitter (crates/victory-shader/src/emit/{launch.rs, shader.rs, container.rs, bitcode.rs, mod.rs},crates/victory-shader/src/lib.rs):as_6_6amplification shader programmatically viavictory-shader(zero precompiled DXIL/hex blobs; passesxtask policyand Windows SDKdxil.dllvalidation for bothrest=falseandrest=true).crate::indirectsemantics 100%: direct CPU counts clamped<= 65,535(unbounded by budget), indirect unfilled-slot zeroing forx > 65,535,y/zclamped to1,BUDGET = 1 << 27at128/group,VICTORY_INDIRECT_REST(rest=falsevsrest=true), and all 5 budget diagnostic counters[cost, max_asked, sum_asked, refused, biggest].mesh_payload_bytes(), synced viaset_mesh_launch_payloadwithlaunch::on()) and bumpsTRANSLATOR_VERSION9 -> 10atopmain's version 9.crates/victory-gpu/src/{launch.rs, pipeline/host.rs, draw.rs, shader_cache.rs, indirect.rs, host.rs, lib.rs}):VICTORY_MESH_LAUNCH=1(default ON),0(off),alt(20s alternating), andVICTORY_ABunder--features diagnostics.GENERIC_READdummy buffer (DummyRecord) toroots[1]on direct dispatches so it never conflicts with theUNORDERED_ACCESSbudget buffer onroots[2], and requires non-zero live GPU addresses (falling back cleanly toLaunch::plain()if unavailable).Launch::plain()(no-AS pipeline sharing the root signature) for multi-record indirect calls, count-buffer calls, and off phases ofalt/VICTORY_AB, keeping distinct pipeline library keys ("mesh launched"vs"mesh payload"), 64-dword root-signature cap fallback, PSO creation fallback without AS, and post-prepare_directpipeline lookup indraw.rs::dispatch_mesh.shader_cache::build()on effectivemesh_payload=<bytes>(syncingvictory-shaderbeforebuild,precompile, andhost_shader) so unset,"1","alt", andVICTORY_ABruns share one cache key while payload-0 runs stay isolated.Verification (
rustc 1.98.1&1.100.0,VICTORY_D3D12_DEBUG=1,--test-threads=1)cargo clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings(default &--features victory-gpu/diagnostics): 0 warningscargo run -p xtask --locked -- policy --staged(13 files ok),xtask policy(315 files ok),cargo test -p xtask --locked(11/11 passed)victory-shader(emit::launch,emit::container,emit::rect,mesh): 12/12 passed (dxil.dllvalidated for bothrest=falseandrest=true)victory-gpu(hw_mesh_records_are_launched_by_the_amplification_stage,warp_mesh_records_are_launched_by_the_amplification_stage,a_mesh_pipeline_loads_from_the_library,mesh_launch_switch_changes_cache_key): 4/4 passed (default) and 4/4 passed (--features diagnostics), asserting all 5 budget/stat counter dwords verbatim and 0ID3D12InfoQueueerrors/corruption across direct, indirect, mixed direct+indirect, unfilled-slot zeroing,REST=0vsREST=1budget exhaustion, and plain no-AS fallback on both HW (RTX 4070 SUPER) and WARP.Credit: adapted from
fxceless/victory-fork(b1d777a,0e006f0) andkelvaroq(0041-mesh-launch-wide-hash.patch).@TaynanGT on GitHub · 2026-11-27 13:37 UTC · original
@Vladimir-Human The mesh launch path needs the clamped dispatch dimensions and work-budget counters to match the existing indirect path on the same inputs. Keep the fallback for unsupported pipelines and tie the emitted payload to the cache key. Current main already uses translator version 9, so the PR’s cache-version plan needs that base.
23d0afb406to7c04cca367@Vladimir-Human on GitHub · 2026-11-27 14:06 UTC · original
@TaynanGT Updated in
7c04cca3to address every point:Rebased onto
main(877a40e8,TRANSLATOR_VERSION = 9) and bumpedTRANSLATOR_VERSION9 -> 10:crates/victory-shader/src/lib.rs:29now bumps9 -> 10, withconst { assert!(victory_shader::TRANSLATOR_VERSION >= 10) }incrates/victory-gpu/src/shader_cache.rs:657.victory_shader::emit::mesh_payload_bytes(), synced vialaunch::sync_shader_payload()/set_mesh_launch_payload()acrossbuild,precompile, andhost_shader) is tied directly intoshader_cache::build()(mesh_payload=<bytes>,shader_cache.rs:146-153), verified byshader_cache::tests::mesh_launch_switch_changes_cache_key(unset == "1" == "alt"at payload4, distinct from"0"at payload0, andVICTORY_ABoverride matching payload4underdiagnostics).Clamped dispatch dimensions and all 5 work-budget/stat counters matching
indirect.rs:crates/victory-shader/src/emit/launch.rsmirrorsindirect.rs'sCLAMPshader on identical inputs: unfilledx > 65,535zeroing (asked = 0),y/zclamping to1, zero-dim empty runs, direct counts clamped to65,535(unbounded by budget),BUDGET = 1 << 27at128/group,VICTORY_INDIRECT_REST(rest=falsevsrest=true), and all 5 budget/stat dwords[cost, max_asked, sum_asked, refused, biggest].victory_shader::emit::launch::tests::mesh_launch_amplification_shader_is_valid_dxil(dxil.dll-validated for bothrestmodes) andpipeline::host::tests::{hw,warp}_mesh_records_are_launched_by_the_amplification_stage, which now assert all 5 budget/stat counter dwords verbatim across single-indirect, mixed direct+indirect (in explicitUNORDERED_ACCESSbudget state), unfilled/zero-dim/clampedy/z,REST=0, andREST=1cases with 0ID3D12InfoQueueerrors/corruption on both HW and WARP.Unsupported-pipeline and non-single-record fallbacks preserved:
pipeline/host.rs:704-712) or refused with an amplification stage (pipeline/host.rs:845-867) fall back cleanly without the launch stage.alt/VICTORY_ABoff phases, and unavailable-budget calls lazily bindLaunch::plain()(no-AS pipeline sharing the root signature,pipeline/host.rs:435-478,draw.rs:3816-3836, 4833-4844), with distinct library keys"mesh launched"vs"mesh payload"covered bya_mesh_pipeline_loads_from_the_libraryand theplainphase of{hw,warp}_mesh_records_are_launched_by_the_amplification_stage.Re-verified locally (
VICTORY_D3D12_DEBUG=1,--test-threads=1):clippy --all-targets --locked -- -D warnings(default &diagnostics) 0 warnings,xtask policy(315 files ok) &xtasktests 11/11,victory-shader12/12, andvictory-gpuPR B suite 4/4 default + 4/4diagnostics(HW + WARP, 0 D3D12 debug errors).@TaynanGT on GitHub · 2026-11-27 14:25 UTC · original
@Vladimir-Human The five counters and the multi-record/count-buffer fallback are the checks I wanted. Use
VICTORY_MESH_LAUNCH=0explicitly as the control against1, since unset currently selects the mesh payload path. Keep a separate translated shader cache for each phase and report the dispatch and frame times together.7c04cca367tobcb57f384b@TaynanGT on GitHub · 2026-11-30 17:13 UTC · original
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed