Add SMS-based partition pre-screener for inter frames - #5324
Open
YixinDu1 wants to merge 5 commits into
Open
Conversation
urvangjoshi
reviewed
Aug 27, 2026
urvangjoshi
left a comment
Contributor
There was a problem hiding this comment.
@YixinDu1 : Thanks for the PR. The loss is slightly higher for A2, but there's speed-up as well.
Question: what are the numbers for lower resolution sets? I see that you disabled the speed feature for some lower resolutions.
Contributor
Author
Thanks for the comment. The loss for lower res is around 0.1x and there is around 2% speedup. |
urvangjoshi
reviewed
Aug 27, 2026
Add a unified SMS pre-screener (sms_unified_prune) that runs one MLP inference per square block before the partition search and uses the output to prune partition candidates. Anchor: da53762 Test condition: CTC, RA, 33 frames, speed 4 RA: ``` +----------------+------+------+------+------+------+ | Class | Y | Cb | Cr | wAvg | Enc% | +----------------+------+------+------+------+------+ | A1 | 0.01 | 0.35 |-0.09 | 0.02 | 96.3 | | A2 | 0.14 | 0.14 | 0.27 | 0.14 | 95.5 | | Average w/o B2 | 0.09 | 0.12 | 0.29 | 0.10 | 96.7 | +----------------+------+------+------+------+------+ ``` STATS_CHANGED
…ward Replace the bespoke mlp_forward() and softmax_inplace() with the existing av2_nn_predict() + av2_nn_softmax() infrastructure. Define per-bsize NN_CONFIG structs referencing the existing weight arrays in partition_sms_weights.h. Bump NN_MAX_NODES_PER_LAYER 128→256 to accommodate H1=128.
- context_tree.h: use ALL_PARTITION_TYPES instead of literal 10 - Add SMS_N_SPLIT_PARTS define; replace all hardcoded 4s - Add feature description comment above SMS_FEAT_DIM - Use local const min_dim for AVMMIN(cm->width, cm->height) - Remove redundant ? 1 : 0 from boundary split indicators - Pass reduce_prec=1 to av2_nn_predict for cross-platform consistency - Use bool for horz_qualifies
YixinDu1
force-pushed
the
partition-pruning-sms
branch
from
August 27, 2026 23:55
bc01ea3 to
409cfe8
Compare
av2_nn_output_prec_reduce casts output[i]*512 to int, which overflows for our ~35M logits and triggers UBSan. reduce_prec=0 is correct here since logits are immediately consumed by av2_nn_softmax, which is shift-invariant — cross-platform differences in raw logits cancel out after normalization.
urvangjoshi
approved these changes
Aug 28, 2026
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.
Add a unified SMS pre-screener (sms_unified_prune) that runs one MLP inference per square block before the partition search and uses the output to prune partition candidates.
Anchor: da53762
Test condition: CTC, RA, 33 frames, speed 4
RA:
STATS_CHANGED