formats(bcpack): add strip-streaming, branchless rANS, and fast BC1-BC7 decode #90
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!90
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/90/head"
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?
@Androtim on GitHub · 2026-11-29 08:36 UTC · original
Androtim:feat/iter91-bcpack-strip-streaming-fast-decode→main· +2697 −694 · 1 files · 1 commits · merged 2026-11-29 13:06 UTCSummary
Adapted from upstream
VIctory-NVIDIA(b075af8/c777d87, GPL-3.0), rebased cleanly ontoorigin/main(5d40f8b) with zero overlap against open PRs and zerounsafecode:crates/victory-formats/src/bcpack.rs): Decodes 256 blocks per strip so intermediate symbol buffers stay in L1 cache instead of allocating multi-megabyte per-stream vectors.ModelTablewith heap-allocated large tables and fast SWAR/LUT BC1–BC7 block reconstruction, preservingorigin/mainBC7 dictionary index parsing (skip unused widths word viar.u16();and read&mut ix.ix.as_flattened_mut()[..31]),bc7_dictionary_indices_line_up, and mode 4/5 rotation fixes (6726920).mod ref_oracle::RefTables::parse()matchingorigin/main's BC7 dictionary index parsing (r.u16();+[..31]) so all parity tests validate strictly againstorigin/mainsemantics.Verification
cargo xtask policy:asset policy: 303 files okcargo test -p victory-formats --lib --locked -- bcpack::: 15 passed; 0 failed; 3 ignored (including all 4oracle_parity_*tests,bc7_dictionary_indices_line_up, andbc7_rotation_applies_only_to_modes_4_and_5)cargo test -p victory-formats --lib --release --locked -- bcpack_throughput --ignored --nocapture:BC1: 174.0 MB out/s(46.0 ns/block),BC4: 169.1 MB out/s(47.3 ns/block),BC7: 100.8 MB out/s(158.7 ns/block)BC1 41.7,BC3 42.1,BC4 40.2,BC5 41.5,BC6 27.5,BC7 28.6MB out/scargo clippy --workspace --all-targets -- -D warnings&--features diagnostics: 0 warnings--release+objdump -p: standard Windows system DLLs onlypr91-bcpack-fast-decode): 10/11 gates PASS (0crashes,0host texture errors)11.9 fps(83.9 ms, vs8.9 fpsbaseline,+3.00 fps)5767 MB/6962 MBbudget (over=0 MB,-97 MBvs baseline)3414(vs7121baseline) |mapped()stall rate:7.27 ms/suntranslated=1frame-8614.png,frame-8638.png, median luma103.91, edge energy7.05,0.0%near-black/magenta): crisp streamed textures with zero corruption.275vs261.0baseline):bcpack.rsdoes not touch shaders/pipelines; steady-state windows showed0 being made/0 repeat-waits skipped, and 100% of drops were intentionally skipped passes (ray-tracing structure builder, which is off:260.2–300.5/frame +VICTORY_LEAVE_OUT:2.0/frame).@Androtim on GitHub · 2026-11-29 09:05 UTC · original · edited 2026-11-29 11:05 UTC
Automated triage for the maintainers (not an approval).
Verdict:
merge-candidate· CI (check):passingReview Summary
Reviewed
crates/victory-formats/src/bcpack.rsagainstorigin/main. The change is a clean, zero-unsafeoptimization of the BCPack decoder (256-block strip streaming, cache-line-aligned branchless rANS tables, and specialized SWAR/LUT BC1–BC7 decoders) with a verbatimref_oracletest module for bit-exact parity.Verified Details
ModelTable,BucketEntry,Lane::decode_symbol): Folding bucket 0 (eff_start = 1,eff_freq = f[0] - 1,recip = 0) and rewriting(x >> 16) * f + (offset - q * f)as((x >> 16) - q) * f + offset(mod2^{32}) is algebraically identical toorigin/main, including theslot == 0case.last_slotterminates atu16::MAXfor the last used bucket and sentinel tail.lanes_strip): Guarding the fast loop onall_payload && min_left > 1formin_left - 1rounds guaranteeslane.left >= 1throughout, so fragment-end transitions cannot occur mid-burst, andstalled/taken/src_postransitions match the slow path.swar_add2,swar_bc1_code,swar_add3,swar_bc4_code,pack_quad_table/quads_packed,pack_pair_table/pairs_packed,Bits::put_unmasked,decode_index_set, andbc7_pack_indices(including thew.at + 15 * bits < 128shift bound) matchorigin/mainsemantics.origin/mainfixes & stack safety: Keepsrotation(ctrl)restricted to BC7 modes 4/5 and preserves BC7 dictionary index parsing (r.u16();+[..31]) in bothTables::parseandref_oracle::RefTables::parse. Large tables (models,ctrl7_meta) and BC6/BC7 history rings are heap-allocated viaalloc_boxed_array.crates/victory-formats/src/bcpack.rs, and there is no overlap with other open PRs.Verdict
merge-candidate— pure CPU format decoder optimization with passing CI and no GPU/shader/host changes requiring a separate real-GPU gate.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 09:27 UTC · original
Addressed the
minivi-triagefeedback at07aa2fa(rebased ontoorigin/main5d40f8b):origin/main's BC7 dictionary index parsing (r.u16();followed by&mut ix.ix.as_flattened_mut()[..31]) in bothTables::parse()andref_oracle::RefTables::parse().origin/main'sbc7_dictionary_indices_line_uptest and doc comment, keeping PR #90 strictly bit-exact withorigin/main.origin/mainsemantics rather than stale upstream SHAs.Re-verified locally & on CI:
cargo xtask policy:asset policy: 303 files okcargo test -p victory-formats --lib --locked -- bcpack::: 15 passed; 0 failed; 3 ignored (includingbc7_dictionary_indices_line_upand all 4oracle_parity_*tests)cargo clippy --workspace --all-targets --locked -- -D warnings&--features diagnostics: 0 warnings--release+objdump -p: standard Windows system DLLs onlycheck: SUCCESS (https://github.com/Androtim/MiniVI/actions/runs/46246507434 — initial failure was an unrelatedvictory-gpuland::testsaccess violation flake; failed job rerun passed cleanly)