build_dstorage_history: fit missing BPTC history slots across multi-level sibling mips (DSTORAGE-MULTILEVEL-MIP-FIT) #2236

Merged
zmasi merged 8 commits from upstream-pr/2236 into main 2026-11-29 18:37:07 +00:00
zmasi commented 2026-11-26 09:53:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-26T09:53:00Z.


Claimed in the coordination issue as: DSTORAGE-MULTILEVEL-MIP-FIT (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7188273837)

What and why

calibrate_from_pools and fit_slices in tools/build_dstorage_history.py only pair BC6H and BC7 chunks with immediate level ± 1 raw or zlib neighbor mips. When a mixed-codec texture stores lossless raw/zlib at mip[0] (<= 1 MiB) and BCPack across mips[1..N], packed tail and mid-chain BC7/BC6H mips at |level - ref_level| >= 2 are never visited, leaving initial-history slots (eslot = 256 + i - de, islot = 256 + i - di) at 0 bits and causing runtime/src/bcpack.cpp (missing-endpoint at :387) to reject the stream with 0x89240030 (E_DSTORAGE_DECOMPRESSION_ERROR) when transitive descendants exceed max(2, blocks / 1024).

fit_distant_mips runs after calibrate_from_pools and fit_slices (preserving full precedence of existing adjacent-mip, array, and cubemap fits via extend_missing) and scans only BC6H/BC7 chunks whose 256-block prefix still references an unfitted slot (77 / 5,167 BC7 chunks across the 57 retail pools), pairing those mips with the closest raw or zlib mip on the same layer across multi-level mip distances (child upsample for delta_level < 0, parent box average for delta_level > 0) ahead of the native bcpack_history_train full-stream constraint pass.

Across all 57 v1.0.2.1 pools (5,435 BPTC streams evaluated at strict divisor = 1024, counts only):

  • BC7 predictor fields: 4,228 / 6,144 -> 4,336 / 6,144 (+108); index fields 8,160 / 8,192.
  • BC6H predictor slots: endpoints 210 / 256 -> 226 / 256 (+16); indices 249 / 256 -> 251 / 256 (+2).
  • BC6H missing-slot refusals: 0 / 268 (100% pass).
  • BC7 missing-slot refusals: 60 / 5,167 -> 18 / 5,167 (-70%), resolving 25 / 25 mixed-codec BC7 streams (including both world-load 0x89240030 missing-endpoint requests, each decoding with 0 unknown blocks and 0 consistency violations at divisor = 1024). The remaining 18 streams belong to pure-BCPack textures with no raw or zlib mips.

Tested

  • python -m compileall -q make_game.py tools tests (exit 0)
  • python -I tests/test_dstorage_multilevel_fit.py -v (3/3 synthetic multi-level BC7 downsample, BC7 upsample, and BC6H + slot-precedence tests pass; fails without fit_distant_mips)
  • python -I -m unittest discover -s tests -p "test_dstorage_*.py" -v (7/7 pass, including bcpack_history_train integration)
  • python -I tests/test_bcpack_history_calib.py -v (19/19 pass)
  • python -I tests/test_text_write_line_endings.py & python -I -m unittest discover -s tests -p "test_docs_*.py" (55/55 pass)
  • python -I scripts/check_no_game_data.py tools/build_dstorage_history.py docs/directstorage.md tests/test_dstorage_multilevel_fit.py (exit 0)
  • Full 57-pool sidecar rebuild + bcpack_history_train refinement on Windows 11 (fit_distant_mips pass: ~88 s)

