BCPack: stop completed lanes from taking another lane’s bytes #2648

Open
github-bot wants to merge 1 commit from github-bot/gh-2648 into main AGit
Owner

@⁠chaseb64 on GitHub · 2026-11-25 17:30 UTC · original
chaseb64:formats/bcpack-stream-audit → main · +48 −8 · 1 files · 1 commits · open

Summary

A lane can deliver its final symbol before its peers. Starting another fragment on that lane can consume a peer’s pending header or payload. Let the lane finish consuming its declared payload, including optional trailing renormalization bytes, then leave future bytes for the other lanes. NEW-100 coordination claim

deliver the last requested symbol
  consume any bytes remaining in the current payload
  leave the next header for a lane with work outstanding

Evidence

On main at 940d32f, a valid one-block BC1 stream failed with “the stream ends early or is corrupt”. At byte 52 the reference feeds lane 8 while main feeds lane 0. The corrected public decoder emits 00 00 00 00 aa aa aa aa. A separate source-generated BC4 regression exercises the entire decode path, and a two-lane case detects dropping a declared payload byte after the final symbol. The reference was Ahmet Dedeler’s bcpack-rs, checked against the output-count behavior in Microsoft’s single-lane RTL. bcpack-rs · Microsoft RTL

On the original pre-rebase revision (d70171b604cfb4a3c0a0019c4d3bf254ec81f34e), the standalone candidate repaired all 16 early errors in a 53-stream corpus while six separate unflushed-refill cases still returned incorrect records; on native Windows the formats suite passed 40 tests, the focused DirectStorage suite passed 14, and workspace tests, both Clippy configurations and asset policy passed. Baseline Windows run · Standalone Windows run

On the pre-rebase combined revision (42a4e75b55de7f84e0eca2c113f87a314d678082), the native #2057 guest title also delivered the expected one-block BC1 texture (upstream returned HRESULT 0x8007000d on that same request; the other ten campaign checks passed on both), and the 5,031-stream entropy campaign passed (5031 streams; 37130 blocks; 841536 symbols; 247758 fragments; 0 subject errors; 0 record mismatches). Paired native run

Rebase onto main (63bcca43c6a00a758510398fa43096ce7e4f7df0)

Rebased cleanly onto main (63bcca43c6a00a758510398fa43096ce7e4f7df0) at fbf875e0730d3e8e9bd5dcf8054bac2e84e1227a, preserving upstream #2036 (bc1_endpoint_prediction_and_quadrant_order) and the original validated commit d70171b604cfb4a3c0a0019c4d3bf254ec81f34e (whose historical native Windows runs 45579091079, 45582050258, 45583602232, and 45665538370 apply to the pre-rebase revision and were not re-run on native Windows after rebasing). Between d70171b and 63bcca4, rust-toolchain.toml and Cargo.lock are unchanged, and the only changes in crates/victory-formats are #2036 (bcpack.rs) and #1205 (xma/tables.rs).

New Linux verification on rebased commit fbf875e (OrbStack rustc 1.98.1):

  • cargo test --locked -p victory-formats: 48 passed, 0 failed, 5 ignored (both debug and --release; bcpack::tests 12 passed, 0 failed, 2 ignored; bcpack_throughput passed).
  • Negative control (removing only the continue guard in lanes()): 8 passed, 4 failed (a_last_symbol_can_precede_its_final_payload_bytes, finished_lanes_leave_the_remaining_payload_for_their_peers, bc7_mode6_block, every_layout_round_trips_through_the_lanes), 2 ignored.
  • cargo clippy -p victory-formats --all-targets --locked -- -D warnings: clean across default and --all-features on both Linux native and --target x86_64-pc-windows-msvc.
  • cargo test --locked -p xtask (6 passed) and cargo xtask policy (asset policy: 191 files ok): passed.
  • Composition with companion PR #2649 (4227973): auto-merges cleanly and passes cargo test --locked -p victory-formats (49 passed, 0 failed, 5 ignored) and Clippy (-D warnings).

Merge Danger

