[PR #650] [CLOSED] pinned: back the Linux expert arena with transparent huge pages #2742

Closed
opened 2026-11-04 02:02:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/650
Author: @anon761
Created: 10/3/2026
Status: ❌ Closed

Base: main ← Head: linux-arena-thp


📝 Commits (1)

  • 12a89be pinned: back the Linux expert arena with transparent huge pages

📊 Changes

1 file changed (+20 additions, -2 deletions)

View changed files

📝 src/core/pinned.cu (+20 -2)

📄 Description

What

Without a hugetlb pool (vm.nr_hugepages=0, the default on most distros) the Linux expert arena falls back to a plain anonymous mapping with 4 KB pages:

strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 36727 2 MiB pages, vm.nr_hugepages=0); using 4 KB pages

The CPU expert pool streams whole experts (3-4 MB each for the 4-5 bit GGUFs) out of that arena, so every expert walks ~750-1000 pages through the TLB, and pinning ~72 GiB with cudaHostRegister has to lock ~18.8 M pages.

This maps the fallback 2 MiB-aligned and madvise(MADV_HUGEPAGE)s it, so THP in madvise mode (the common distro default) backs it. STRATA_NO_LARGEPAGES=1 keeps 4 KB pages, as on the hugetlb path. The log note says which one the arena got:

strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 36727 2 MiB pages, vm.nr_hugepages=0); transparent huge pages requested (MADV_HUGEPAGE)

Linux only; the Windows path and the hugetlb path are unchanged.

Measured

2x RTX 3090 (layer split auto), EPYC 7413 (24C, AVX2), Unsloth UD-Q4_K_XL (71.7 GiB of experts), 262K context, --kv int8 --pcie-frac 0 --ple-io ram, engine at current main, same binary flags otherwise. Before = main, after = this branch.

before after
engine start until /v1/models says loaded (several starts each) 65 s 40-45 s
expert load (loaded 71.73 GiB at ...) 3.56 GiB/s 3.59 GiB/s
decode, default expert cache (2K / 8K prompt) 92.8 / 93.1 tok/s 93.2 / 88.2 tok/s
decode, --expert-cache 1200 (CPU computes most misses), 4 runs 69.5 tok/s 71.1 tok/s
CPU pool per expert entry (STRATA_DECODE_TIMING, same run) 1.31 ms 1.25 ms

The read itself is unchanged, so the shorter start is most likely the driver registering 2 MiB pages instead of 4 KB ones. With the default cache the CPU pool has little to do on this box (~1 ms per window), so decode is within run-to-run noise there; where the CPU computes most misses the pool's time per expert drops ~4-5%.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/650 **Author:** [@anon761](https://github.com/anon761) **Created:** 10/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `linux-arena-thp` --- ### 📝 Commits (1) - [`12a89be`](https://github.com/Niko1221/Strata/commit/12a89be280e96e873fc6adddfce39c5873ca4e42) pinned: back the Linux expert arena with transparent huge pages ### 📊 Changes **1 file changed** (+20 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/core/pinned.cu` (+20 -2) </details> ### 📄 Description ## What Without a hugetlb pool (`vm.nr_hugepages=0`, the default on most distros) the Linux expert arena falls back to a plain anonymous mapping with 4 KB pages: ``` strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 36727 2 MiB pages, vm.nr_hugepages=0); using 4 KB pages ``` The CPU expert pool streams whole experts (3-4 MB each for the 4-5 bit GGUFs) out of that arena, so every expert walks ~750-1000 pages through the TLB, and pinning ~72 GiB with `cudaHostRegister` has to lock ~18.8 M pages. This maps the fallback 2 MiB-aligned and `madvise(MADV_HUGEPAGE)`s it, so THP in `madvise` mode (the common distro default) backs it. `STRATA_NO_LARGEPAGES=1` keeps 4 KB pages, as on the hugetlb path. The log note says which one the arena got: ``` strata generate: expert arena: cudaHostRegister PORTABLE ok; MAP_HUGETLB unavailable (needed 36727 2 MiB pages, vm.nr_hugepages=0); transparent huge pages requested (MADV_HUGEPAGE) ``` Linux only; the Windows path and the hugetlb path are unchanged. ## Measured 2x RTX 3090 (layer split auto), EPYC 7413 (24C, AVX2), Unsloth UD-Q4_K_XL (71.7 GiB of experts), 262K context, `--kv int8 --pcie-frac 0 --ple-io ram`, engine at current `main`, same binary flags otherwise. Before = `main`, after = this branch. | | before | after | | --- | ---: | ---: | | engine start until `/v1/models` says loaded (several starts each) | 65 s | 40-45 s | | expert load (`loaded 71.73 GiB at ...`) | 3.56 GiB/s | 3.59 GiB/s | | decode, default expert cache (2K / 8K prompt) | 92.8 / 93.1 tok/s | 93.2 / 88.2 tok/s | | decode, `--expert-cache 1200` (CPU computes most misses), 4 runs | 69.5 tok/s | 71.1 tok/s | | CPU pool per expert entry (`STRATA_DECODE_TIMING`, same run) | 1.31 ms | 1.25 ms | The read itself is unchanged, so the shorter start is most likely the driver registering 2 MiB pages instead of 4 KB ones. With the default cache the CPU pool has little to do on this box (~1 ms per window), so decode is within run-to-run noise there; where the CPU computes most misses the pool's time per expert drops ~4-5%. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2742
No description provided.