Repository navigation
perf(groebner): disable transparent huge pages in the F4 drivers - #11044
Merged
Merged
Conversation
The Lean runtime allocator reserves its arena with MADV_HUGEPAGE. Under the common defrag=madvise kernel policy, first touches may compact memory synchronously and zero whole 2 MiB pages. The standalone driver executables now disable transparent huge pages for their own process before module initialization; HEX_GROEBNER_THP=1 keeps the inherited policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adjacent AB/BA comparison of the frozen main build and the THP-disabling driver on the first-size selection (64 pairs, identical outputs and counters), and the matched held-out msolve sweep. The report is recomputed from the retained capsule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kim-em
marked this pull request as ready for review
November 9, 2026 09:29
13 tasks
Derive the comparator revision from the campaign metadata, list families without jointly solved pairs instead of dropping them, pass long arguments to the variadic prctl, and state the constructor ordering precisely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kim-em
enabled auto-merge (squash)
November 9, 2026 11:27
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.
This PR disables transparent huge pages for the standalone F4 driver processes (
hexgroebner_compute,hexgroebner_sampleand their full-initialization variants). The Lean runtime's allocator reserves its 1 GiB arena withMADV_HUGEPAGE. Under the commontransparent_hugepage/defrag=madvisekernel policy, a first touch in that arena may compact memory synchronously and zero a whole 2 MiB page. On the shared host this was most of the startup cost (about 19M of 25M kernel instructions before any input is read) and added tens of percent to medium systems. Comparators using glibcmallocnever request huge pages under themadvisepolicy.A constructor in
HexGroebner/ffi/driver_memory.ccallsprctl(PR_SET_THP_DISABLE)before Lean module initialization. The kernel checks this flag at fault time for the whole process, so it also covers the arena that is already reserved. SettingHEX_GROEBNER_THP=1keeps the inherited policy for comparisons. Only the driver executables link this object; library code never changes process state, and other platforms are unaffected. Outputs and logical counters are unchanged.On the matched first-size selection (first primary size of all ten families in all three fields plus Eco-14/Eco-15 over F₂; 64 adjacent AB/BA pairs on one leased CPU against the frozen main build), the candidate-time ratio is 0.5947 and the process-time ratio 0.6643, with identical complete outputs and logical counters in every pair. Every family improves; the largest gains are on Katsura (0.42) and noon (0.44). How much huge-page compaction costs depends on host memory pressure, which also explains why earlier msolve sweeps of identical code ranged from 1.14 to 1.37. The matched held-out msolve sweep with this change gives an equal-family Hex/msolve process ratio of 1.0837 (dense-quadratic 1.42, positive-dimensional 0.95, sparse-structured 0.95), with 54 equal complete bases and no coverage loss. A full fixed-primary msolve sweep is still running and will be reported separately.
reports/bench-results/hexgroebner-thp.mdis recomputed byscripts/bench/groebner_thp_report.pyfrom the retained capsulef4-thp-64eddfd8f204(four parts, manifest-checked). Scientific samples were collected manually on the shared host.Continues #10987. Its correctness, finite-field coverage, parallel and fastest-open-source obligations remain open.
🤖 Prepared with Claude Code