Add fallback to bit packing in FBW encoder #253
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.
Summary:
Today FBW encoding uses byte aligned bit packing, meaning that the bit width will be rounded to the next closest bit (6->8, 9->16). We do this because we noticed that compression does not work well with optimally bit packed data.
This introduces several regressions:
To partially mitigate the issue this change introduces a fallback to uncompressed bit packed data if a ratio between sizes of byte aligned compressed data and uncompressed bit aligned is below a certain ration. The ratio is currently hardcoded at 0.99 for now.
The downside of this change is that the writer will have to spend extra CPU cycles to repack the data using bit packing. I also decided to not attempt to compress bit packed data to save on CPU cycles, but actually nothing stops us from doing the second attempt - I'm pretty sure that at certain bit/byte packed size ratios the compression attempt might succeed.
Differential Revision: D82491030