Repository navigation
ttpf_mips: predict BC child mip means with the optional native decoder - #8837
Open
Raxstreams wants to merge 2 commits into
Open
Raxstreams wants to merge 2 commits into
Raxstreams wants to merge 2 commits into
Conversation
… decode and block_means A zero-dependency Rust crate, loaded through ctypes like tools/bcpack_calibration, ports the element copy of detile / detile_volume_slice, the BC4/BC5/BC6H/BC7 decoders behind decode_pixels and block_means (all BC kinds) step for step, so the bytes and the IEEE bits of every double are identical. The BPTC tables and BC6H header plans are passed from bcpack_tables_bptc / bcpack, not copied. Any call the library refuses (element outside the allocation, short payload, other buffer types) runs the Python code, which keeps its own result or error. Each block kind is checked against the Python decoder and means on seeded random blocks once and stays in Python if a double differs. LEONIDA_TTPF_NATIVE=0 turns it off. detile 13x-27x, detile_volume 16x, block_means 11x-13x, BC6H/BC7 decode_pixels 4.5x-12x (random synthetic data, Zen 3). tests/test_ttpf_native.py compares both paths; CI builds the crate and runs it with test_ttpf_mips.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on Apple M1 Max, macOS 27.2.1 arm64, Python 3.12.16: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as native child-mip mean prediction, following @TG0000’s performance finding. No item ID has been assigned.
Depends on: #8735
What and why
The mip checker still predicts child block means in Python after the optional native decoder produces the parent pixels. Use the original BC blocks remembered by that decoded list to predict the child means in Rust. The kernel sums parent samples in the same order as Python and respects visible mip bounds, including one-texel axes and padded storage.
The Python path handles modified pixel lists, non-BC data, or unavailable native prediction. Existing ABI 1 libraries retain their original kernels. The per-format startup comparison also checks prediction when the loaded library provides it.
The follow-up is commit
351d35fe9, on top of #8735. Follow-up diffTested
Windows 11 25H2, Ryzen 7 5800X, CPython 3.14.2, Rust 1.100.0 MSVC. CPU-only work on synthetic inputs. GPU and driver were unused.
-D warningsand all 9 Rust tests passed.test_ttpf_native.py: 21 passed with the library, including exact bit checks across BC formats, clipped and padded mips, and modified-list fallback. With the library disabled, 2 passed and 19 skipped.test_ttpf_mips.py: 93 passed in each mode.make_game.py --help,git diff --check, and the game-data checker passed. The stack merges cleanly with main867d922f0.-D warningspassed. All 9 Rust tests, 21 native Python tests, and 93 mip tests passed with the Linux shared library.test_image_atomics_guardandtest_image_store_d16(tests: fix image atomics guard and image_store d16 tests after #4473 and #6805 #7608).AI-assisted: yes (Codex).
Checklist