Reversible. This changes byte ownership at the end of a stream for every supported BC format. Both regressions are portable and use source-generated data. PR #703 has a separate streaming scheduler and would need the equivalent behavior if adopted. Retail incidence and rendering impact are unmeasured. PR #703

AI-assisted using OpenAI Codex and Google Antigravity in T3 Code. For the original revision (d70171b), OpenAI Codex GPT-6.2 Astra (Ultra and High) implemented and independently reviewed the scheduler correction, and GPT-6.2 Sol (High) and GPT-6 Luna (Medium) contributed format, runtime, performance and cross-platform validation. For the rebase onto 63bcca4 (fbf875e), Google Antigravity (gemini-4-neon, requested thought_level: high; gemini-4-hydrogen, requested thought_level: high and medium) coordinated, implemented the minimal rebase, and executed Linux/OrbStack validation, while OpenAI Codex (gpt-6.2-astra, verified executedModel: gpt-6.2-astra, requested reasoningEffort: high) independently reviewed the rebased resolution.

**@⁠chaseb64** on GitHub · 2026-11-25 17:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648) `chaseb64:formats/bcpack-stream-audit` → `main` · +48 −8 · 1 files · 1 commits · open ## Summary A lane can deliver its final symbol before its peers. Starting another fragment on that lane can consume a peer’s pending header or payload. Let the lane finish consuming its declared payload, including optional trailing renormalization bytes, then leave future bytes for the other lanes. [NEW-100 coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) ```text deliver the last requested symbol consume any bytes remaining in the current payload leave the next header for a lane with work outstanding ``` ## Evidence On main at `940d32f`, a valid one-block BC1 stream failed with “the stream ends early or is corrupt”. At byte 52 the reference feeds lane 8 while main feeds lane 0. The corrected public decoder emits `00 00 00 00 aa aa aa aa`. A separate source-generated BC4 regression exercises the entire decode path, and a two-lane case detects dropping a declared payload byte after the final symbol. The reference was Ahmet Dedeler’s bcpack-rs, checked against the output-count behavior in Microsoft’s single-lane RTL. [bcpack-rs](https://github.com/Ahmet-Dedeler/bcpack-rs/tree/b1c3099a3402de8b76c9263a828791bd8bc0c930) · [Microsoft RTL](https://github.com/microsoft/silicon-rans/blob/2f6827d/mdu_minirans.v#L1143-L1180) On the original pre-rebase revision (`d70171b604cfb4a3c0a0019c4d3bf254ec81f34e`), the standalone candidate repaired all 16 early errors in a 53-stream corpus while six separate unflushed-refill cases still returned incorrect records; on native Windows the formats suite passed 40 tests, the focused DirectStorage suite passed 14, and workspace tests, both Clippy configurations and asset policy passed. [Baseline Windows run](https://github.com/chaseb64/VIctory/actions/runs/45579091079) · [Standalone Windows run](https://github.com/chaseb64/VIctory/actions/runs/45582050258) On the pre-rebase combined revision (`42a4e75b55de7f84e0eca2c113f87a314d678082`), the native #2057 guest title also delivered the expected one-block BC1 texture (upstream returned HRESULT 0x8007000d on that same request; the other ten campaign checks passed on both), and the 5,031-stream entropy campaign passed (`5031 streams; 37130 blocks; 841536 symbols; 247758 fragments; 0 subject errors; 0 record mismatches`). [Paired native run](https://github.com/chaseb64/VIctory/actions/runs/45583602232) ### Rebase onto `main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) Rebased cleanly onto `main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) at `fbf875e0730d3e8e9bd5dcf8054bac2e84e1227a`, preserving upstream `#2036` (`bc1_endpoint_prediction_and_quadrant_order`) and the original validated commit `d70171b604cfb4a3c0a0019c4d3bf254ec81f34e` (whose historical native Windows runs `45579091079`, `45582050258`, `45583602232`, and `45665538370` apply to the pre-rebase revision and were not re-run on native Windows after rebasing). Between `d70171b` and `63bcca4`, `rust-toolchain.toml` and `Cargo.lock` are unchanged, and the only changes in `crates/victory-formats` are `#2036` (`bcpack.rs`) and `#1205` (`xma/tables.rs`). New Linux verification on rebased commit `fbf875e` (OrbStack `rustc 1.98.1`): - `cargo test --locked -p victory-formats`: 48 passed, 0 failed, 5 ignored (both debug and `--release`; `bcpack::tests` 12 passed, 0 failed, 2 ignored; `bcpack_throughput` passed). - Negative control (removing only the `continue` guard in `lanes()`): 8 passed, 4 failed (`a_last_symbol_can_precede_its_final_payload_bytes`, `finished_lanes_leave_the_remaining_payload_for_their_peers`, `bc7_mode6_block`, `every_layout_round_trips_through_the_lanes`), 2 ignored. - `cargo clippy -p victory-formats --all-targets --locked -- -D warnings`: clean across default and `--all-features` on both Linux native and `--target x86_64-pc-windows-msvc`. - `cargo test --locked -p xtask` (6 passed) and `cargo xtask policy` (`asset policy: 191 files ok`): passed. - Composition with companion PR #2649 (`4227973`): auto-merges cleanly and passes `cargo test --locked -p victory-formats` (49 passed, 0 failed, 5 ignored) and Clippy (`-D warnings`). ## Merge Danger **Reversible.** This changes byte ownership at the end of a stream for every supported BC format. Both regressions are portable and use source-generated data. PR #703 has a separate streaming scheduler and would need the equivalent behavior if adopted. Retail incidence and rendering impact are unmeasured. [PR #703](https://git.gtahub.st/github/Marvisak--VIctory/pulls/703) AI-assisted using OpenAI Codex and Google Antigravity in T3 Code. For the original revision (`d70171b`), OpenAI Codex GPT-6.2 Astra (Ultra and High) implemented and independently reviewed the scheduler correction, and GPT-6.2 Sol (High) and GPT-6 Luna (Medium) contributed format, runtime, performance and cross-platform validation. For the rebase onto `63bcca4` (`fbf875e`), Google Antigravity (`gemini-4-neon`, requested `thought_level: high`; `gemini-4-hydrogen`, requested `thought_level: high` and `medium`) coordinated, implemented the minimal rebase, and executed Linux/OrbStack validation, while OpenAI Codex (`gpt-6.2-astra`, verified `executedModel: gpt-6.2-astra`, requested `reasoningEffort: high`) independently reviewed the rebased resolution.
Keep reading a finished lane’s declared payload, then stop it from taking a new fragment header. Exercise both the independent one-block schedule and an untrimmed terminal refill.

AI-assisted using OpenAI Codex GPT-6.2 Astra (Ultra and High).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:11 +00:00
github-bot force-pushed github-bot/gh-2648 from d70171b604 to fbf875e073 2026-11-26 06:29:58 +00:00 Compare
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:48 UTC · original

Reviewed against #2649 — complementary, not overlapping: this fixes the schedule loop (a finished lane on the last symbol no longer opens a header request that would steal a peer's bytes), while #2649 fixes the in-lane phase machine (a partial refill below LOW drains for one step across the boundary instead of ending the fragment). Both are needed for correct fragment-boundary behavior. The regression tests here exercise the byte-order swap that occurs when lane 0's early request shifts lane 1's header. CI green.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7170032864) Reviewed against #2649 — complementary, not overlapping: this fixes the schedule loop (a finished lane on the last symbol no longer opens a header request that would steal a peer's bytes), while #2649 fixes the in-lane phase machine (a partial refill below LOW drains for one step across the boundary instead of ending the fragment). Both are needed for correct fragment-boundary behavior. The regression tests here exercise the byte-order swap that occurs when lane 0's early request shifts lane 1's header. CI green.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 17:58 UTC · original

Independent verification of head d70171b604cfb4a3c0a0019c4d3bf254ec81f34e (merge-base 940d32f6, one commit) merged onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca.

  • Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1 (48a229cea 2026-09-01), -j 4, CPU-only.
  • Diff: bcpack.rs lanes() (a lane with its last symbol out and no payload left does not start another header), a test-helper change, and 2 tests. Merges cleanly.
  • cargo clippy --locked -p victory-formats --all-targets: no warnings.
  • cargo test --locked -p victory-formats: 40 passed, 0 failed, 5 ignored (origin/main: 38/0/5).
  • Composition with #2649 (both edit bcpack.rs): both merged onto origin/main auto-merge with no conflict; clippy clean; 41 passed, 0 failed, 5 ignored (38 + 3 new tests, all passing together). #2649 alone: 39/0/5. They compose cleanly.
  • Negative control: with the tests kept and the new continue block removed, 4 tests fail: both new ones (a_last_symbol_can_precede_its_final_payload_bytes, finished_lanes_leave_the_remaining_payload_for_their_peers) and, because the stream() helper no longer appends filler bytes, bc7_mode6_block and every_layout_round_trips_through_the_lanes ("a lane read past its fragment"). The existing round-trip tests therefore enforce the fix too.
  • Found: no bugs.

Independent verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or shader names were used. Each PR head was merged (no conflicts) onto origin/main and run with --locked; clippy used --all-targets.

**@⁠oni-swr** on GitHub · 2026-11-25 17:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7170255648) **Independent verification** of head `d70171b604cfb4a3c0a0019c4d3bf254ec81f34e` (merge-base `940d32f6`, one commit) merged onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca`. - Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1 (48a229cea 2026-09-01), `-j 4`, CPU-only. - Diff: `bcpack.rs` `lanes()` (a lane with its last symbol out and no payload left does not start another header), a test-helper change, and 2 tests. Merges cleanly. - `cargo clippy --locked -p victory-formats --all-targets`: no warnings. - `cargo test --locked -p victory-formats`: **40 passed, 0 failed, 5 ignored** (`origin/main`: 38/0/5). - **Composition with #2649** (both edit `bcpack.rs`): both merged onto `origin/main` auto-merge with no conflict; clippy clean; **41 passed, 0 failed, 5 ignored** (38 + 3 new tests, all passing together). #2649 alone: 39/0/5. They compose cleanly. - **Negative control:** with the tests kept and the new `continue` block removed, 4 tests fail: both new ones (`a_last_symbol_can_precede_its_final_payload_bytes`, `finished_lanes_leave_the_remaining_payload_for_their_peers`) and, because the `stream()` helper no longer appends filler bytes, `bc7_mode6_block` and `every_layout_round_trips_through_the_lanes` ("a lane read past its fragment"). The existing round-trip tests therefore enforce the fix too. - Found: no bugs. Independent verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or shader names were used. Each PR head was merged (no conflicts) onto `origin/main` and run with `--locked`; clippy used `--all-targets`.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 18:16 UTC · original

Tested d70171b6 merged onto main (13f91ca), both standalone and combined with #2649 (42279736, auto-merges cleanly without conflicts):

  • Standalone: cargo test -p victory-formats --lib bcpack — 11 passed, 0 failed, 2 ignored
  • Combined with #2649: cargo test -p victory-formats --lib bcpack — 12 passed, 0 failed, 2 ignored
  • cargo clippy -p victory-formats --all-targets -- -D warnings: clean (0 warnings)

Both standalone and combined paths look solid.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 18:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7170689158) Tested `d70171b6` merged onto `main` (`13f91ca`), both standalone and combined with #2649 (`42279736`, auto-merges cleanly without conflicts): - Standalone: `cargo test -p victory-formats --lib bcpack` — **11 passed, 0 failed, 2 ignored** - Combined with #2649: `cargo test -p victory-formats --lib bcpack` — **12 passed, 0 failed, 2 ignored** - `cargo clippy -p victory-formats --all-targets -- -D warnings`: clean (0 warnings) Both standalone and combined paths look solid.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:15 UTC · original · edited 2026-11-26 05:28 UTC

Automated triage for the maintainers.

Thanks for the rebase. fbf875e now merges cleanly, so the earlier needs-rebase no longer applies. In bcpack.rs lanes(), a lane that has delivered the last symbol and has no payload bytes left (lane.left == 0) no longer opens another header request, so it can't take a peer's header or payload bytes. The test helper stream() stops adding filler bytes for finished lanes, which means the existing round-trip tests now enforce the fix too. The two new tests cover both directions: finished lanes leave the bytes to their peers, and a lane still takes the trailing bytes of its last payload. The PR body cites public references for the schedule: bcpack-rs and Microsoft's single-lane rANS RTL. Independent runs in the thread report that it composes cleanly with #2649. CI: passing.

Verdict: merge candidate. Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7176130765) · edited 2026-11-26 05:28 UTC <!-- victory-triage v1 head=fbf875e0730d3e8e9bd5dcf8054bac2e84e1227a verdict=merge-candidate at=2026-11-26T05:28:06Z --> Automated triage for the maintainers. Thanks for the rebase. `fbf875e` now merges cleanly, so the earlier needs-rebase no longer applies. In `bcpack.rs` `lanes()`, a lane that has delivered the last symbol and has no payload bytes left (`lane.left == 0`) no longer opens another header request, so it can't take a peer's header or payload bytes. The test helper `stream()` stops adding filler bytes for finished lanes, which means the existing round-trip tests now enforce the fix too. The two new tests cover both directions: finished lanes leave the bytes to their peers, and a lane still takes the trailing bytes of its last payload. The PR body cites public references for the schedule: bcpack-rs and Microsoft's single-lane rANS RTL. Independent runs in the thread report that it composes cleanly with #2649. CI: passing. **Verdict: merge candidate.** Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠chaseb64 on GitHub · 2026-11-26 04:23 UTC · original

Rebased onto main (63bcca43c6a00a758510398fa43096ce7e4f7df0) at fbf875e0730d3e8e9bd5dcf8054bac2e84e1227a (original validated revision: d70171b604cfb4a3c0a0019c4d3bf254ec81f34e).

  • Resolved the mod tests add/add conflict in crates/victory-formats/src/bcpack.rs by keeping #2036 (bc1_endpoint_prediction_and_quadrant_order) untouched and placing PR #2648's two regression tests immediately after it; lanes(), stream(), and both regression tests are unchanged (git range-diff differs only by the context line preceding the new tests).
  • New Linux verification on fbf875e (OrbStack rustc 1.98.1): victory-formats passed 48/48 (0 failed, 5 ignored) in debug and --release, negative control reproduced all 4 expected failures, victory-formats Clippy (--all-targets -- -D warnings, default & --all-features, Linux & x86_64-pc-windows-msvc) passed, xtask / cargo xtask policy (191 files ok) passed, and composition with PR #2649 (4227973) merged cleanly and passed 49/49.
  • Independent review by OpenAI Codex (gpt-6.2-astra) approved preservation of the original decoder semantics. Historical native Windows runs (45579091079, 45582050258, 45583602232, 45665538370) apply to the pre-rebase revision (d70171b / 42a4e75), while upstream Windows CI on fbf875e is running now.
**@⁠chaseb64** on GitHub · 2026-11-26 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7182558208) Rebased onto `main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) at `fbf875e0730d3e8e9bd5dcf8054bac2e84e1227a` (original validated revision: `d70171b604cfb4a3c0a0019c4d3bf254ec81f34e`). - Resolved the `mod tests` add/add conflict in `crates/victory-formats/src/bcpack.rs` by keeping `#2036` (`bc1_endpoint_prediction_and_quadrant_order`) untouched and placing PR #2648's two regression tests immediately after it; `lanes()`, `stream()`, and both regression tests are unchanged (`git range-diff` differs only by the context line preceding the new tests). - New Linux verification on `fbf875e` (OrbStack `rustc 1.98.1`): `victory-formats` passed 48/48 (0 failed, 5 ignored) in debug and `--release`, negative control reproduced all 4 expected failures, `victory-formats` Clippy (`--all-targets -- -D warnings`, default & `--all-features`, Linux & `x86_64-pc-windows-msvc`) passed, `xtask` / `cargo xtask policy` (191 files ok) passed, and composition with PR #2649 (`4227973`) merged cleanly and passed 49/49. - Independent review by OpenAI Codex (`gpt-6.2-astra`) approved preservation of the original decoder semantics. Historical native Windows runs (`45579091079`, `45582050258`, `45583602232`, `45665538370`) apply to the pre-rebase revision (`d70171b` / `42a4e75`), while upstream Windows CI on `fbf875e` is running now.
Author
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 21:17 UTC · original · approved these changes

