bcpack: name the reason a BCPack request fails #1933

Closed
tedin7 wants to merge 8 commits from upstream-pr/1940 into main
tedin7 commented 2026-11-24 21:56:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:56:50Z.


Superseded · 1 December 2026

#3346 took the BCPack refusal inspector and its review fixes to main. The integrated Release run passed both bcpack_inspect and bcpack_inspect_collapse_control. Closing this overlapping branch keeps the remaining DirectStorage investigation in #1198.

Part of #1198 (the bcpack failed class). This changes no request outcome and no counter.

What this unblocks: a BCPack request that fails can be named (stream cut, request shorter or longer than the stream, unsupported format) instead of one anonymous false.

What it adds

  • decode_lanes takes an optional LaneReport* (default nullptr). With no report the code path answers as before. With one it records why the decode stopped (the failure kind), the bytes handed to lanes, and the fewest and most symbols any lane had produced.
  • src/startup_stubs/bcpack_inspect.h: inspect_bcpack(input, size, format, output_size) returns a class plus bytes_read, min_symbols_per_lane, max_symbols_per_lane and the requested count. Classes: ok, bad_arguments, unsupported_format (a format number decode_bcpack does not decode), destination_misaligned, header_invalid, fragment_not_home, end_state_invalid, trailing_input, request_shorter_than_stream, request_longer_than_stream, truncated_in_fragment, cycle_limit, control_code_unmapped. Layouts exist for BC1 and BC7 only, the formats decode_bcpack decodes today.
  • tests/bcpack_inspect_check.cpp, registered next to the other BCPack checks, with a --mutate collapse control that reports every failure as one class and must fail.

Why
Today a BCPack failure is one false. A request for fewer blocks than the stream holds, a request for more, and a cut stream all end in the same no-progress line of decode_lanes, so a count or a log cannot tell them apart. The lane state can. On the synthetic 64-block BC1 stream: asking for 16 blocks leaves every lane at 16 symbols with 196 of 515 bytes read; asking for 65 or 1000 ends with every lane at 64 symbols and all 515 bytes read; cutting the input at 300 bytes stops lanes at 31 or 32 symbols mid-fragment.

What it does not do

  • No change to decode_bcpack, execute_request or xcrdapi.cpp; it is not called from the request path yet. It is meant to be called on the failure path once the request code settles.
  • It does not decode a request for the first part of a longer stream, and it does not say what a title expects for such a request.
  • A stream cut exactly at a fragment boundary in every lane reads as request_longer_than_stream: that is a shorter stream.
  • control_code_unmapped is the one class without a stream case. No synthetic stream in the repository reaches it, and about 3 million random one-to-three byte changes of the two BC7 streams did not find one. header_invalid cannot come from the BC1 or BC7 layouts (their alphabets are at least 3 bits wide), so it is checked through decode_lanes with a 2-bit alphabet.

Source
Source: Microsoft Learn, "BC7 Format" and "Block Compression" (Direct3D 11 Programming Guide, block layout and sizes used to size the requested output); J. Duda, "Asymmetric numeral systems" (arXiv:1311.2540) and F. Giesen, "Interleaved entropy coders" (arXiv:1402.3392) for the rANS state and renormalisation the lane state follows; earlier code of this repository (tools/_bcpack_rans, src/startup_stubs/bcpack_decoder.h).

The inspector has a lane layout for every format decode_bcpack decodes: BC1, BC3, BC4, BC5 and BC7 (the same alphabets and symbols per block).

Streams used
BC3, BC4 and BC5 cases use streams from the test-only encoder tests/bcpack_encoder.h (also used by bcpack_encoder_check); they check the class and the agreement with decode_bcpack, not a stream a title wrote.
The synthetic streams already in the repository: tools/_bcpack_rans/vectors/synthetic_11.json (64 BC1 blocks), tests/bcpack_mode6_vector.py (one BC7 mode 6 block) and tests/bc7_mode6_multiblock_check.py (two blocks). Each case changes only the destination size, the input length or one input byte. Every case also checks that inspect_bcpack says ok exactly when decode_bcpack returns true.

Overlap
git merge-tree of this branch against origin/main (330df7f0) reports no conflict. Against #1390, #1429 and #1616 the conflicts are the same ones each of those has with origin/main alone (tests/startup_stub_consumer.cpp, xcrdapi.cpp, CMakeLists.txt and docs/experiments.md), none in a file this branch touches differently. No conflict with #1787, #1788 or #1789. The merge of this branch with #1390's decoder compiles and the new check passes on it. The decoder edit is confined to decode_lanes plus the report types placed just before it.

