Formats: eliminate BCPack per-call allocations and optimize streaming decode #703
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!703
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-703"
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?
@wbkepler on GitHub · 2026-11-24 07:07 UTC · original
wbkepler:formats/bcpack-fast-decode→main· +764 −384 · 1 files · 1 commits · openSummary
Eliminates per-call heap allocations and optimizes streaming BCPack decompression in
crates/victory-formats/src/bcpack.rs(0 unsafe,Tablesuntouched):bcpack::Workspacebacked by a re-entrancy-safe thread-localWorkspaceinbcpack::decode.recordsbuffer and two-pass decode with const-genericlanes_stream<N, PER, STRIDE>streaming stack records straight into block decoders.Lane::stepwith cold control-phase split, branchless 8-way bucket lookup, and direct remainder math.BC6Hwide loops with compile-time LUTs (SPREAD4,SPREAD8,NIBBLES_EVEN_FIRST), precomputed plain-format masks, and 16-bitanchor_maskinbc7_pack(+40–52% single-core release throughput across BC1/BC4/BC6H/BC7).Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passed (victory-formats: 23/23 including exhaustive 128x65536 rANS equivalence, all-6-format workspace reuse, and LUT equivalence tests)cargo xtask policy— passed (151 files ok)@molodayamama on GitHub · 2026-11-24 14:04 UTC · original
Independent Windows check of
d45b04b0ab07daf732a2cd9dc85df9d5c9471de8(Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).After a fresh build of the PR's
victory-formats, I ran the three new synthetic regressions withcargo test --locked -p victory-formats --lib -- workspace_reuse_matches_fresh_decode_across_all_formats rans_step_matches_reference_formula_for_all_models_and_slots bit_lookup_tables_match_reference_bit_ops --test-threads=1 --nocapture. All three passed. They check workspace reuse against fresh decodes, the rANS step against its reference formula, and the bit tables against direct bit operations. No throughput comparison or external reference chunks.Only source-built synthetic fixtures were used. AI-assisted verification.
@Marvisak on GitHub · 2026-11-25 01:25 UTC · original
Automated triage for the maintainers.
Needs work.
This rewrites most of
victory-formats/src/bcpack.rs(+764/−384) for speed. That is worth having, but the change needs evidence that the output stays the same:workspace_reuse_matches_fresh_decode_across_all_formatscompares the new code with itself (reused vs freshWorkspace), andreference_chunksstays ignored. Please add a differential test that checks the newdecodeagainstmain's decode, byte for byte, on synthetic streams for BC1/3/4/5/6/7. It should include every BC6H mode and BC7 control codes. Alternatively, report areference_chunksrun on both versions.main,decodedecodes every record before writing any block, so a short stream leavesdstuntouched. With streaming it writes blocks before the error. The only caller,dstorage.rs(bcpack::decodeinsideinto_destination), passes title memory, so a failed request now leaves partial data where the title expects none. Please keepmain's behaviour or explain why the change is fine.try_borrow_mutfallback inbcpack::decodeguards against re-entry, which cannot happen (decodedoes not call itself). Please drop it, along with the per-thread buffers kept for the thread's lifetime, unless measurements show a need.CI: no check runs are recorded for this head.
Generated by Claude Code
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.