Verified on Linux (Rust 1.99.0)

Branch: current main (13f91ca) + this PR (merges cleanly).

  • cargo test --locked -p victory-formats: 40 passed, 5 ignored (benchmarks and the external-data tests).
  • With only the new continue guard in lanes removed (bcpack.rs:434-438) and the test changes kept, 4 tests fail: both new tests, plus every_layout_round_trips_through_the_lanes and bc7_mode6_block. The last two fail because the helper no longer appends the [0, 1, 0, 0] filler fragment: "a lane read past its fragment". So the new behaviour is pinned both by the new tests and by the reworked round-trip helper.
  • Together with #2649 (main + #2648 + #2649, no conflicts): 41 passed.
  • cargo clippy --locked --target x86_64-pc-windows-msvc -p victory-formats --all-targets -- -D warnings: clean, same as main.

Checked against the RTL

The cited mdu_minirans.v at 2f6827d backs the change. In DSTATE_PROCESSING the decoder keeps taking payload bytes after the last symbol until input_remaining reaches 0. Then, with output_remaining == 0, it goes to DSTATE_IDLE with done <= 1 (lines 1183-1195) instead of DSTATE_HDR0. So a finished lane drains its declared payload and never reads another header, which is what the guard implements. Main's assumption, written in the old helper comment, was that a finished lane keeps asking and is fed a filler fragment. Nothing in that RTL supports it.