Commands run locally on Linux (g++ 14.2, with a local one-function <intrin.h> shim for _BitScanReverse, kept outside the repository; the decoder header includes <intrin.h> as it does on main)

  • g++ -std=c++17 -O2 -Wall -Wextra -fsanitize=address,undefined -fno-sanitize-recover=undefined -I <shim> -I src tests/bcpack_inspect_check.cpp: 202 cases, 0 failed, no warnings.

  • Same binary with --mutate collapse: 47 failed, exit 1.

  • Five local mutations, each reverted: swapping request_longer/truncated (12 cases fail), reporting request_shorter only when input is left (2 fail), reporting trailing input as an end-state error (2 fail), adding one to bytes_read (25 fail), checking destination alignment with a smaller modulus (survived at first; two cases added, then 2 fail).

  • python3 -B tests/docs_links_check.py and python3 -B tests/bidi_controls_check.py: pass. git diff --check origin/main...HEAD: clean.

  • Win2025 (proxmox, Windows Server 2025, D3D12 WARP) at 7de1131b9cf5766f7637c249e308ca8b752d782f: ctest -R ^(bcpack_|bc7_mode6) on dev and release, 17/19 passed each; the 2 others are bc7_mode6_multiblock_hardware and _warp, skipped for capability. bcpack_inspect and bcpack_inspect_collapse_control are among the 17 (receipt comment).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5481003196 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:56:50Z. --- ## Superseded · 1 December 2026 #3346 took the BCPack refusal inspector and its review fixes to `main`. The integrated Release run passed both `bcpack_inspect` and `bcpack_inspect_collapse_control`. Closing this overlapping branch keeps the remaining DirectStorage investigation in #1198. Part of #1198 (the `bcpack failed` class). This changes no request outcome and no counter. What this unblocks: a BCPack request that fails can be named (stream cut, request shorter or longer than the stream, unsupported format) instead of one anonymous `false`. **What it adds** - `decode_lanes` takes an optional `LaneReport*` (default `nullptr`). With no report the code path answers as before. With one it records why the decode stopped (the failure kind), the bytes handed to lanes, and the fewest and most symbols any lane had produced. - `src/startup_stubs/bcpack_inspect.h`: `inspect_bcpack(input, size, format, output_size)` returns a class plus `bytes_read`, `min_symbols_per_lane`, `max_symbols_per_lane` and the requested count. Classes: `ok`, `bad_arguments`, `unsupported_format` (a format number decode_bcpack does not decode), `destination_misaligned`, `header_invalid`, `fragment_not_home`, `end_state_invalid`, `trailing_input`, `request_shorter_than_stream`, `request_longer_than_stream`, `truncated_in_fragment`, `cycle_limit`, `control_code_unmapped`. Layouts exist for BC1 and BC7 only, the formats `decode_bcpack` decodes today. - `tests/bcpack_inspect_check.cpp`, registered next to the other BCPack checks, with a `--mutate collapse` control that reports every failure as one class and must fail. **Why** Today a BCPack failure is one `false`. A request for fewer blocks than the stream holds, a request for more, and a cut stream all end in the same no-progress line of `decode_lanes`, so a count or a log cannot tell them apart. The lane state can. On the synthetic 64-block BC1 stream: asking for 16 blocks leaves every lane at 16 symbols with 196 of 515 bytes read; asking for 65 or 1000 ends with every lane at 64 symbols and all 515 bytes read; cutting the input at 300 bytes stops lanes at 31 or 32 symbols mid-fragment. **What it does not do** - No change to `decode_bcpack`, `execute_request` or `xcrdapi.cpp`; it is not called from the request path yet. It is meant to be called on the failure path once the request code settles. - It does not decode a request for the first part of a longer stream, and it does not say what a title expects for such a request. - A stream cut exactly at a fragment boundary in every lane reads as `request_longer_than_stream`: that is a shorter stream. - `control_code_unmapped` is the one class without a stream case. No synthetic stream in the repository reaches it, and about 3 million random one-to-three byte changes of the two BC7 streams did not find one. `header_invalid` cannot come from the BC1 or BC7 layouts (their alphabets are at least 3 bits wide), so it is checked through `decode_lanes` with a 2-bit alphabet. **Source** Source: Microsoft Learn, "BC7 Format" and "Block Compression" (Direct3D 11 Programming Guide, block layout and sizes used to size the requested output); J. Duda, "Asymmetric numeral systems" (arXiv:1311.2540) and F. Giesen, "Interleaved entropy coders" (arXiv:1402.3392) for the rANS state and renormalisation the lane state follows; earlier code of this repository (`tools/_bcpack_rans`, `src/startup_stubs/bcpack_decoder.h`). The inspector has a lane layout for every format `decode_bcpack` decodes: BC1, BC3, BC4, BC5 and BC7 (the same alphabets and symbols per block). **Streams used** BC3, BC4 and BC5 cases use streams from the test-only encoder `tests/bcpack_encoder.h` (also used by `bcpack_encoder_check`); they check the class and the agreement with `decode_bcpack`, not a stream a title wrote. The synthetic streams already in the repository: `tools/_bcpack_rans/vectors/synthetic_11.json` (64 BC1 blocks), `tests/bcpack_mode6_vector.py` (one BC7 mode 6 block) and `tests/bc7_mode6_multiblock_check.py` (two blocks). Each case changes only the destination size, the input length or one input byte. Every case also checks that `inspect_bcpack` says `ok` exactly when `decode_bcpack` returns true. **Overlap** `git merge-tree` of this branch against `origin/main` (330df7f0) reports no conflict. Against #1390, #1429 and #1616 the conflicts are the same ones each of those has with `origin/main` alone (`tests/startup_stub_consumer.cpp`, `xcrdapi.cpp`, `CMakeLists.txt` and `docs/experiments.md`), none in a file this branch touches differently. No conflict with #1787, #1788 or #1789. The merge of this branch with #1390's decoder compiles and the new check passes on it. The decoder edit is confined to `decode_lanes` plus the report types placed just before it. **Commands run locally on Linux** (g++ 14.2, with a local one-function `<intrin.h>` shim for `_BitScanReverse`, kept outside the repository; the decoder header includes `<intrin.h>` as it does on `main`) - `g++ -std=c++17 -O2 -Wall -Wextra -fsanitize=address,undefined -fno-sanitize-recover=undefined -I <shim> -I src tests/bcpack_inspect_check.cpp`: 202 cases, 0 failed, no warnings. - Same binary with `--mutate collapse`: 47 failed, exit 1. - Five local mutations, each reverted: swapping `request_longer`/`truncated` (12 cases fail), reporting `request_shorter` only when input is left (2 fail), reporting trailing input as an end-state error (2 fail), adding one to `bytes_read` (25 fail), checking destination alignment with a smaller modulus (survived at first; two cases added, then 2 fail). - `python3 -B tests/docs_links_check.py` and `python3 -B tests/bidi_controls_check.py`: pass. `git diff --check origin/main...HEAD`: clean. - Win2025 (proxmox, Windows Server 2025, D3D12 WARP) at `7de1131b9cf5766f7637c249e308ca8b752d782f`: `ctest -R ^(bcpack_|bc7_mode6)` on dev and release, 17/19 passed each; the 2 others are `bc7_mode6_multiblock_hardware` and `_warp`, skipped for capability. `bcpack_inspect` and `bcpack_inspect_collapse_control` are among the 17 (receipt comment). AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 22:01:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T21:57:02Z.


Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-26T11:16:19.313481Z
We couldn’t complete this review. Comment @codex review to try again.
7de1131 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145604071 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7145604071). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T21:57:02Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"7de1131b9cf5766f7637c249e308ca8b752d782f","has_any_findings":true,"has_unresolved_findings":true,"status":"failed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ❌ Failed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ❌ **Failed** <relative-time datetime="2026-11-26T11:16:19.313481Z">2026-11-26T11:16:19.313481Z</relative-time><br/>We couldn’t complete this review. Comment `@codex review` to try again. | `7de1131` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
R0Y00 commented 2026-11-24 22:19:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T22:19:01Z.

Review: CHANGES_REQUESTED


Please bound the diagnostic's scratch cost before a caller uses it on a failed request. A 256 MiB BC7 output declaration currently lets a tiny source allocate about 1 GiB of lane symbols (256 MiB / 16) * 2 * 16 * sizeof(uint16_t), with another 256 MiB on the success path. Start with the shared chunk-window bound documented next to the function or use a separate explicit scratch budget, and add an oversized declared-output case that returns a diagnostic before allocating. Keep the decoder's existing status and the short/long/truncated controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048302181 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#pullrequestreview-6048302181). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T22:19:01Z. **Review:** CHANGES_REQUESTED --- Please bound the diagnostic's scratch cost before a caller uses it on a failed request. A 256 MiB BC7 output declaration currently lets a tiny source allocate about 1 GiB of lane symbols `(256 MiB / 16) * 2 * 16 * sizeof(uint16_t)`, with another 256 MiB on the success path. Start with the shared chunk-window bound documented next to the function or use a separate explicit scratch budget, and add an oversized declared-output case that returns a diagnostic before allocating. Keep the decoder's existing status and the short/long/truncated controls.
tedin7 commented 2026-11-25 01:02:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:55:25Z.


Addressed in cdf66792.

  • inspect_max_output is now the shared 16 MiB chunk-window bound (was 256 MiB). Worst-case BC7 lane-symbol scratch is 64 MiB at the cap. A larger declared output returns bad_arguments before any allocation.
  • New cases in bcpack_inspect_check: a tiny BC7 source declaring 256 MiB, and cap + 16 bytes, both return bad_arguments with zero lane counts. Decoder status and the short/long/truncated controls are unchanged.

Verification (Windows Server 2025, MSVC 14.44 + WARP, cdf66792):

  • cmake --build --preset dev --target bcpack_inspect_check: OK
  • ctest --preset dev -R '^bcpack_inspect': 2/2 passed (bcpack_inspect, bcpack_inspect_collapse_control)
  • Not run: a before-fix red run on Windows (the 256 MiB case would have returned a decode class instead of bad_arguments).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149027461 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7149027461). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:55:25Z. --- Addressed in `cdf66792`. - `inspect_max_output` is now the shared 16 MiB chunk-window bound (was 256 MiB). Worst-case BC7 lane-symbol scratch is 64 MiB at the cap. A larger declared output returns `bad_arguments` before any allocation. - New cases in `bcpack_inspect_check`: a tiny BC7 source declaring 256 MiB, and cap + 16 bytes, both return `bad_arguments` with zero lane counts. Decoder status and the short/long/truncated controls are unchanged. Verification (Windows Server 2025, MSVC 14.44 + WARP, `cdf66792`): - `cmake --build --preset dev --target bcpack_inspect_check`: OK - `ctest --preset dev -R '^bcpack_inspect'`: 2/2 passed (`bcpack_inspect`, `bcpack_inspect_collapse_control`) - Not run: a before-fix red run on Windows (the 256 MiB case would have returned a decode class instead of `bad_arguments`). AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 14:04:21 +00:00
tedin7 commented 2026-11-25 14:05:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:50:30Z.


Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.

