Skip to content

Formats: stream BCPack decoding without per-call allocations - #17

Merged
devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1795563955-rx580-performance
Nov 25, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1795563955-rx580-performance

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Port upstream Marvisak/VIctory#703 as the first RX 580-targeted CPU-side texture-streaming optimization.

BCPack decoding now:

  • reuses a re-entrancy-safe thread-local Workspace instead of allocating history buffers per call;
  • streams lane records directly into block decoders instead of materializing a multi-MiB intermediate records buffer;
  • uses precomputed lookup tables for lane bucket lookup, bit interleaving, nibble ordering, plain-format masks and BC7 anchors;
  • documents that dst contents are unspecified when decode fails.

This is aimed at the user's 30 fps target on Ryzen 5 4600G / 16 GB / RX 580 8 GB: compressed texture streaming is CPU-side work competing with memory copies, shader translation and pipeline compilation.

Local synthetic benchmark on this VM (cargo test --release -p victory-formats bcpack_throughput -- --ignored --nocapture, before -> after):

format before after throughput
BC1 70.7 MB/s 89.0 MB/s +25.9%
BC4 69.9 MB/s 84.9 MB/s +21.5%
BC7 38.2 MB/s 53.0 MB/s +38.7%

Upstream also reports +40-52% single-core throughput and a 60,000-input differential run with byte-identical successful outputs; the crate now includes workspace/rANS/LUT equivalence regressions.

Validation on this Linux VM:

  • cargo test --locked -p victory-formats (27 passed, 4 ignored)
  • cargo clippy --locked --all-targets -p victory-formats -- -D warnings
  • cargo fmt --all -- --check
  • CARGO_FEATURE_PURE=1 RUSTFLAGS='-D warnings' cargo check --locked --workspace --all-targets --target x86_64-pc-windows-msvc
  • Windows-target clippy with --all-features and -D warnings
  • cargo run --locked --quiet --package xtask -- policy

Not run with the title, real GPU, Wine/Proton, or game data here. Marvisak/VIctory#1500 remains a larger follow-up: it conflicts with this fork's newer subresource-level texture invalidation and needs a careful semantic merge rather than a direct port.

Link to Devin session: https://app.devin.ai/sessions/75bbf6b4192940fea34014b13a016bee
Open in Devin Desktop: https://app.devin.ai/desktop/session/75bbf6b4192940fea34014b13a016bee?variant=devin
Requested by: @Personed

Port upstream Marvisak/VIctory#703.

BCPack decode now reuses a thread-local workspace, streams lane records instead of materializing a multi-MiB intermediate buffer, and uses precomputed lookup tables for bit interleaving and masks. This reduces CPU cost while texture assets stream in, directly relevant to the 6-core Ryzen target.

Local synthetic benchmark on this VM, median test output before -> after: BC1 70.7 -> 89.0 MB/s, BC4 69.9 -> 84.9 MB/s, BC7 38.2 -> 53.0 MB/s. Output equivalence is covered by the upstream differential testing and the crate's rANS/workspace regression tests.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot merged commit 616705b into main Nov 25, 2026
4 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the devin/1795563955-rx580-performance branch November 25, 2026 04:42
devin-ai-integration Bot added a commit that referenced this pull request Nov 25, 2026
main gained PR #17 (streaming BCPack decode) while this integration
was in flight. Resolved in favour of the fxceless tree as with the
rest; the streaming-decode improvement is a candidate for re-porting
as a follow-up since their formats crate diverges.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration Bot added a commit that referenced this pull request Nov 25, 2026
main moved meanwhile: the other sessions' rx580 work — mesh shader
emulation (#25/#26), barrier coalescing (#23), parallel refreshes
(#22), repeated-close tolerance, streaming BCPack (#17). Resolved in
favour of the fxceless tree as before: those features are main-only
and depend on this fork's old emit architecture, so each is a
re-port follow-up on the new base. Mesh emulation is the top
priority of those — it is the RX 580 unblocker.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Personed added a commit that referenced this pull request Nov 25, 2026
…e tolerance (#25) (#40)

* Re-port onto the fxceless base: stream BCPack decoding without per-call allocations (#17)

3-way cherry-pick of 616705b (the pre-integration tree); conflict in
the test module union-merged (kept both the workspace-reuse test and
the bc7 dictionary test).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Re-port onto the fxceless base: tolerate a repeated command-list close (#25)

Same semantics as the pre-integration port: the console tolerates a
second Close, host D3D12 fails it as E_FAIL. The guard is the
AtomicBool on HostList; reset() clears it since lists are reused.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: stoltembergg <stoltembergg@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant