Repository navigation
RR F pack tool: the bias split's integer part as the runtime computes it - #268
Merged
Merged
Conversation
…plit computes it (sign of zero) layout.bias_split and pack_weights' score-bias split took cb = numpy round, which gives -0.0 for a value in [-0.5, 0); the runtime's host split (rr_pack.cpp rne_int: floor, then up) gives +0.0 there, so tools/pack_model.py and the runtime packed a real model differently in the cb words of the bias blobs (test_model_pack.py: 70 of 159 blobs). rint_host now follows the runtime's rule exactly (same integers; -0.0 keeps -0.0). The kernels need only cb + cs = value and |cs| <= 1/2, and the sign of a zero cb reaches no shipped output, so no runtime or kernel change. Test: clean/rr_f/tests/test_layout_bias_split.py (constructed values: negatives in [-0.5, 0), -0.0, ties, extremes, non-finite; the score-bias split). Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
added a commit
that referenced
this pull request
Nov 16, 2026
…release-0.6.1 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
The RR F packing tool now uses the runtime's rounding for the bias split, so
tools/pack_model.pyand the runtime pack a model to the same bytes.[values | cb | cs]:cbis the nearest integer of the bias,csthe exact remainder. The tool tookcbfrom numpy'sround, which gives -0.0 for a value in [-0.5, 0); the runtime's host split (rr_pack.cpprne_int) gives +0.0 there. On a real model this madetest_model_pack.pyreport the bias blobs as different; values and remainders were already equal.layout.rint_hostfollows the runtime's rule exactly (same integers; -0.0 keeps -0.0) and is used bybias_splitand the score-bias split.cb + cs= the value with|cs| <= 1/2, and the sign of a zerocbreaches no output. The runtime and the kernels are not changed.Test:
clean/rr_f/tests/test_layout_bias_split.py(constructed values: negatives in [-0.5, 0), -0.0, ties, extremes, non-finite, and the score-bias split throughpack_weights), compared byte for byte with a line-for-line copy of the runtime's split.