We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164368053 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7164368053). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:50:30Z. --- Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally.
upstream-sync reopened this pull request 2026-11-26 11:02:39 +00:00
tedin7 commented 2026-11-26 11:03:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:39:33Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 3157f903d36b7a213a0253a3b5613f9c08b654e4:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2): 7.13s (configure 2.16s)
    • Test (ctest --preset dev -R '^(bcpack_|bc7_mode6)' --parallel 3 --no-tests=error --output-on-failure): 17/19 passed (14.92s: bcpack_lanes_avx2_drain_control 4.91s, bcpack_lanes_scalar 6.05s, bcpack_lanes_avx2 7.22s, bcpack_lanes_python_avx2 2.85s, bcpack_lanes_scalar_drain_control 4.38s, bcpack_lanes_python_scalar 2.81s, bcpack_lanes_python_scalar_drain_control 2.86s, bcpack_lanes_python_avx2_drain_control 2.80s, bcpack_rans_symbols 2.60s, bcpack_probe_cli 0.63s, bcpack_prefix_and_mip_tail 1.19s, bcpack_encoder_window_control 0.62s, bcpack_inspect 0.03s, bcpack_inspect_collapse_control 0.02s, bcpack_encoder_roundtrip 0.97s, bcpack_tables 0.69s, bc7_mode6_multiblock_hardware 0.96s, bc7_mode6_multiblock_warp 0.94s, bcpack_symbols_cli_check 1.34s); skipped (capability, not a pass): bc7_mode6_multiblock_hardware, bc7_mode6_multiblock_warp
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2): 16.31s (configure 2.41s)
    • Test (ctest --preset release -R '^(bcpack_|bc7_mode6)' --parallel 3 --no-tests=error --output-on-failure): 17/19 passed (5.87s: bcpack_inspect 0.02s, bcpack_inspect_collapse_control 0.01s, bcpack_encoder_roundtrip 0.14s, bcpack_encoder_window_control 0.10s, bcpack_tables 0.46s, bcpack_lanes_scalar_drain_control 1.11s, bcpack_lanes_scalar 1.65s, bcpack_rans_symbols 1.95s, bcpack_lanes_avx2 1.15s, bcpack_lanes_python_scalar 1.68s, bcpack_lanes_python_scalar_drain_control 1.59s, bcpack_lanes_avx2_drain_control 0.95s, bcpack_prefix_and_mip_tail 0.75s, bcpack_lanes_python_avx2 1.61s, bcpack_lanes_python_avx2_drain_control 1.59s, bcpack_probe_cli 0.35s, bcpack_symbols_cli_check 0.78s, bc7_mode6_multiblock_hardware 0.50s, bc7_mode6_multiblock_warp 0.51s); skipped (capability, not a pass): bc7_mode6_multiblock_hardware, bc7_mode6_multiblock_warp
  • sccache: 7/27 hits; wall 39.5s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7189659321 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7189659321). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:39:33Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `3157f903d36b7a213a0253a3b5613f9c08b654e4`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2`): `7.13s` (configure `2.16s`) - Test (`ctest --preset dev -R '^(bcpack_|bc7_mode6)' --parallel 3 --no-tests=error --output-on-failure`): **17/19 passed** (`14.92s`: `bcpack_lanes_avx2_drain_control` `4.91s`, `bcpack_lanes_scalar` `6.05s`, `bcpack_lanes_avx2` `7.22s`, `bcpack_lanes_python_avx2` `2.85s`, `bcpack_lanes_scalar_drain_control` `4.38s`, `bcpack_lanes_python_scalar` `2.81s`, `bcpack_lanes_python_scalar_drain_control` `2.86s`, `bcpack_lanes_python_avx2_drain_control` `2.80s`, `bcpack_rans_symbols` `2.60s`, `bcpack_probe_cli` `0.63s`, `bcpack_prefix_and_mip_tail` `1.19s`, `bcpack_encoder_window_control` `0.62s`, `bcpack_inspect` `0.03s`, `bcpack_inspect_collapse_control` `0.02s`, `bcpack_encoder_roundtrip` `0.97s`, `bcpack_tables` `0.69s`, `bc7_mode6_multiblock_hardware` `0.96s`, `bc7_mode6_multiblock_warp` `0.94s`, `bcpack_symbols_cli_check` `1.34s`); skipped (capability, not a pass): `bc7_mode6_multiblock_hardware`, `bc7_mode6_multiblock_warp` - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2`): `16.31s` (configure `2.41s`) - Test (`ctest --preset release -R '^(bcpack_|bc7_mode6)' --parallel 3 --no-tests=error --output-on-failure`): **17/19 passed** (`5.87s`: `bcpack_inspect` `0.02s`, `bcpack_inspect_collapse_control` `0.01s`, `bcpack_encoder_roundtrip` `0.14s`, `bcpack_encoder_window_control` `0.10s`, `bcpack_tables` `0.46s`, `bcpack_lanes_scalar_drain_control` `1.11s`, `bcpack_lanes_scalar` `1.65s`, `bcpack_rans_symbols` `1.95s`, `bcpack_lanes_avx2` `1.15s`, `bcpack_lanes_python_scalar` `1.68s`, `bcpack_lanes_python_scalar_drain_control` `1.59s`, `bcpack_lanes_avx2_drain_control` `0.95s`, `bcpack_prefix_and_mip_tail` `0.75s`, `bcpack_lanes_python_avx2` `1.61s`, `bcpack_lanes_python_avx2_drain_control` `1.59s`, `bcpack_probe_cli` `0.35s`, `bcpack_symbols_cli_check` `0.78s`, `bc7_mode6_multiblock_hardware` `0.50s`, `bc7_mode6_multiblock_warp` `0.51s`); skipped (capability, not a pass): `bc7_mode6_multiblock_hardware`, `bc7_mode6_multiblock_warp` - `sccache`: 7/27 hits; wall `39.5s` AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 12:04:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T11:14:24Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 7de1131b9cf5766f7637c249e308ca8b752d782f:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2): 21.36s (configure 1.88s)
    • Test (ctest --preset dev -R '^(bcpack_|bc7_mode6)' --parallel 6 --no-tests=error --output-on-failure): 17/19 passed (7.87s: bcpack_lanes_python_scalar 2.89s, bcpack_lanes_python_avx2 3.01s, bcpack_lanes_scalar_drain_control 4.71s, bcpack_lanes_avx2_drain_control 5.17s, bcpack_lanes_python_scalar_drain_control 2.65s, bcpack_lanes_python_avx2_drain_control 2.68s, bcpack_prefix_and_mip_tail 0.99s, bcpack_probe_cli 0.53s, bcpack_lanes_scalar 6.35s, bcpack_symbols_cli_check 1.19s, bcpack_inspect 0.03s, bcpack_encoder_window_control 0.55s, bcpack_inspect_collapse_control 0.03s, bcpack_tables 0.68s, bcpack_encoder_roundtrip 0.95s, bcpack_rans_symbols 2.50s, bc7_mode6_multiblock_hardware 0.76s, bc7_mode6_multiblock_warp 0.74s, bcpack_lanes_avx2 7.73s); skipped (capability, not a pass): bc7_mode6_multiblock_hardware, bc7_mode6_multiblock_warp
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2): 41.11s (configure 1.88s)
    • Test (ctest --preset release -R '^(bcpack_|bc7_mode6)' --parallel 6 --no-tests=error --output-on-failure): 17/19 passed (3.42s: bcpack_lanes_scalar 1.69s, bcpack_lanes_python_scalar_drain_control 1.74s, bcpack_lanes_python_avx2_drain_control 1.79s, bcpack_rans_symbols 1.85s, bcpack_lanes_python_avx2 1.84s, bcpack_lanes_python_scalar 1.87s, bcpack_probe_cli 0.43s, bcpack_prefix_and_mip_tail 0.82s, bcpack_tables 0.41s, bcpack_symbols_cli_check 0.89s, bcpack_inspect 0.02s, bcpack_inspect_collapse_control 0.01s, bcpack_encoder_roundtrip 0.14s, bcpack_encoder_window_control 0.11s, bcpack_lanes_avx2_drain_control 1.07s, bcpack_lanes_scalar_drain_control 1.15s, bcpack_lanes_avx2 1.23s, bc7_mode6_multiblock_hardware 0.46s, bc7_mode6_multiblock_warp 0.46s); skipped (capability, not a pass): bc7_mode6_multiblock_hardware, bc7_mode6_multiblock_warp
  • sccache: 8/16 hits; wall 74.8s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190467539 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7190467539). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T11:14:24Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `7de1131b9cf5766f7637c249e308ca8b752d782f`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2`): `21.36s` (configure `1.88s`) - Test (`ctest --preset dev -R '^(bcpack_|bc7_mode6)' --parallel 6 --no-tests=error --output-on-failure`): **17/19 passed** (`7.87s`: `bcpack_lanes_python_scalar` `2.89s`, `bcpack_lanes_python_avx2` `3.01s`, `bcpack_lanes_scalar_drain_control` `4.71s`, `bcpack_lanes_avx2_drain_control` `5.17s`, `bcpack_lanes_python_scalar_drain_control` `2.65s`, `bcpack_lanes_python_avx2_drain_control` `2.68s`, `bcpack_prefix_and_mip_tail` `0.99s`, `bcpack_probe_cli` `0.53s`, `bcpack_lanes_scalar` `6.35s`, `bcpack_symbols_cli_check` `1.19s`, `bcpack_inspect` `0.03s`, `bcpack_encoder_window_control` `0.55s`, `bcpack_inspect_collapse_control` `0.03s`, `bcpack_tables` `0.68s`, `bcpack_encoder_roundtrip` `0.95s`, `bcpack_rans_symbols` `2.50s`, `bc7_mode6_multiblock_hardware` `0.76s`, `bc7_mode6_multiblock_warp` `0.74s`, `bcpack_lanes_avx2` `7.73s`); skipped (capability, not a pass): `bc7_mode6_multiblock_hardware`, `bc7_mode6_multiblock_warp` - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target bcpack_encoder_check bcpack_inspect_check bcpack_lanes_check bcpack_lanes_control startup_stub_consumer startup_stub_xcrdapi -- -j 2`): `41.11s` (configure `1.88s`) - Test (`ctest --preset release -R '^(bcpack_|bc7_mode6)' --parallel 6 --no-tests=error --output-on-failure`): **17/19 passed** (`3.42s`: `bcpack_lanes_scalar` `1.69s`, `bcpack_lanes_python_scalar_drain_control` `1.74s`, `bcpack_lanes_python_avx2_drain_control` `1.79s`, `bcpack_rans_symbols` `1.85s`, `bcpack_lanes_python_avx2` `1.84s`, `bcpack_lanes_python_scalar` `1.87s`, `bcpack_probe_cli` `0.43s`, `bcpack_prefix_and_mip_tail` `0.82s`, `bcpack_tables` `0.41s`, `bcpack_symbols_cli_check` `0.89s`, `bcpack_inspect` `0.02s`, `bcpack_inspect_collapse_control` `0.01s`, `bcpack_encoder_roundtrip` `0.14s`, `bcpack_encoder_window_control` `0.11s`, `bcpack_lanes_avx2_drain_control` `1.07s`, `bcpack_lanes_scalar_drain_control` `1.15s`, `bcpack_lanes_avx2` `1.23s`, `bc7_mode6_multiblock_hardware` `0.46s`, `bc7_mode6_multiblock_warp` `0.46s`); skipped (capability, not a pass): `bc7_mode6_multiblock_hardware`, `bc7_mode6_multiblock_warp` - `sccache`: 8/16 hits; wall `74.8s` AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 12:04:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T11:16:15Z.


@MasterDomino Ready for review: head 7de1131b9cf5766f7637c249e308ca8b752d782f (origin/main merged in; no behavior change to any request path).

Independent Stage-2 check on this exact head, Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), Proxmox slots, dev and release /O2:

python3 x2w_pipe.py win2025 1940 --host proxmox --regex '^(bcpack_|bc7_mode6)' --keep-release
ctest --preset dev     -R '^(bcpack_|bc7_mode6)' --no-tests=error   -> 100% passed: 17 passed, 2 skipped (bc7_mode6_multiblock_hardware and _warp: capability skip, not a pass)
ctest --preset release -R '^(bcpack_|bc7_mode6)' --no-tests=error   -> 100% passed: 17 passed, 2 skipped (the same two)

bcpack_inspect and bcpack_inspect_collapse_control (the control that reports every failure as one class and must fail) are among the passed tests in both presets.

Review result:

  • Without a report, decode_lanes takes exactly the code it took before; with a report it runs the reference loop the lane tests already compare every path with.
  • The inspector's lane layouts for BC1, BC3, BC4, BC5 and BC7 match the alphabets and symbols per block that decode_bcpack uses for each format.
  • On Linux with address and undefined-behaviour sanitizers, the PR's check passes (202 cases) and its collapse control fails as required. A comparison of inspect_bcpack against decode_bcpack over about 52,000 cases (every truncation, trailing bytes, byte flips, destination sizes, random edits, for BC1, BC3, BC4, BC5 and BC7 streams) found no case where one said ok and the other did not, no report whose counts break the stated bounds, and no sanitizer report.
  • The earlier wording that only BC1 and BC7 are covered is corrected in the header and the body.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190509378 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7190509378). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T11:16:15Z. --- @MasterDomino Ready for review: head `7de1131b9cf5766f7637c249e308ca8b752d782f` (origin/main merged in; no behavior change to any request path). Independent Stage-2 check on this exact head, Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), Proxmox slots, dev and release `/O2`: ``` python3 x2w_pipe.py win2025 1940 --host proxmox --regex '^(bcpack_|bc7_mode6)' --keep-release ctest --preset dev -R '^(bcpack_|bc7_mode6)' --no-tests=error -> 100% passed: 17 passed, 2 skipped (bc7_mode6_multiblock_hardware and _warp: capability skip, not a pass) ctest --preset release -R '^(bcpack_|bc7_mode6)' --no-tests=error -> 100% passed: 17 passed, 2 skipped (the same two) ``` `bcpack_inspect` and `bcpack_inspect_collapse_control` (the control that reports every failure as one class and must fail) are among the passed tests in both presets. Review result: - Without a report, `decode_lanes` takes exactly the code it took before; with a report it runs the reference loop the lane tests already compare every path with. - The inspector's lane layouts for BC1, BC3, BC4, BC5 and BC7 match the alphabets and symbols per block that `decode_bcpack` uses for each format. - On Linux with address and undefined-behaviour sanitizers, the PR's check passes (202 cases) and its collapse control fails as required. A comparison of `inspect_bcpack` against `decode_bcpack` over about 52,000 cases (every truncation, trailing bytes, byte flips, destination sizes, random edits, for BC1, BC3, BC4, BC5 and BC7 streams) found no case where one said ok and the other did not, no report whose counts break the stated bounds, and no sanitizer report. - The earlier wording that only BC1 and BC7 are covered is corrected in the header and the body. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-26 12:04:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T11:16:24Z.


You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190512612 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7190512612). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-26T11:16:24Z. --- You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage). To continue using code reviews, add credits to your account and enable them for code reviews in your [settings](https://chatgpt.com/settings/code-review).
tedin7 commented 2026-11-26 12:04:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T11:18:22Z.


@MasterDomino #1940 is tested and Ready too. It can go after #1939 in the order I posted on #1408.

The scratch-cost change request from R0Y00 is addressed: an oversized declared output is refused before any scratch allocation (inspect_max_output, with an oversized-declaration case in bcpack_inspect_check). BC3, BC4 and BC5 now have their own lane layouts, matching decode_bcpack. Win2025 dev + release receipt is in the comments.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7190555140 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7190555140). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T11:18:22Z. --- @MasterDomino #1940 is tested and Ready too. It can go after #1939 in the order I posted on #1408. The scratch-cost change request from R0Y00 is addressed: an oversized declared output is refused before any scratch allocation (`inspect_max_output`, with an oversized-declaration case in `bcpack_inspect_check`). BC3, BC4 and BC5 now have their own lane layouts, matching `decode_bcpack`. Win2025 dev + release receipt is in the comments.
pigalot commented 2026-11-27 22:16:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:16:20Z.

Review: APPROVED


I reviewed 7de1131b merged over main 886a5a28. The merge is clean and git diff --cached --check is clean. The merged diff is the four files of the PR: bcpack_decoder.h, bcpack_inspect.h, tests/bcpack_inspect_check.cpp and CMakeLists.txt.

R0Y00's scratch-cost finding on f4986099 is fixed.

  • The cap: inspect_bcpack now returns bad_arguments for any output_size > inspect_max_output (16 MiB, the chunk-window cap). It does this before decode_lanes or the BC7 scratch vector allocates anything.
  • Worst case: at the cap, BC7 lane symbols are (16 MiB / 16) * 2 * 16 * 2 = 64 MiB, plus 16 MiB of scratch on the success path. That matches the comment next to the constant.
  • The test: it covers a 256 MiB declared BC7 output and the cap plus 16, both from a tiny source, plus BC1 at the cap plus 8, and it pins the constant itself.
  • Unchanged behaviour: decode_bcpack and its status are unchanged. Without a report, decode_lanes takes the same fast path as before. The short, long and truncated controls are still in place.

What I ran. I did a full build in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(bcpack_|bc7_)' -E '_hardware$'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(bcpack_|bc7_).*_hardware$'

The results were the same in both presets:

  • Without _hardware: 21 of 22 pass and 1 skips for capability.
  • _hardware only: 1 of 2 passes and 1 skips for capability.

The two skips are bc7_mode6_multiblock_warp and bc7_mode6_multiblock_hardware. Both print "Set BCPACK_REFERENCE_TOOLS to the pinned Leonida tools directory", which matches the two skips in the PR's receipt. bcpack_inspect and its WILL_FAIL control bcpack_inspect_collapse_control both pass, and so does bc7_draw_hardware.

Mutants in bcpack_inspect.h and bcpack_decoder.h. For each, I rebuilt in dev and ran the non-hardware set:

