Repository navigation
Conversation
Replace `ZSTD_fseState::state` (`table + state` recomputed across all three FSE tables on every sequence) with a precomputed entry pointer (`statePtr`), and mark `ZSTD_initFseState` `FORCE_INLINE_TEMPLATE` (matching `ZSTD_updateFseStateWithDInfo`) so `&seqState` does not address-escape to an out-of-line call on older GCC.
This branch has not been deployed
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.
What and why
In
ZSTD_decodeSequence,table + stateis recomputed across all three FSE state tables (stateLL,stateML,stateOffb) on every sequence whileZSTD_initFseStateis non-forced-inline (unlikeZSTD_updateFseStateWithDInfo).Replace
ZSTD_fseState::statewith a precomputed entry pointer (statePtr = table + nextState + lowBits) and markZSTD_initFseStateFORCE_INLINE_TEMPLATEso&seqStatedoes not address-escape to an out-of-line call on older GCC (which prevented SRA and spilledbitContainer). (Part 1 of a 3-partZSTD_decodeSequenceseries.)Benchmark results
make(-O3) across bare-metalx86-64andaarch64(decompressionMB/svsdeveb1c858, pinned single core, median of 7 interleaved-i2s runs across built-in 10 MB synthetic-b1/-b3and 12-file Silesia212 MBzstd -d -bat-1/-3/-9):Results: AMD EPYC 7B13 64-Core Processor (
x86_64, plainmake-O3, 7 interleaved rounds,-i2s/round)gcc (Debian 15.2.0-14) 15.2.0devgcc (Debian 15.2.0-14) 15.2.0pr1Debian clang version 19.1.7 (10.1+build1)devDebian clang version 19.1.7 (10.1+build1)pr1Results: Neoverse-V2 (
aarch64, plainmake-O3, 7 interleaved rounds,-i2s/round)aarch64-linux-gnu-gcc-15 (Debian 15.2.0-4) 15.2.0devaarch64-linux-gnu-gcc-15 (Debian 15.2.0-4) 15.2.0pr1Debian clang version 19.1.7 (10.1+build1)devDebian clang version 19.1.7 (10.1+build1)pr1Results: Intel(R) Xeon(R) Platinum 8173M CPU @ 2.00GHz (
x86_64, plainmake-O3, 7 interleaved rounds,-i2s/round)gcc (Debian 15.2.0-14) 15.2.0devgcc (Debian 15.2.0-14) 15.2.0newDebian clang version 19.1.7 (10.1+build1)devDebian clang version 19.1.7 (10.1+build1)new-3.90%geomean cycles (-2.76%Fleet)-3.55%geomean cycles (-3.58%Fleet)+0.75%geomean cycles (+0.27%time, neutral)Checklist
Tools used
An AI coding assistant (Gemini) was used to help prototype code variants, inspect compiler disassembly, and collect benchmark measurements; all code changes and benchmark results were reviewed and verified by the author.