I found no defect. Two small notes:

  • The guard continues before lane.stalled is recomputed and before lane.out.take(). That is fine for valid streams, because the lane has already delivered. A one-line comment saying the lane is done for good would stop a later edit from moving code under the guard.
  • This PR and #2649 both conflict textually with #2735 (BC7/BCPack speedup), which rewrites Lane::step. Whichever lands later needs a careful rebase, because the round-trip helper semantics change here.

Not verified

  • reference_chunks (needs VICTORY_BCPACK_TABLES / VICTORY_BCPACK_CASES): not run. I don't have title chunks. Running it on this branch is the one check that would show real title streams don't contain the filler fragments main used to expect.
  • The Windows guest runs linked in the description.

Reviewed with Claude Code.

**@⁠lcg007xd-c** on GitHub · 2026-11-25 21:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#pullrequestreview-6065109323) · **approved these changes** ### Verified on Linux (Rust 1.99.0) Branch: current `main` (13f91ca) + this PR (merges cleanly). - `cargo test --locked -p victory-formats`: 40 passed, 5 ignored (benchmarks and the external-data tests). - With only the new `continue` guard in `lanes` removed (bcpack.rs:434-438) and the test changes kept, 4 tests fail: both new tests, plus `every_layout_round_trips_through_the_lanes` and `bc7_mode6_block`. The last two fail because the helper no longer appends the `[0, 1, 0, 0]` filler fragment: "a lane read past its fragment". So the new behaviour is pinned both by the new tests and by the reworked round-trip helper. - Together with #2649 (`main` + #2648 + #2649, no conflicts): 41 passed. - `cargo clippy --locked --target x86_64-pc-windows-msvc -p victory-formats --all-targets -- -D warnings`: clean, same as main. ### Checked against the RTL The cited `mdu_minirans.v` at 2f6827d backs the change. In `DSTATE_PROCESSING` the decoder keeps taking payload bytes after the last symbol until `input_remaining` reaches 0. Then, with `output_remaining == 0`, it goes to `DSTATE_IDLE` with `done <= 1` (lines 1183-1195) instead of `DSTATE_HDR0`. So a finished lane drains its declared payload and never reads another header, which is what the guard implements. Main's assumption, written in the old helper comment, was that a finished lane keeps asking and is fed a filler fragment. Nothing in that RTL supports it. I found no defect. Two small notes: - The guard `continue`s before `lane.stalled` is recomputed and before `lane.out.take()`. That is fine for valid streams, because the lane has already delivered. A one-line comment saying the lane is done for good would stop a later edit from moving code under the guard. - This PR and #2649 both conflict textually with #2735 (BC7/BCPack speedup), which rewrites `Lane::step`. Whichever lands later needs a careful rebase, because the round-trip helper semantics change here. ### Not verified - `reference_chunks` (needs `VICTORY_BCPACK_TABLES` / `VICTORY_BCPACK_CASES`): not run. I don't have title chunks. Running it on this branch is the one check that would show real title streams don't contain the filler fragments main used to expect. - The Windows guest runs linked in the description. Reviewed with Claude Code.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 11:19 UTC · original