Mutant Result
size cap removed (output_size > inspect_max_output dropped) killed (bcpack_inspect)
request_shorter reported as request_longer killed
at_boundary ignored (always truncated) killed
header_invalid reported as fragment_not_home killed
trailing input reported as end_state_invalid killed
end_state_invalid reported as no_progress killed
decode_lanes ignores the report (fast path) killed
destination-alignment check removed killed
BC7 block stage skipped (if (bc_format == 7) → if (false)) survives

Restored and rebuilt afterwards; git diff --quiet is clean.

Non-blocking.

  1. control_code_unmapped is unpinned. This is the survivor above. The PR description already says no stream reaches this class. A follow-up could reach decode_bc7_blocks with hand-built lane symbols instead of a stream.
  2. Stale bullet in the description. It says "Layouts exist for BC1 and BC7 only". The header also has BC3, BC4 and BC5 layouts, and the BC3/4/5 cases are tested, as a later paragraph of the description says.

Verdict: approve on 7de1131b. R0Y00's changes request on f4986099 still stands, so the merge waits for R0Y00 to re-check it.

Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090, driver 32.0.16.1088 for bc7_draw_hardware.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 7de1131b.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093863680 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#pullrequestreview-6093863680). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T22:16:20Z. **Review:** APPROVED --- I reviewed `7de1131b` merged over `main` `886a5a28`. The merge is clean and `git diff --cached --check` is clean. The merged diff is the four files of the PR: `bcpack_decoder.h`, `bcpack_inspect.h`, `tests/bcpack_inspect_check.cpp` and `CMakeLists.txt`. **R0Y00's scratch-cost finding on `f4986099` is fixed.** - **The cap:** `inspect_bcpack` now returns `bad_arguments` for any `output_size > inspect_max_output` (16 MiB, the chunk-window cap). It does this before `decode_lanes` or the BC7 scratch vector allocates anything. - **Worst case:** at the cap, BC7 lane symbols are `(16 MiB / 16) * 2 * 16 * 2` = 64 MiB, plus 16 MiB of scratch on the success path. That matches the comment next to the constant. - **The test:** it covers a 256 MiB declared BC7 output and the cap plus 16, both from a tiny source, plus BC1 at the cap plus 8, and it pins the constant itself. - **Unchanged behaviour:** `decode_bcpack` and its status are unchanged. Without a report, `decode_lanes` takes the same fast path as before. The short, long and truncated controls are still in place. **What I ran.** I did a full build in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(bcpack_|bc7_)' -E '_hardware$' ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(bcpack_|bc7_).*_hardware$' ``` The results were the same in both presets: - **Without `_hardware`:** 21 of 22 pass and 1 skips for capability. - **`_hardware` only:** 1 of 2 passes and 1 skips for capability. The two skips are `bc7_mode6_multiblock_warp` and `bc7_mode6_multiblock_hardware`. Both print "Set BCPACK_REFERENCE_TOOLS to the pinned Leonida tools directory", which matches the two skips in the PR's receipt. `bcpack_inspect` and its `WILL_FAIL` control `bcpack_inspect_collapse_control` both pass, and so does `bc7_draw_hardware`. **Mutants** in `bcpack_inspect.h` and `bcpack_decoder.h`. For each, I rebuilt in `dev` and ran the non-hardware set: | Mutant | Result | |---|---| | size cap removed (`output_size > inspect_max_output` dropped) | killed (`bcpack_inspect`) | | `request_shorter` reported as `request_longer` | killed | | `at_boundary` ignored (always `truncated`) | killed | | `header_invalid` reported as `fragment_not_home` | killed | | trailing input reported as `end_state_invalid` | killed | | `end_state_invalid` reported as `no_progress` | killed | | `decode_lanes` ignores the report (fast path) | killed | | destination-alignment check removed | killed | | BC7 block stage skipped (`if (bc_format == 7)` → `if (false)`) | **survives** | Restored and rebuilt afterwards; `git diff --quiet` is clean. **Non-blocking.** 1. **`control_code_unmapped` is unpinned.** This is the survivor above. The PR description already says no stream reaches this class. A follow-up could reach `decode_bc7_blocks` with hand-built lane symbols instead of a stream. 2. **Stale bullet in the description.** It says "Layouts exist for BC1 and BC7 only". The header also has BC3, BC4 and BC5 layouts, and the BC3/4/5 cases are tested, as a later paragraph of the description says. **Verdict:** approve on `7de1131b`. R0Y00's changes request on `f4986099` still stands, so the merge waits for R0Y00 to re-check it. Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090, driver 32.0.16.1088 for `bc7_draw_hardware`. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `7de1131b`. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-28 08:10:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T08:10:14Z.


Thanks for the update. I reviewed head 7de1131b merged over current main (1f07b2c1); git merge-tree --write-tree origin/main 7de1131b exits 0. R0Y00's scratch-cost request is addressed: if (... || output_size > inspect_max_output) return result; runs before any allocation, with inspect_max_output = size_t{16} << 20.

One thing needs fixing before merge:

  1. The inspector no longer agrees with decode_bcpack on BC2 and BC6H. #3293 landed after the approval and CI and added case 2: and case 6: to decode_bcpack (alphabets[7][16], 15 and 16 lanes). INSPECT_LAYOUTS still lists only formats 1, 7, 3, 4 and 5. A probe that runs both on 17-block streams built with tests/bcpack_format_fixtures.h prints fmt 2: decode_bcpack=1 inspect=unsupported_format agree=0, the same for fmt 6, and disagreements=2. So the header's "Every format decode_bcpack decodes (BC1, BC3, BC4, BC5 and BC7) has a lane layout here" and the body's "says ok exactly when decode_bcpack returns true" no longer hold. The suite stays green because expect_class("bc1 format 6", bc1, 6, 512, C::unsupported_format) asserts the old class: a BC1 stream doesn't decode as BC6H either. Suggested fix: merge main and add BC2 and BC6H layouts. Also add a BC6H block-stage class for if (mode < 1 || mode > 14) return false; in decode_bc6_blocks, or the inspector would say ok where the decode fails. Then point the "format 6" case at an unused format such as 8, and add BC2 and BC6H cases from the fixtures.