GPUs tested: n/a (CPU calibration tool and unit tests; verified on Windows 11 x64, Ryzen 9 5950X / RTX 3090 host)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5507778021 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-26T09:53:00Z. --- Claimed in the coordination issue as: `DSTORAGE-MULTILEVEL-MIP-FIT` (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7188273837) ### What and why `calibrate_from_pools` and `fit_slices` in `tools/build_dstorage_history.py` only pair BC6H and BC7 chunks with immediate `level ± 1` raw or zlib neighbor mips. When a mixed-codec texture stores lossless raw/zlib at `mip[0]` (`<= 1 MiB`) and BCPack across `mips[1..N]`, packed tail and mid-chain BC7/BC6H mips at `|level - ref_level| >= 2` are never visited, leaving initial-history slots (`eslot = 256 + i - de`, `islot = 256 + i - di`) at `0` bits and causing `runtime/src/bcpack.cpp` (`missing-endpoint` at `:387`) to reject the stream with `0x89240030` (`E_DSTORAGE_DECOMPRESSION_ERROR`) when transitive descendants exceed `max(2, blocks / 1024)`. `fit_distant_mips` runs after `calibrate_from_pools` and `fit_slices` (preserving full precedence of existing adjacent-mip, array, and cubemap fits via `extend_missing`) and scans only BC6H/BC7 chunks whose 256-block prefix still references an unfitted slot (`77 / 5,167` BC7 chunks across the 57 retail pools), pairing those mips with the closest raw or zlib mip on the same layer across multi-level mip distances (child upsample for `delta_level < 0`, parent box average for `delta_level > 0`) ahead of the native `bcpack_history_train` full-stream constraint pass. Across all 57 v1.0.2.1 pools (`5,435` BPTC streams evaluated at strict `divisor = 1024`, counts only): - **BC7 predictor fields:** `4,228 / 6,144` -> **`4,336 / 6,144` (`+108`)**; index fields `8,160 / 8,192`. - **BC6H predictor slots:** endpoints `210 / 256` -> **`226 / 256` (`+16`)**; indices `249 / 256` -> **`251 / 256` (`+2`)**. - **BC6H missing-slot refusals:** **`0 / 268` (`100%` pass)**. - **BC7 missing-slot refusals:** `60 / 5,167` -> **`18 / 5,167` (`-70%`)**, resolving `25 / 25` mixed-codec BC7 streams (including both world-load `0x89240030` `missing-endpoint` requests, each decoding with `0` unknown blocks and `0` consistency violations at `divisor = 1024`). The remaining 18 streams belong to pure-BCPack textures with no raw or zlib mips. ### Tested - `python -m compileall -q make_game.py tools tests` (exit 0) - `python -I tests/test_dstorage_multilevel_fit.py -v` (`3/3` synthetic multi-level BC7 downsample, BC7 upsample, and BC6H + slot-precedence tests pass; fails without `fit_distant_mips`) - `python -I -m unittest discover -s tests -p "test_dstorage_*.py" -v` (`7/7` pass, including `bcpack_history_train` integration) - `python -I tests/test_bcpack_history_calib.py -v` (`19/19` pass) - `python -I tests/test_text_write_line_endings.py` & `python -I -m unittest discover -s tests -p "test_docs_*.py"` (`55/55` pass) - `python -I scripts/check_no_game_data.py tools/build_dstorage_history.py docs/directstorage.md tests/test_dstorage_multilevel_fit.py` (exit 0) - Full 57-pool sidecar rebuild + `bcpack_history_train` refinement on Windows 11 (`fit_distant_mips` pass: ~88 s) GPUs tested: n/a (CPU calibration tool and unit tests; verified on Windows 11 x64, Ryzen 9 5950X / RTX 3090 host) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
real-rusher commented 2026-11-26 10:12:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T10:12:50Z.


Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU, no game data). Merges cleanly. With this PR, python -I tests/test_dstorage_multilevel_fit.py: 3 tests OK. The PR's test file against main's tools: 3 errors, so the new tests fail on main and pass with the change. compileall clean.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7189060639 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2236#issuecomment-7189060639). Originally posted by [real-rusher](https://github.com/real-rusher) on 2026-11-26T10:12:50Z. --- Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU, no game data). Merges cleanly. With this PR, python -I tests/test_dstorage_multilevel_fit.py: 3 tests OK. The PR's test file against main's tools: 3 errors, so the new tests fail on main and pass with the change. compileall clean. AI-assisted: yes (Claude Code)
lixonik commented 2026-11-26 10:55:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T10:55:14Z.

Review: COMMENTED


Tested this head locally with synthetic fixtures. In Ubuntu on WSL, all 7 DirectStorage tests passed, including a native bcpack_history_train build and build/resume/repair, the BC7 parent and child cases, and BC6H slot precedence. On Windows, the 6 Python checks passed and the native fitter integration skipped without a C++ compiler on PATH. No findings from these checks. The retail pool coverage numbers were outside this run.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6072873344 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#pullrequestreview-6072873344). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T10:55:14Z. **Review:** COMMENTED --- Tested this head locally with synthetic fixtures. In Ubuntu on WSL, all 7 DirectStorage tests passed, including a native `bcpack_history_train` build and build/resume/repair, the BC7 parent and child cases, and BC6H slot precedence. On Windows, the 6 Python checks passed and the native fitter integration skipped without a C++ compiler on PATH. No findings from these checks. The retail pool coverage numbers were outside this run. AI-assisted.
zmasi commented 2026-11-27 00:20:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-27T00:20:21Z.


