perf: card_before splits ranges into flat masks, packs block masks by word and joins piece runs as they come #360
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!360
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-360"
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?
@Skyfrye on GitHub · 2026-11-26 13:05 UTC · original
Skyfrye:nep/card-masks-flat→main· +154 −41 · 2 files · 1 commits · openChange
In
Host::card_before, which runs on the submitting thread once per submission for copies in the card's memory:masked_blocksmade aVecfor every 4 KiB block it sends by mask; the blocks now index one flat list of ranges (MaskedSplit).block_maskset a mask's bits one byte at a time; it now fills 64-bit words. The bytes out are the same, and a test compares them with the old form.rehash_runsor many runs under shader writes, a copy's ranges became aVecof piece runs thatjoined_piece_runsthen sorted and joined (tens of thousands of two-byte runs in the world). They are now joined as they come (joined_piece_runs_iter), since they arrive in order. Out-of-order input falls back to the old join.joinedandjoined_piece_runsskip the sort when their input is already in order.The output is the same for every input. Only the allocations and the work on the submitting thread change.
Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), on upstream
mainat8ed1109, fromthird_party/victory:The tests:
crowded_blocks_go_up_by_mask_and_the_rest_as_copieschecks the flat split for bothleastpaths, including ranges cut at block edges. It also checks the word-packed mask against the old byte-by-byte form at the block's edges and at 63/64-bit boundaries.piece_runs_join_without_losing_or_adding_pieceschecks that the streaming join, fed sorted and unsorted input, equals the old join.These tests do not build without the change.
In the world, my copy of the game, Series X,
VICTORY_INDIRECT_RAW=3, the launcher's switches (VICTORY_WIDE_REFRESH=1among them): one run of 300 s with this PR stacked with the other parts of the same split (#360, #361, #362) and #278, #279, #291, #292, #307, onmainat8ed1109.main. There was no exception and no device lost.Oracle and test data
No game file.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: the code was written with Antigravity (Google's AI IDE, model gemini-4-neon-medium) in commit 22d77e4 of a local branch. Claude Opus 5.5, in Claude Code, reduced it to this change, ported it to
main, reviewed it (with a separate Claude Opus 5.5 review of the whole commit), ran the checks and the game, and wrote this description.🤖 Generated with Claude Code
@LooperSalty on GitHub · 2026-11-26 14:34 UTC · original
Diff read, nothing run. This PR changes the card_before range and block-mask code in
victory-gpu/src/host.rsandshadow.rsbut adds no test (rule 5 of AGENTS.md: a new behaviour comes with a test that fails without it). Please add a unit test that checks the flat masks, the word packing and the piece-run joining against the previous implementation on the same ranges, then CI can run on the updated branch.🤖 Generated with Claude Code
@LooperSalty on GitHub · 2026-11-26 15:41 UTC · original
This PR now conflicts with main in
third_party/victory/crates/victory-gpu/src/host.rs(main moved with #358, #377 and #386). Please rebase on main, re-run the victory-gpu tests and force-push your branch.🤖 Generated with Claude Code
8f7374fc12to12c9f291ad@Skyfrye on GitHub · 2026-11-26 16:02 UTC · original
Rebased onto
mainatf9f1181, over #383. #383 moved the hash passes into itshash_passesclosure; this PR's streaming join of piece runs (joined_piece_runs_iter) now runs inside that closure. So it applies withVICTORY_CARD_SYNC_BATCHon (as #386 sets it) and off. The flat masks, the word-packed block masks and the sort skip inshadow.rsapplied as they were, and #383'sdeclared_inincard_beforeis untouched. Checks on8473267(nothing inthird_party/victorychanged from there tof9f1181): release build with only main's 2 warnings;mask_tests card_tests8 passed under WARP. The ignoredtwo_dirty_card_buffers_reach_readback_in_the_same_submissionpassed withVICTORY_CARD_SYNC_BATCH=0and=1. The full lib suite with #383's switches on gave 236 passed and 3 failed (the 3 that fail on main). The in-game figures in the description are from before the rebase. Rebase done by a Claude Opus 5.5 subagent, checked by Claude Opus 5.5.@LooperSalty on GitHub · 2026-11-26 17:26 UTC · original
Nit:
block_masknow clamps withsaturating_subandmin. A range outside its block no longer fails: it sets bits from the block's start, where the old form panicked on underflow.masked_blocksguarantees the containment, so adebug_assert!that each range lies in[base, base + 4096)would keep a violation loud in debug builds.🤖 Generated with Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.