Also worth considering:

  • Deriving INSPECT_LAYOUTS from the decoder's table, or adding a test that compares the two, would stop this drift recurring. They match today for formats 1, 3, 4, 5 and 7.
  • control_code_unmapped is still unpinned (pigalot's if (bc_format == 7) → if (false) mutant survives). A new BC6H mode class would need its own hand-built case for the same reason.
  • header_invalid is described as "a fragment header names an alphabet wider than 8 bits", but the check is ln.eab > 8 on an alphabet index (ln.eab = (e < 10) ? ... : 9; main now says "Hardware alphabet indices, not literal symbol bit widths"). "alphabet index above 8" would be accurate.
  • CI is green, but the Windows job runs ctest --preset pr (100% tests passed out of 40) and its log has no bcpack_inspect line (grep -c bcpack_inspect → 0), so the new tests rest on local Windows runs. There is no docs/experiments.md entry, and the body's "Layouts exist for BC1 and BC7 only" bullet is stale.

Environment: Linux, g++ 14 with -fsanitize=address,undefined on an export of this head merged with c3204a9c. Results: bcpack_inspect_check: 202 cases, 0 failed; the collapse control gives 202 cases, 47 failed and exits 1 as required. main's two later commits touch no bcpack file (git diff --name-only between the two merge trees, grep -c bcpack → 0). I did no MSVC, Windows ctest or GPU run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7236408362 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7236408362). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T08:10:14Z. --- Thanks for the update. I reviewed head `7de1131b` merged over current `main` (`1f07b2c1`); `git merge-tree --write-tree origin/main 7de1131b` exits 0. R0Y00's scratch-cost request is addressed: `if (... || output_size > inspect_max_output) return result;` runs before any allocation, with `inspect_max_output = size_t{16} << 20`. One thing needs fixing before merge: 1. **The inspector no longer agrees with `decode_bcpack` on BC2 and BC6H.** #3293 landed after the approval and CI and added `case 2:` and `case 6:` to `decode_bcpack` (`alphabets[7][16]`, 15 and 16 lanes). `INSPECT_LAYOUTS` still lists only formats 1, 7, 3, 4 and 5. A probe that runs both on 17-block streams built with `tests/bcpack_format_fixtures.h` prints `fmt 2: decode_bcpack=1 inspect=unsupported_format agree=0`, the same for `fmt 6`, and `disagreements=2`. So the header's "Every format decode_bcpack decodes (BC1, BC3, BC4, BC5 and BC7) has a lane layout here" and the body's "says `ok` exactly when `decode_bcpack` returns true" no longer hold. The suite stays green because `expect_class("bc1 format 6", bc1, 6, 512, C::unsupported_format)` asserts the old class: a BC1 stream doesn't decode as BC6H either. Suggested fix: merge `main` and add BC2 and BC6H layouts. Also add a BC6H block-stage class for `if (mode < 1 || mode > 14) return false;` in `decode_bc6_blocks`, or the inspector would say `ok` where the decode fails. Then point the "format 6" case at an unused format such as 8, and add BC2 and BC6H cases from the fixtures. Also worth considering: - Deriving `INSPECT_LAYOUTS` from the decoder's table, or adding a test that compares the two, would stop this drift recurring. They match today for formats 1, 3, 4, 5 and 7. - `control_code_unmapped` is still unpinned (pigalot's `if (bc_format == 7)` → `if (false)` mutant survives). A new BC6H mode class would need its own hand-built case for the same reason. - `header_invalid` is described as "a fragment header names an alphabet wider than 8 bits", but the check is `ln.eab > 8` on an alphabet index (`ln.eab = (e < 10) ? ... : 9`; `main` now says "Hardware alphabet indices, not literal symbol bit widths"). "alphabet index above 8" would be accurate. - CI is green, but the Windows job runs `ctest --preset pr` (`100% tests passed out of 40`) and its log has no `bcpack_inspect` line (`grep -c bcpack_inspect` → `0`), so the new tests rest on local Windows runs. There is no `docs/experiments.md` entry, and the body's "Layouts exist for BC1 and BC7 only" bullet is stale. Environment: Linux, g++ 14 with `-fsanitize=address,undefined` on an export of this head merged with `c3204a9c`. Results: `bcpack_inspect_check: 202 cases, 0 failed`; the collapse control gives `202 cases, 47 failed` and exits 1 as required. `main`'s two later commits touch no bcpack file (`git diff --name-only` between the two merge trees, `grep -c bcpack` → `0`). I did no MSVC, Windows ctest or GPU run. This comment was AI-assisted.
tedin7 commented 2026-11-28 21:53:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T21:53:55Z.


Thanks @JohnConnorNPC, the BC2/BC6H drift was real. Pushed 23ab9d48e (origin/main merged with a merge commit, no force push).

What changed:

  • INSPECT_LAYOUTS now has BC2 (15 lanes) and BC6H (16 lanes), with the same alphabets as decode_bcpack.
  • A BC6H block with a mode outside 1 to 14 is reported as control_code_unmapped (the class text now says BC7 control code or BC6H mode), so the inspector no longer says ok where the decode fails.
  • header_invalid comment now says "alphabet index above 8".
  • Tests in bcpack_inspect_check: the old "format 6" unsupported case now uses format 8; a new test_all_formats_agree checks, for every format 1 to 7, that the layout shape and alphabets equal the decoder fixtures' table (drift fails), that a fixture stream of 17 blocks inspects as ok exactly when decode_bcpack succeeds, and that 8 of 17 blocks gives request_shorter_than_stream. It also builds a BC6H block with mode 15 and a BC7 block with an unmapped control code: both give control_code_unmapped (this pins the if (bc_format == 7) mutant that survived before).
  • Mutants that now fail: BC2 layout removed (1 fail), BC6H layout removed (2), one BC2 alphabet changed (2), BC6H mode stage removed (1), BC7 block stage removed (4).

Verification:

  • Linux: g++ -std=c++17 -fsanitize=address,undefined tests/bcpack_inspect_check.cpp (device-free): 265 cases, 0 failed; --mutate collapse still fails as the negative control.
  • Windows Server 2025 (D3D12 WARP), dev and release, PR head 23ab9d48e: x2w_pipe.py win2025 1940 --regex '^(bcpack_inspect|bcpack_inspect_collapse_control|bcpack_all_formats|bcpack_all_formats_golden_control|bcpack_encoder_roundtrip|bcpack_tables)$' -> 6/6 passed in both legs.

Not done: deriving the inspector table from the decoder's own table (the decoder keeps it private to decode_bcpack; the new test is the drift guard instead), and a docs/experiments.md entry.

@MasterDomino this one is ready for a re-review and merge when you have time. The old changes-requested review by @R0Y00 is for the scratch cost, which is fixed on this head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7246353101 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7246353101). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T21:53:55Z. --- Thanks @JohnConnorNPC, the BC2/BC6H drift was real. Pushed `23ab9d48e` (origin/main merged with a merge commit, no force push). What changed: - `INSPECT_LAYOUTS` now has BC2 (15 lanes) and BC6H (16 lanes), with the same alphabets as `decode_bcpack`. - A BC6H block with a mode outside 1 to 14 is reported as `control_code_unmapped` (the class text now says BC7 control code or BC6H mode), so the inspector no longer says `ok` where the decode fails. - `header_invalid` comment now says "alphabet index above 8". - Tests in `bcpack_inspect_check`: the old "format 6" unsupported case now uses format 8; a new `test_all_formats_agree` checks, for every format 1 to 7, that the layout shape and alphabets equal the decoder fixtures' table (drift fails), that a fixture stream of 17 blocks inspects as `ok` exactly when `decode_bcpack` succeeds, and that 8 of 17 blocks gives `request_shorter_than_stream`. It also builds a BC6H block with mode 15 and a BC7 block with an unmapped control code: both give `control_code_unmapped` (this pins the `if (bc_format == 7)` mutant that survived before). - Mutants that now fail: BC2 layout removed (1 fail), BC6H layout removed (2), one BC2 alphabet changed (2), BC6H mode stage removed (1), BC7 block stage removed (4). Verification: - Linux: `g++ -std=c++17 -fsanitize=address,undefined tests/bcpack_inspect_check.cpp` (device-free): `265 cases, 0 failed`; `--mutate collapse` still fails as the negative control. - Windows Server 2025 (D3D12 WARP), dev and release, PR head `23ab9d48e`: `x2w_pipe.py win2025 1940 --regex '^(bcpack_inspect|bcpack_inspect_collapse_control|bcpack_all_formats|bcpack_all_formats_golden_control|bcpack_encoder_roundtrip|bcpack_tables)$'` -> 6/6 passed in both legs. Not done: deriving the inspector table from the decoder's own table (the decoder keeps it private to `decode_bcpack`; the new test is the drift guard instead), and a `docs/experiments.md` entry. @MasterDomino this one is ready for a re-review and merge when you have time. The old changes-requested review by @R0Y00 is for the scratch cost, which is fixed on this head. AI-assisted; commands listed were executed locally.
JohnConnorNPC commented 2026-11-29 13:18:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:18:22Z.