NVIDIA full-suite run, to go with the reports above by fuzeofficlal, lcg007xd-c, oni-swr, since none of them names a GPU run. Tested exact head fbf875e (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: finished_lanes_leave_the_remaining_payload_for_their_peers, a_last_symbol_can_precede_its_final_payload_bytes.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 11:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7190576916) NVIDIA full-suite run, to go with the reports above by fuzeofficlal, lcg007xd-c, oni-swr, since none of them names a GPU run. Tested exact head `fbf875e` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **868 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `finished_lanes_leave_the_remaining_payload_for_their_peers`, `a_last_symbol_can_precede_its_final_payload_bytes`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:53 UTC · original · approved these changes

Reviewed fbf875e0 and verified both standalone and composed with #2649 (42279736): guarding on pos + 1 == symbols && done & bit != 0 && lane.left == 0 after lane.step(t)? (crates/victory-formats/src/bcpack.rs:424-447) prevents finished lanes from starting a spurious next header request while still letting them drain any trailing renormalization bytes in their current payload, and removing the [0, 1, 0, 0] filler from stream() strengthens existing round-trip coverage as well.

rustfmt --edition 2024 --check, xtask policy (191 files ok), cargo clippy -p victory-formats --all-targets -- -D warnings (default and --all-features), cargo test -p victory-formats --locked standalone (48 passed, 0 failed, 5 ignored), and composed with #2649 (clean merge, Clippy clean, 49 passed, 0 failed, 5 ignored) all pass.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#pullrequestreview-6073677213) · **approved these changes** Reviewed `fbf875e0` and verified both standalone and composed with #2649 (`42279736`): guarding on `pos + 1 == symbols && done & bit != 0 && lane.left == 0` after `lane.step(t)?` (`crates/victory-formats/src/bcpack.rs:424-447`) prevents finished lanes from starting a spurious next header request while still letting them drain any trailing renormalization bytes in their current payload, and removing the `[0, 1, 0, 0]` filler from `stream()` strengthens existing round-trip coverage as well. `rustfmt --edition 2024 --check`, `xtask policy` (191 files ok), `cargo clippy -p victory-formats --all-targets -- -D warnings` (default and `--all-features`), `cargo test -p victory-formats --locked` standalone (48 passed, 0 failed, 5 ignored), and composed with #2649 (clean merge, Clippy clean, 49 passed, 0 failed, 5 ignored) all pass.
Author
Owner

@⁠guialmm on GitHub · 2026-11-26 17:19 UTC · original

Cross-check against an independent decoder, for this PR and #2649 together.

I decoded synthetic streams from bcpack-rs's encoder (encode::synthetic and fragments split mid-state, all six modes, 1 to 1000 blocks) with both bcpack-rs's lane decoder (rans::decode_slice) and VIctory's lanes(), and compared the symbols lane by lane. bcpack-rs uses its own MIT model tables (from silicon-rans); VIctory used bcpack-tables.bin. No game files.

VIctory whole streams, both decode the same symbols only bcpack-rs decodes different symbols
main 63bcca4 498 / 3000 1797 705
main + this PR (fbf875e) + #2649 (4227973) 3000 / 3000 0 0

