Repository navigation
Conversation
|
RTX 5070 (32-lane): in-game check of this PR with #36 and #579 on Runs: diag build, Tests on that tree ( AI-assisted (Claude Code, Claude Sonnet 5.5): the runs are mine, on my own copy of the title. Counts only, no game data. |
… 0x105 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
…her codes 0x104/0x105/0x106 - fxceless#646 (USER_DISPATCH_THREADS), fxceless#834 (USER_GROUP_BASE) and our USER_VIEW_SLOT each took 0x104; here they are 0x104, 0x106, 0x105. - record_clamp_with takes the scratch buffer's state as record_clamp_as does since fxceless#220, and bound_split tracks it like clamp_into. - The split read asked.x, which since fxceless#220 is the mesh records' count (a scalar, 0 for dispatches): every full dispatch got 65,535 more groups and twice the charge. It reads the record's x now, as the second record's store does. warp_split_runs_every_group_of_a_wide_ dispatch_once passes again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
…celess#834, after fxceless#646's 0x104), USER_VIEW_SLOT 0x106 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
|
RTX 4080 (32-lane): held 546 s with the builder on, no exceptions, and the shade is lit Setup: RTX 4080 16 GB (driver 32.0.16.1088), Ryzen 9 7900X, 32 GB, Windows 11 26200, diag build, Series X profile. Tree:
Two card tests beside the PR's own, both on the RTX 4080 and on a Ryzen 7900X iGPU (gfx1036), host waves of 32 (neither device took the 64-lane form of these programs, so that mode did not run here):
Independent of the thread (found before I read its later half), in case it helps a reviewer:
What comes next on this card: One thing for whoever merges: AI-assisted (Claude Code); measured on my machine. No game data. |
…d groups (fxceless#16) Console DispatchX(x, y, z, flags) sets COMPUTE_DISPATCH_INITIATOR bit 5 (0x20, USE_THREAD_DIMENSIONS) when passing raw thread counts instead of thread-group counts, with hardware EXEC masking trailing lanes in partial tail groups. Previously list.rs ignored flags and passed raw thread counts as full groups, causing up to 64x over-dispatch and wrong entry EXEC popcount/reductions in the ray-tracing structure builder. - victory-gpu: forward DispatchX flags, record compute [numthreads] on Translated, convert thread dimensions with div_ceil, and pass partial axis limits via USER_DISPATCH_THREADS (0x104). - victory-shader: add entry partial-thread masking for spilled compute shaders (early-exit before body_entry when barrier- and exchange-free, or predicated active masking for group barriers and wave64-over-wave32 LDS exchange so both 32-lane halves stay alive for group_sync). - Tests: unit test for thread-to-group conversion in draw.rs and hardware GPU test verifying entry s_bcnt1_i32_b64(exec), whole-wave OR, and lane bounds for both host_max_wave=64 and host_max_wave=32.
|
Thanks @Revens2 and @pr0vId3nce for the thorough 32-lane hardware and in-game verifications (RTX 5070 600 s and RTX 4080 546 s with zero exceptions and lit shade)! I've rebased this PR onto latest \main\ (\ca8829f, now commit \36a2257) to resolve the conflict in \crates/victory-gpu/src/draw.rs's unit tests, and moved \effect_guard\ and \dispatch_threads_prologue\ into a small child module \crates/victory-shader/src/emit/dispatch.rs\ (same #[path = ...]\ pattern as \intersect.rs). That brings \lower.rs\ down to 517,044 bytes (+2,204 bytes over \main's 514,840, leaving >7 KiB of headroom under the 512 KiB \xtask policy\ limit) so it combines more easily with #36 / #156. Re-verified on RX 9070:
@pr0vId3nce I'd gladly include your multi-group wave-reduction / prefix-sum test (limits 70, 100, 33, 1, none) if you'd like to share it as a patch or gist. |
170c242 to
36a2257
Compare
…t-and-prefix-validation Shaders: fix whole-wave EXEC inline constant sign-extension and prefix lane validation
|
Two portable RTX 3050 Laptop (wave32) checks for review at 36a2257, using synthetic inputs:
Hardware runs used the PR integrated onto local 504db0e. Both standalone patches apply to the PR head. No game files or scene-quality measurements in these tests. AI-assisted. |
Problem
In
crates/victory-gpu/src/list.rs,DispatchX(x, y, z, flags)ignoredflagsand forwarded(x, y, z)directly toID3D12GraphicsCommandList::Dispatch(x, y, z)as thread-group counts.The ray-tracing structure builder calls
DispatchXwith bit 5 (0x20=COMPUTE_DISPATCH_INITIATOR::USE_THREAD_DIMENSIONS, e.g.0x0020/0x8020) set. In that mode:(x, y, z)are raw thread counts, not thread-group counts.DTid >= count) are masked off in initial hardwareEXEC.Treating raw thread counts as full 64-thread groups caused:
EXECpopcounts (s_bcnt1_i32_b64(exec)returning 64 instead of the partial count) and unmasked whole-wave reductions on partial tail waves.Fix
victory-gpucrates/victory-gpu/src/pipeline.rs: store compute[numthreads(x, y, z)]onTranslated.crates/victory-gpu/src/list.rs: forwardflagsfromdispatch_xtostate::dispatch_x.crates/victory-gpu/src/draw.rs: whenflags & 0x20 != 0(USE_THREAD_DIMENSIONS), skip zero-sized dispatches, convert raw thread counts to host group counts viadiv_ceil, and supply any non-multiple axis limits through host user-data dwordUSER_DISPATCH_THREADS(0x104,0= no cap for normalDispatchor exact multiples).victory-shadercrates/victory-shader/src/emit/shader.rs&mod.rs: define and exportUSER_DISPATCH_THREADS = 0x104.crates/victory-shader/src/emit/lower.rs: adddispatch_threads_prologuefor spilled compute programs (all ray-tracing structure builder stages) along any axis with group dimension > 1:exchange.is_none(), entry block has no back-edge — native Wave64 hosts and Wave32 programs): branch inactive lanes out toRetafter entry inputs (groupId, relabelledthread_id), and place entry-EXECballots/SCC tests inbody_entryso hardwareEXEC,s_bcnt1_i32_b64(exec), wave reductions, and stores see the exact active lane set with zero per-instruction guard overhead.exchange.is_some()for wave64-on-wave32 hosts, or programs containings_barrier): keep all threads alive soGroupMemoryBarrierWithGroupSync/exchange_halvesnever deadlock (even whenlimit <= 32leaves the upper 32-lane half with 0 active lanes), while predicating memory/LDS accesses (effect_guard), active ballots (mask_dword),scc_some,wave_wide, and whole-wave reduction masks (section_val).Verification
draw::tests::dispatch_x_thread_dimensions_convert_to_groups_and_partial_limitsincrates/victory-gpu/src/draw.rs.emit::wave64_tests::spilled_compute_masks_partial_dispatch_threads_on_wave64_and_wave32incrates/victory-shader/src/emit/wave64_tests.rstestings_bcnt1_i32_b64(exec), whole-wave OR, and unconditional per-lanebuffer_store_dwordx2atlimit = 45, 1, 0:host_wave=64(early-exit) andhost_wave=32(predicatedexchange_halves, no barrier hang atlimit = 1), both validated bydxil.dll.cargo test -p victory-shader --lib(215 passed, 0 failed),cargo test -p victory-gpu(119 passed, 0 failed),cargo xtask policy(asset policy: 169 files ok).VICTORY_BVH_BUILDER=1on AMD Radeon RX 9070: eliminates the BVH over-dispatch memory corruption crash (previously crashing within ~7–14 s on empty box-node bounds); sustained 2+ minutes / 8,900+ submissions of builder execution with zero CPU memory corruption.Refs #16.
AI-assisted (Antigravity); verified locally on an AMD Radeon RX 9070. No game data.