I re-checked head 23ab9d48 against current main (c04e0dd6). git merge-tree --write-tree origin/main 23ab9d48 exits 0 (tree a3555eb1). Thanks for the fix. The BC2/BC6H point that blocked last time is resolved.

What I ran on that merged tree (Linux, g++ 14, -O2 -fsanitize=address,undefined, with a two-line intrin.h shim for _BitScanReverse/_BitScanForward):

  • bcpack_inspect_check → 265 cases, 0 failed, exit 0. --mutate collapse → 265 cases, 56 failed (collapsed control), exit 1.
  • Four mutants on a copy of bcpack_inspect.h, restored by hash afterwards. Each one fails the test:
    • BC6H block stage dropped → bc6 mode 15 block: class ok, want control_code_unmapped
    • BC7 block stage dropped → bc7 unmapped control code: class ok, want control_code_unmapped
    • BC6H layout deleted → format 6 has a layout
    • BC2's first alphabet changed → format 2 alphabets match the decoder fixtures
  • So control_code_unmapped is now pinned for both formats, and test_all_formats_agree compares every layout with bcpack_format_fixtures.h. Through expect_class it also compares each result with decode_bcpack.
  • Default path: unchanged. decode_lanes takes decode_lanes_reference only if (report). Nothing in src or tools outside bcpack_inspect.h calls inspect_bcpack or passes a LaneReport.
  • CI on 23ab9d48 passes (Windows 100% tests passed out of 73). But grep -c bcpack_inspect on the Windows job log gives 0. So your Windows Server 2025 WARP run (6/6) is the only Windows run of the new tests.

No MUST from me.

SHOULD

  1. Add bcpack_inspect and bcpack_inspect_collapse_control, and the bcpack_inspect_check target, to the pr preset. They're device-free, and you chose this test over deriving the table from the decoder as the drift guard, so CI should run it.

NIT
2. There's still no docs note for the inspector and its control (you mentioned this).
3. The PR body still says "Layouts exist for BC1 and BC7 only, the formats decode_bcpack decodes today."
4. The comment above test_lane_report still says "a fragment header whose first byte names an alphabet wider than 8 bits cannot come from the BC1 or BC7 layouts". The class comment now says "alphabet index above 8", and there are now seven layouts. The message "lane report: alphabet wider than 8 bits" has the same wording.

Merge status: R0Y00's CHANGES_REQUESTED review on f4986099 is still the review decision. It asked for the scratch cap, and that is in this head. GitHub blocks the merge until that review is re-done or dismissed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256439767 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1940#issuecomment-7256439767). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T13:18:22Z. --- I re-checked head `23ab9d48` against current `main` (`c04e0dd6`). `git merge-tree --write-tree origin/main 23ab9d48` exits 0 (tree `a3555eb1`). Thanks for the fix. The BC2/BC6H point that blocked last time is resolved. What I ran on that merged tree (Linux, g++ 14, `-O2 -fsanitize=address,undefined`, with a two-line `intrin.h` shim for `_BitScanReverse`/`_BitScanForward`): - `bcpack_inspect_check` → `265 cases, 0 failed`, exit 0. `--mutate collapse` → `265 cases, 56 failed (collapsed control)`, exit 1. - Four mutants on a copy of `bcpack_inspect.h`, restored by hash afterwards. Each one fails the test: - BC6H block stage dropped → `bc6 mode 15 block: class ok, want control_code_unmapped` - BC7 block stage dropped → `bc7 unmapped control code: class ok, want control_code_unmapped` - BC6H layout deleted → `format 6 has a layout` - BC2's first alphabet changed → `format 2 alphabets match the decoder fixtures` - So `control_code_unmapped` is now pinned for both formats, and `test_all_formats_agree` compares every layout with `bcpack_format_fixtures.h`. Through `expect_class` it also compares each result with `decode_bcpack`. - Default path: unchanged. `decode_lanes` takes `decode_lanes_reference` only `if (report)`. Nothing in `src` or `tools` outside `bcpack_inspect.h` calls `inspect_bcpack` or passes a `LaneReport`. - CI on `23ab9d48` passes (Windows `100% tests passed out of 73`). But `grep -c bcpack_inspect` on the Windows job log gives `0`. So your Windows Server 2025 WARP run (6/6) is the only Windows run of the new tests. No MUST from me. **SHOULD** 1. Add `bcpack_inspect` and `bcpack_inspect_collapse_control`, and the `bcpack_inspect_check` target, to the `pr` preset. They're device-free, and you chose this test over deriving the table from the decoder as the drift guard, so CI should run it. **NIT** 2. There's still no docs note for the inspector and its control (you mentioned this). 3. The PR body still says "Layouts exist for BC1 and BC7 only, the formats `decode_bcpack` decodes today." 4. The comment above `test_lane_report` still says "a fragment header whose first byte names an alphabet wider than 8 bits cannot come from the BC1 or BC7 layouts". The class comment now says "alphabet index above 8", and there are now seven layouts. The message `"lane report: alphabet wider than 8 bits"` has the same wording. Merge status: R0Y00's CHANGES_REQUESTED review on `f4986099` is still the review decision. It asked for the scratch cap, and that is in this head. GitHub blocks the merge until that review is re-done or dismissed. AI-assisted.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
R0Y00/Xbox2Windows!1933
No description provided.