Assign BCPack refill bytes by each lane's read count #174

Merged
Vonsek merged 1 commit from upstream-pr/175 into main 2026-11-21 18:22:06 +00:00
Vonsek commented 2026-11-21 17:58:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:58:17Z.


Change

tools/bcpack_probe.py compared a constant lane's refill bytes with the supplied rounds by round position only:

  • the first refill byte was checked only when the lane's bit was set in --prefetch-mask;
  • the second refill byte was checked only when the bit was set in both masks and the lane had at least two refills.

A lane that does not read in the first round but reads in the second was therefore not checked at all, although under the round model that read consumes its first refill byte. A mask that gave a lane more reads than its header budget allows (for example a bit set for a verified constant lane with zero refills, or a second read for a one-refill lane) was silently ignored.

The probe now walks the two supplied rounds per lane and gives each read the lane's next refill byte, in consumption order. first_refill_* and second_refill_* keep their names and meaning (first and second byte the lane consumes). Reads past the budget are listed as packet offsets under unbudgeted_read_offsets. Results for masks that were already handled are unchanged; the existing two-refill and one-refill tests pass as before. The --next-mask help text and the BCPack paragraph in docs/experiments.md describe the rule.

This remains a diagnostic for the published fixed-symbol model; it does not resolve the variable BC7 lane models.

Verification

  • Linux, Python 3: python3 -B tests/bcpack_check.py — 6 tests OK.
  • New test test_refill_follows_lane_read_count uses the source-built headers already in the suite (two-refill lane de 05 03 0c 86 4e at 25000 blocks, one-refill lane de 04 01 00 11 30 at 11358 blocks, verified constant lane de 03 01 00 40 02 at 2 blocks). With tools/bcpack_probe.py from main it errors (KeyError: 'first_refill_offset') because the second-round first read is not reported; with this change it passes. The negative control replaces the expected byte AC with 7D (the lane's second refill byte) and requires first_refill_matches to be false.
  • CLI: a 51-byte synthetic packet with --blocks 25000 --prefetch-mask 1 --next-mask 0x11 reports lane 4 first_refill_offset: 50, first_refill_matches: true.
  • Windows: ctest --preset dev --no-tests=error -R '^bcpack_prefix_and_mip_tail$' -V at ea14ed4 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12: passed (Ran 6 tests, OK). The full ctest --preset dev --no-tests=error passed 86/86, with bvh_wave64_hardware, bvh_wave64_warp and wave_shuffle_warp skipped.

Evidence and follow-up

All inputs are synthetic headers built in the test. Only two rounds can be supplied, so a lane can be checked against at most its first two refill bytes. Whether real streams follow this per-lane round order is still a hypothesis, as before (#15).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532439784 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/175). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T17:58:17Z. --- ## Change `tools/bcpack_probe.py` compared a constant lane's refill bytes with the supplied rounds by round position only: - the first refill byte was checked only when the lane's bit was set in `--prefetch-mask`; - the second refill byte was checked only when the bit was set in both masks and the lane had at least two refills. A lane that does not read in the first round but reads in the second was therefore not checked at all, although under the round model that read consumes its first refill byte. A mask that gave a lane more reads than its header budget allows (for example a bit set for a verified constant lane with zero refills, or a second read for a one-refill lane) was silently ignored. The probe now walks the two supplied rounds per lane and gives each read the lane's next refill byte, in consumption order. `first_refill_*` and `second_refill_*` keep their names and meaning (first and second byte the lane consumes). Reads past the budget are listed as packet offsets under `unbudgeted_read_offsets`. Results for masks that were already handled are unchanged; the existing two-refill and one-refill tests pass as before. The `--next-mask` help text and the BCPack paragraph in `docs/experiments.md` describe the rule. This remains a diagnostic for the published fixed-symbol model; it does not resolve the variable BC7 lane models. ## Verification - Linux, Python 3: `python3 -B tests/bcpack_check.py` — 6 tests OK. - New test `test_refill_follows_lane_read_count` uses the source-built headers already in the suite (two-refill lane `de 05 03 0c 86 4e` at 25000 blocks, one-refill lane `de 04 01 00 11 30` at 11358 blocks, verified constant lane `de 03 01 00 40 02` at 2 blocks). With `tools/bcpack_probe.py` from `main` it errors (`KeyError: 'first_refill_offset'`) because the second-round first read is not reported; with this change it passes. The negative control replaces the expected byte `AC` with `7D` (the lane's second refill byte) and requires `first_refill_matches` to be false. - CLI: a 51-byte synthetic packet with `--blocks 25000 --prefetch-mask 1 --next-mask 0x11` reports lane 4 `first_refill_offset: 50`, `first_refill_matches: true`. - Windows: `ctest --preset dev --no-tests=error -R '^bcpack_prefix_and_mip_tail$' -V` at ea14ed4 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12: passed (Ran 6 tests, OK). The full `ctest --preset dev --no-tests=error` passed 86/86, with `bvh_wave64_hardware`, `bvh_wave64_warp` and `wave_shuffle_warp` skipped. ## Evidence and follow-up All inputs are synthetic headers built in the test. Only two rounds can be supplied, so a lane can be checked against at most its first two refill bytes. Whether real streams follow this per-lane round order is still a hypothesis, as before (#15).
upstream-sync closed this pull request 2026-11-24 06:41:41 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:19:33Z.


Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:22:05.905191Z ea14ed4 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:7067171179 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/175#issuecomment-7067171179). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T18:19:33Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"ea14ed4763f2b978979e4e27a7ee5d1f46c13d36","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T18:22:05.905191Z">2026-11-21T18:22:05.905191Z</relative-time> | `ea14ed4` | 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>
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!174
No description provided.