The minimal case is one one-symbol fragment per lane: on main it decodes for 1 to 8 lanes and fails every time from 9 lanes up (300 of 300 each, "the stream ends early or is corrupt"); with both PRs it passes for 9, 10, 12 and 16 lanes. That fits the eight-byte round: lanes 0..7 finish and, on main, ask for a header and take lane 8's bytes.

Microsoft's mdu_minirans.v agrees with the fixed behaviour for a single lane: when a fragment's input runs out with output_remaining == 0 (in DSTATE_PROCESSING, or in DSTATE_DRAINING once the state is at or below the limit) the lane sets done and goes to DSTATE_IDLE, where need_ib_load (so din_req) is never set. It only returns to DSTATE_HDR0 while it still has output to give. The feeder between lanes is not in that file, so the eight-byte schedule itself is not checked by this.

With both PRs, on damaged streams (one bit flipped) where both decoders return symbols, the symbols are identical in every case (352 of 3000; on main, 92 differed). The remaining difference is policy: bcpack-rs rejects non-zero bytes after the last one a lane needs, VIctory ignores them.

The harness is a local scratch crate (path dependencies on both crates, lanes() made pub locally); I can post it if useful.

AI-assisted (Claude Code, Claude Opus 5.5): wrote the harness, ran it on my machine and drafted this.

**@⁠guialmm** on GitHub · 2026-11-26 17:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2648#issuecomment-7198822225) Cross-check against an independent decoder, for this PR and #2649 together. I decoded synthetic streams from [bcpack-rs](https://github.com/Ahmet-Dedeler/bcpack-rs)'s encoder (`encode::synthetic` and fragments split mid-state, all six modes, 1 to 1000 blocks) with both bcpack-rs's lane decoder (`rans::decode_slice`) and VIctory's `lanes()`, and compared the symbols lane by lane. bcpack-rs uses its own MIT model tables (from `silicon-rans`); VIctory used `bcpack-tables.bin`. No game files. | VIctory | whole streams, both decode the same symbols | only bcpack-rs decodes | different symbols | |---|---|---|---| | `main` `63bcca4` | 498 / 3000 | 1797 | 705 | | `main` + this PR (`fbf875e`) + #2649 (`4227973`) | 3000 / 3000 | 0 | 0 | The minimal case is one one-symbol fragment per lane: on `main` it decodes for 1 to 8 lanes and fails every time from 9 lanes up (300 of 300 each, "the stream ends early or is corrupt"); with both PRs it passes for 9, 10, 12 and 16 lanes. That fits the eight-byte round: lanes 0..7 finish and, on `main`, ask for a header and take lane 8's bytes. Microsoft's `mdu_minirans.v` agrees with the fixed behaviour for a single lane: when a fragment's input runs out with `output_remaining == 0` (in `DSTATE_PROCESSING`, or in `DSTATE_DRAINING` once the state is at or below the limit) the lane sets `done` and goes to `DSTATE_IDLE`, where `need_ib_load` (so `din_req`) is never set. It only returns to `DSTATE_HDR0` while it still has output to give. The feeder between lanes is not in that file, so the eight-byte schedule itself is not checked by this. With both PRs, on damaged streams (one bit flipped) where both decoders return symbols, the symbols are identical in every case (352 of 3000; on `main`, 92 differed). The remaining difference is policy: bcpack-rs rejects non-zero bytes after the last one a lane needs, VIctory ignores them. The harness is a local scratch crate (path dependencies on both crates, `lanes()` made `pub` locally); I can post it if useful. AI-assisted (Claude Code, Claude Opus 5.5): wrote the harness, ran it on my machine and drafted this.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2648/head:github-bot/gh-2648'
git switch 'github-bot/gh-2648'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2648'
git switch 'github-bot/gh-2648'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2648'
git switch 'github-bot/gh-2648'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2648'
git switch 'main'
git merge --squash 'github-bot/gh-2648'
git switch 'main'
git merge --ff-only 'github-bot/gh-2648'
git switch 'main'
git merge 'github-bot/gh-2648'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2648
No description provided.