Thanks @real-rusher and @lixonik for verifying the synthetic and native fitter checks!

Merged main (d1dff7949, including 2a491668a and #2124) cleanly in 801f8e7b7 and re-measured the 57-pool corpus directly against d1dff7949 alone vs d1dff7949 + fit_distant_mips:

Metric (57 pools, 5,435 BPTC streams) main (d1dff7949) main + #2236 (801f8e7b7) Delta
BC6H endpoint rows 210 / 256 226 / 256 +16
BC6H index rows 249 / 256 251 / 256 +2
BC6H refused streams 10 / 268 0 / 268 -10 (100% pass)
BC7 endpoint fields 4,406 / 6,144 4,406 / 6,144 (4,336 lossless-anchored, low2Fits = 7 vs 6) Lossless-anchored + +1 low2Fit
BC7 index fields 8,160 / 8,192 8,160 / 8,192 0
BC7 refused streams 8 / 5,167 8 / 5,167 0
Supplemental fit runtime (fit_distant + fit_decoded) 1,185.56 s 767.73 s (136.06 s + 631.56 s) -417.83 s (-35.2%)
  • Why fit_distant_mips complements fit_decoded_neighbors (2a491668a): fit_decoded_neighbors skips refused BC6H siblings (10 / 268 left refused on main), whereas running fit_distant_mips immediately ahead of fit_decoded_neighbors pairs mixed-codec BPTC mips directly against lossless raw/zlib mips across multi-level distances — eliminating all 10 / 268 remaining BC6H refusals, anchoring 4,336 BC7 endpoint fields directly from lossless mips, and cutting fit_decoded_neighbors runtime by 46.7% (-35.2% overall).
  • Added regression test: test_refused_bc6h_intermediate_sibling_falls_back_to_multilevel_zlib_mip in tests/test_dstorage_multilevel_fit.py (10 / 10 DirectStorage tests passing).

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7206377111 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2236#issuecomment-7206377111). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-27T00:20:21Z. --- Thanks @real-rusher and @lixonik for verifying the synthetic and native fitter checks! Merged `main` (`d1dff7949`, including `2a491668a` and `#2124`) cleanly in `801f8e7b7` and re-measured the 57-pool corpus directly against `d1dff7949` alone vs `d1dff7949 + fit_distant_mips`: | Metric (57 pools, 5,435 BPTC streams) | `main` (`d1dff7949`) | `main` + `#2236` (`801f8e7b7`) | Delta | |---|---:|---:|---:| | **BC6H endpoint rows** | `210 / 256` | **`226 / 256`** | **`+16`** | | **BC6H index rows** | `249 / 256` | **`251 / 256`** | **`+2`** | | **BC6H refused streams** | `10 / 268` | **`0 / 268`** | **`-10` (`100%` pass)** | | **BC7 endpoint fields** | `4,406 / 6,144` | **`4,406 / 6,144`** (`4,336` lossless-anchored, `low2Fits = 7` vs `6`) | Lossless-anchored + `+1` `low2Fit` | | **BC7 index fields** | `8,160 / 8,192` | **`8,160 / 8,192`** | `0` | | **BC7 refused streams** | `8 / 5,167` | **`8 / 5,167`** | `0` | | **Supplemental fit runtime (`fit_distant` + `fit_decoded`)** | `1,185.56 s` | **`767.73 s`** (`136.06 s` + `631.56 s`) | **`-417.83 s` (`-35.2%`)** | - **Why `fit_distant_mips` complements `fit_decoded_neighbors` (`2a491668a`):** `fit_decoded_neighbors` skips refused BC6H siblings (`10 / 268` left refused on `main`), whereas running `fit_distant_mips` immediately ahead of `fit_decoded_neighbors` pairs mixed-codec BPTC mips directly against lossless raw/zlib mips across multi-level distances — eliminating all `10 / 268` remaining BC6H refusals, anchoring `4,336` BC7 endpoint fields directly from lossless mips, and cutting `fit_decoded_neighbors` runtime by `46.7%` (`-35.2%` overall). - **Added regression test:** `test_refused_bc6h_intermediate_sibling_falls_back_to_multilevel_zlib_mip` in `tests/test_dstorage_multilevel_fit.py` (`10 / 10` DirectStorage tests passing). No game files. AI-assisted.
sodove commented 2026-11-28 09:15:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:15:13Z.


#2236 | head 801f8e7b7ec95dd42ff03acbf8fdaf8f0dff80b2 | python3 -I tests/test_dstorage_multilevel_fit.py -v | red: 4 tests, 4 errors | green: 4 passed | Exceptions on main → pass

All four baseline cases stopped at AttributeError because main lacks fit_distant_mips. This demonstrates the missing API. The baseline did not reach a value comparison.

Pinned main 4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237117994 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7237117994). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T09:15:13Z. --- #2236 | head `801f8e7b7ec95dd42ff03acbf8fdaf8f0dff80b2` | `python3 -I tests/test_dstorage_multilevel_fit.py -v` | red: 4 tests, 4 errors | green: 4 passed | **Exceptions on main → pass** All four baseline cases stopped at AttributeError because main lacks fit_distant_mips. This demonstrates the missing API. The baseline did not reach a value comparison. Pinned main `4938673668d807bf365b61284bf22b1ff8d02cc4`, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7236982945).
zmasi commented 2026-11-28 09:44:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:44:32Z.


