Add optional huge-page-backed memory pool#940
Draft
jeffhammond wants to merge 1 commit into
Draft
Conversation
Back BLIS's internal memory pools (the packed A/B/C buffers streamed by level-3 ops) with explicit huge pages when the OS provides them, reducing dTLB pressure and page walks for large operands. New allocator bli_hugepage_malloc / bli_hugepage_free (malloc/free- compatible) plug into BLIS_MALLOC_POOL / BLIS_FREE_POOL exactly like the existing libmemkind hbw_malloc hook. Per block, largest page first: 1 GiB hugetlb (MAP_HUGE_1GB) for >=1 GiB requests, then 2 MiB hugetlb (MAP_HUGE_2MB) for >=2 MiB, else ordinary malloc(). hugetlb blocks are mmap/munmap'd, malloc blocks free()'d; a small header before the returned pointer records which. The malloc fallback makes this a no-op when no hugetlb pool is reserved (and on a THP=always host the kernel promotes the malloc'd mmaps anyway), so there is no regression. Opt-in via -DBLIS_ENABLE_HUGEPAGE_POOL (off by default, like memkind). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jeffhammond
marked this pull request as draft
July 16, 2026 15:23
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.
Back BLIS's internal memory pools (the packed A/B/C buffers streamed by level-3 ops) with explicit huge pages when the OS provides them, reducing dTLB pressure and page walks for large operands.
New allocator bli_hugepage_malloc / bli_hugepage_free (malloc/free- compatible) plug into BLIS_MALLOC_POOL / BLIS_FREE_POOL exactly like the existing libmemkind hbw_malloc hook. Per block, largest page first: 1 GiB hugetlb (MAP_HUGE_1GB) for >=1 GiB requests, then 2 MiB hugetlb (MAP_HUGE_2MB) for >=2 MiB, else ordinary malloc(). hugetlb blocks are mmap/munmap'd, malloc blocks free()'d; a small header before the returned pointer records which. The malloc fallback makes this a no-op when no hugetlb pool is reserved (and on a THP=always host the kernel promotes the malloc'd mmaps anyway), so there is no regression.
Opt-in via -DBLIS_ENABLE_HUGEPAGE_POOL (off by default, like memkind).