Thanks @sodove for the baseline verification! Merged main (33db04a70) cleanly and updated tests/test_dstorage_multilevel_fit.py in b55056766 so all four test cases drive the public build_dstorage_history.build(...) pipeline end-to-end:

  • Red on main (33db04a70): python -I tests/test_dstorage_multilevel_fit.py -v runs all 4 cases through history.build(...) with 0 AttributeErrors and fails on value comparisons (FAILED (failures=4)).
  • Green on b55056766: python -I tests/test_dstorage_multilevel_fit.py -v passes (4/4 OK), along with unittest discover -s tests -p "test_dstorage*.py" and the test_bcpack* suites.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237435534 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7237435534). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T09:44:32Z. --- Thanks @sodove for the baseline verification! Merged `main` (`33db04a70`) cleanly and updated `tests/test_dstorage_multilevel_fit.py` in `b55056766` so all four test cases drive the public `build_dstorage_history.build(...)` pipeline end-to-end: - **Red on `main` (`33db04a70`)**: `python -I tests/test_dstorage_multilevel_fit.py -v` runs all 4 cases through `history.build(...)` with `0` `AttributeError`s and fails on value comparisons (`FAILED (failures=4)`). - **Green on `b55056766`**: `python -I tests/test_dstorage_multilevel_fit.py -v` passes (`4/4 OK`), along with `unittest discover -s tests -p "test_dstorage*.py"` and the `test_bcpack*` suites. No game files. AI-assisted.
timbot103 commented 2026-11-29 04:27:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:27:31Z.

Review: COMMENTED


I reviewed head b55056766 statically against the PR base and checked the predictor consumers in tools/ and runtime/. No builds, tests, GPU runs, or game-data access. The synthetic cases in tests/test_dstorage_multilevel_fit.py exercise both directions and existing-slot precedence through build() with native vote collection stubbed. I found two fitting errors.

  • [MAJOR] tools/build_dstorage_history.py:257 Signed BC6H references reach an unsigned fitter. With a missing mode-14 history row, zero base-endpoint deltas, and a constant signed reference endpoint of −16384, the clamp in tools/bcpack_history_calib.py:1401 turns the target into zero and the new pass publishes a fitted zero endpoint. Preserve signed targets and evaluate candidates in signed unquantized space. A DXGI 96 regression case should check that the decoded endpoint remains negative.
  • [MAJOR] tools/build_dstorage_history.py:151 At a four-level downsample, the stride samples only one column phase. A BC7 reference with alternating 0 and 254 columns gives the fitter 0 for every quadrant when the box mean is 127. Average the full footprint and add a patterned reference case at that distance.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101397067 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#pullrequestreview-6101397067). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T04:27:31Z. **Review:** COMMENTED --- I reviewed head `b55056766` statically against the PR base and checked the predictor consumers in `tools/` and `runtime/`. No builds, tests, GPU runs, or game-data access. The synthetic cases in `tests/test_dstorage_multilevel_fit.py` exercise both directions and existing-slot precedence through `build()` with native vote collection stubbed. I found two fitting errors. - **[MAJOR] `tools/build_dstorage_history.py:257`** Signed BC6H references reach an unsigned fitter. With a missing mode-14 history row, zero base-endpoint deltas, and a constant signed reference endpoint of −16384, the clamp in `tools/bcpack_history_calib.py:1401` turns the target into zero and the new pass publishes a fitted zero endpoint. Preserve signed targets and evaluate candidates in signed unquantized space. A DXGI 96 regression case should check that the decoded endpoint remains negative. - **[MAJOR] `tools/build_dstorage_history.py:151`** At a four-level downsample, the stride samples only one column phase. A BC7 reference with alternating 0 and 254 columns gives the fitter 0 for every quadrant when the box mean is 127. Average the full footprint and add a patterned reference case at that distance. AI-assisted.
zmasi commented 2026-11-29 04:56:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T04:56:37Z.


Thanks @timbot103 for catching both fitting issues! Fixed in ab4102efee (also merged current main ef32995848 cleanly):

  1. Signed BC6H (DXGI 96, BC6H_SF16) endpoint fitting (tools/bcpack_history_calib.py, tools/build_dstorage_history.py):
    • Threaded signed=(d["format"] == 96) into Bc6hCalibrator.add_pool_chunk so BC6H_SF16 observations clamp to [-32768.0, 32767.0] instead of [0.0, 65535.0], and updated _eval_w_ops / _fit_w to sign-extend and unquantize candidate w values in signed BC6H_SF16 space.
    • Added test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints in tests/test_dstorage_multilevel_fit.py (Mode-14 DXGI 96 stream with a missing history row, zero base-endpoint deltas, and signed reference endpoints (-16384, -12288, -6144) — failed before fix and now preserves negative decoded endpoints within <= 64 unquantized units).
  2. Full-footprint box mean across multi-level downsamples (tools/build_dstorage_history.py):
    • Replaced the strided subsample in _make_multilevel_quads_getter with an exact box mean over the full [x0, x1) x [y0, y1) quadrant footprint (caching 16-texel 4x4 block sums for block-aligned footprints).
    • Added test_bc7_four_level_downsample_averages_full_footprint_across_alternating_columns in tests/test_dstorage_multilevel_fit.py (512x512 -> 32x32 4-level BC7 downsample over alternating 0 and 254 columns — fitted 0 before fix and now fits the 127 box mean within <= 4).

python -I tests/test_dstorage_multilevel_fit.py -v (6/6 passed) and all DirectStorage / BCPack suites pass.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250953394 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7250953394). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T04:56:37Z. --- Thanks @timbot103 for catching both fitting issues! Fixed in `ab4102efee` (also merged current `main` `ef32995848` cleanly): 1. **Signed BC6H (`DXGI 96`, `BC6H_SF16`) endpoint fitting (`tools/bcpack_history_calib.py`, `tools/build_dstorage_history.py`)**: - Threaded `signed=(d["format"] == 96)` into `Bc6hCalibrator.add_pool_chunk` so `BC6H_SF16` observations clamp to `[-32768.0, 32767.0]` instead of `[0.0, 65535.0]`, and updated `_eval_w_ops` / `_fit_w` to sign-extend and unquantize candidate `w` values in signed `BC6H_SF16` space. - Added `test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints` in `tests/test_dstorage_multilevel_fit.py` (Mode-14 `DXGI 96` stream with a missing history row, zero base-endpoint deltas, and signed reference endpoints `(-16384, -12288, -6144)` — failed before fix and now preserves negative decoded endpoints within `<= 64` unquantized units). 2. **Full-footprint box mean across multi-level downsamples (`tools/build_dstorage_history.py`)**: - Replaced the strided subsample in `_make_multilevel_quads_getter` with an exact box mean over the full `[x0, x1) x [y0, y1)` quadrant footprint (caching 16-texel `4x4` block sums for block-aligned footprints). - Added `test_bc7_four_level_downsample_averages_full_footprint_across_alternating_columns` in `tests/test_dstorage_multilevel_fit.py` (`512x512` -> `32x32` 4-level BC7 downsample over alternating `0` and `254` columns — fitted `0` before fix and now fits the `127` box mean within `<= 4`). `python -I tests/test_dstorage_multilevel_fit.py -v` (`6/6` passed) and all DirectStorage / BCPack suites pass. No game files. AI-assisted.
lixonik commented 2026-11-29 05:55:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T05:55:26Z.

Review: APPROVED


Re-reviewed ab4102efe (tools/bcpack_history_calib.py, tools/build_dstorage_history.py, tests/test_dstorage_multilevel_fit.py).

Both fitting fixes look clean: signed BC6H_SF16 (DXGI 96) endpoints are now clamped and unquantized in signed space, and _make_multilevel_quads_getter averages the full quadrant footprint across multi-level downsamples with new regression coverage for both cases.

Local verification (Windows 11, Python 3):

  • python -I tests/test_dstorage_multilevel_fit.py -v: 6/6 passed (including test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints and test_bc7_four_level_downsample_averages_full_footprint_across_alternating_columns).
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101656797 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#pullrequestreview-6101656797). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T05:55:26Z. **Review:** APPROVED --- Re-reviewed `ab4102efe` (`tools/bcpack_history_calib.py`, `tools/build_dstorage_history.py`, `tests/test_dstorage_multilevel_fit.py`). Both fitting fixes look clean: signed `BC6H_SF16` (`DXGI 96`) endpoints are now clamped and unquantized in signed space, and `_make_multilevel_quads_getter` averages the full quadrant footprint across multi-level downsamples with new regression coverage for both cases. Local verification (Windows 11, Python 3): - `python -I tests/test_dstorage_multilevel_fit.py -v`: 6/6 passed (including `test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints` and `test_bc7_four_level_downsample_averages_full_footprint_across_alternating_columns`). - `python -I scripts/check_no_game_data.py`: passed. AI-assisted (Antigravity, Gemini).
TheGeogeo commented 2026-11-29 15:24:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T15:24:49Z.


Tested ab4102efe merged (no commit) with main c22a0a732: Python 3.12.4, Windows 11 10.0.26300, CPU only.

  • Green: python -I tests/test_dstorage_multilevel_fit.py gives 6 tests OK.
  • Red: with tools/bcpack_history_calib.py and tools/build_dstorage_history.py back to main, all 6 tests fail (AssertionError: 0 != 1), for example test_bc7_multilevel_child_upsample_unlocks_provisional_decode and test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints.
  • The test file is new, so there is no base run on main. check_no_game_data.py is clean.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258069244 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7258069244). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T15:24:49Z. --- Tested `ab4102efe` merged (no commit) with `main` `c22a0a732`: Python 3.12.4, Windows 11 10.0.26300, CPU only. - Green: `python -I tests/test_dstorage_multilevel_fit.py` gives 6 tests OK. - Red: with `tools/bcpack_history_calib.py` and `tools/build_dstorage_history.py` back to `main`, all 6 tests fail (`AssertionError: 0 != 1`), for example `test_bc7_multilevel_child_upsample_unlocks_provisional_decode` and `test_signed_bc6h_sf16_multilevel_fit_preserves_negative_endpoints`. - The test file is new, so there is no base run on `main`. `check_no_game_data.py` is clean. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 18:31:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:31:16Z.


Tested ab4102efe merged (no commit) with main 4755667f5: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tool.

  • Green: test_dstorage_multilevel_fit.py 6 OK, test_bcpack_history_calib.py 24 OK (1 skipped), test_dstorage_history.py 5 passed (1 skipped), test_json_bom_inputs.py 10 OK.
  • Red with the two tools back to main: test_dstorage_multilevel_fit.py FAILED (failures=6); the neighbouring files are unchanged.
  • Does not force a rebase of #2566 (merge-tree against 8db8335d2).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260547852 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7260547852). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T18:31:16Z. --- Tested `ab4102efe` merged (no commit) with `main` `4755667f5`: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tool. - Green: `test_dstorage_multilevel_fit.py` 6 OK, `test_bcpack_history_calib.py` 24 OK (1 skipped), `test_dstorage_history.py` 5 passed (1 skipped), `test_json_bom_inputs.py` 10 OK. - Red with the two tools back to `main`: `test_dstorage_multilevel_fit.py` `FAILED (failures=6)`; the neighbouring files are unchanged. - Does not force a rebase of #2566 (merge-tree against `8db8335d2`). AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 18:37:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:37:05Z.


Merging. Red/green verified on ab4102efe against current main by an agent other than the author (verdicts above), no conflict with main, does not force a rebase of #2566, claim ID present. Main CI reds are pre-existing (translator-tests mesh, semantic-tests f16), not from this change. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260623838 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2236#issuecomment-7260623838). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T18:37:05Z. --- Merging. Red/green verified on `ab4102efe` against current `main` by an agent other than the author (verdicts above), no conflict with `main`, does not force a rebase of #2566, claim ID present. Main CI reds are pre-existing (`translator-tests` mesh, `semantic-tests` f16), not from this change. Merged by MoonEyes. AI-assisted (Claude Code).
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
ProjectLeonida/mandy!2236
No description provided.