[PR #129] [CLOSED] core: add optional shared expert arena backing #2472

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/129
Author: @rhgo1749
Created: 9/29/2026
Status: ❌ Closed

Base: main ← Head: upstream/shared-arena-backing


📝 Commits (2)

  • 11b26fa core: add guarded shared expert arena backing
  • 58542b5 docs: limit shared arena backing to dev shm

📊 Changes

7 files changed (+330 additions, -10 deletions)

View changed files

📝 CMakeLists.txt (+6 -0)
📝 include/strata/core/expert_source.hpp (+1 -1)
📝 include/strata/core/pinned.hpp (+8 -1)
📝 src/core/expert_source.cpp (+117 -3)
📝 src/core/pinned.cu (+126 -4)
➕ src/core/pinned_shared_test.cpp (+61 -0)
📝 src/program/generate.cpp (+11 -1)

📄 Description

Follow-up to #127, limited to the shared-arena piece you invited as a PR.

What this changes

  • Adds an optional --shared-expert-arena FILE backing for the resident expert arena.
  • On Linux, PinnedArena uses a MAP_SHARED file with a 4 KiB header when that option is set.
  • The header records the arena size and a pack fingerprint; an existing backing from a different pack is refused before it can be used.
  • The existing anonymous/hugetlb allocation path is unchanged when the option is absent.
  • Existing CUDA host registration, sliced registration fallback, resident locking, expert loading, hot cache, and numerical paths are unchanged.
  • The CLI notes that the backing belongs on /dev/shm, not ordinary SSD storage.

The fork used an mmap interception wrapper to prove the idea. This version makes the backing explicit in PinnedArena/ArenaExpertSource instead, so unrelated mappings are not affected.

Validation

  • Rebased onto exact v0.1.26 (ac8b251).
  • pinned_shared_test: same-pack mappings observe the same bytes; different-pack and size mismatches are refused.
  • Full strata CUDA build passes locally with CUDA 13.4 / sm_120.
  • --mmap-experts + --shared-expert-arena is rejected with exit 2.
  • Real 3 x RTX 5070 Ti / IQ3_S / 262144-context-per-lane validation passed: all three processes mapped the same shared backing and three concurrent generation requests completed successfully.
  • The broader multi-process/multi-GPU serving measurements and architecture motivation are in #127.

Deliberate non-goals

  • No request router or multi-GPU supervisor in this PR.
  • No leader/follower population protocol yet; callers still coordinate startup/population.
  • The backing path must be dedicated to one compatible expert arena; callers also own its lifetime and cleanup.
  • Linux MAP_SHARED only for now. A Windows named-file-mapping backend can implement the same backing contract separately.

This is intended to be the smallest upstreamable primitive needed for the request-per-GPU design from #127.


🔄 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/129 **Author:** [@rhgo1749](https://github.com/rhgo1749) **Created:** 9/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `upstream/shared-arena-backing` --- ### 📝 Commits (2) - [`11b26fa`](https://github.com/Niko1221/Strata/commit/11b26fac912a907c09977adda4be6789d75bc3ea) core: add guarded shared expert arena backing - [`58542b5`](https://github.com/Niko1221/Strata/commit/58542b59d83a01af79a8e43c7eafca114ed88c3d) docs: limit shared arena backing to dev shm ### 📊 Changes **7 files changed** (+330 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+6 -0) 📝 `include/strata/core/expert_source.hpp` (+1 -1) 📝 `include/strata/core/pinned.hpp` (+8 -1) 📝 `src/core/expert_source.cpp` (+117 -3) 📝 `src/core/pinned.cu` (+126 -4) ➕ `src/core/pinned_shared_test.cpp` (+61 -0) 📝 `src/program/generate.cpp` (+11 -1) </details> ### 📄 Description Follow-up to #127, limited to the shared-arena piece you invited as a PR. ## What this changes - Adds an optional `--shared-expert-arena FILE` backing for the resident expert arena. - On Linux, `PinnedArena` uses a MAP_SHARED file with a 4 KiB header when that option is set. - The header records the arena size and a pack fingerprint; an existing backing from a different pack is refused before it can be used. - The existing anonymous/hugetlb allocation path is unchanged when the option is absent. - Existing CUDA host registration, sliced registration fallback, resident locking, expert loading, hot cache, and numerical paths are unchanged. - The CLI notes that the backing belongs on `/dev/shm`, not ordinary SSD storage. The fork used an mmap interception wrapper to prove the idea. This version makes the backing explicit in `PinnedArena`/`ArenaExpertSource` instead, so unrelated mappings are not affected. ## Validation - Rebased onto exact `v0.1.26` (`ac8b251`). - `pinned_shared_test`: same-pack mappings observe the same bytes; different-pack and size mismatches are refused. - Full `strata` CUDA build passes locally with CUDA 13.4 / sm_120. - `--mmap-experts` + `--shared-expert-arena` is rejected with exit 2. - Real 3 x RTX 5070 Ti / IQ3_S / 262144-context-per-lane validation passed: all three processes mapped the same shared backing and three concurrent generation requests completed successfully. - The broader multi-process/multi-GPU serving measurements and architecture motivation are in #127. ## Deliberate non-goals - No request router or multi-GPU supervisor in this PR. - No leader/follower population protocol yet; callers still coordinate startup/population. - The backing path must be dedicated to one compatible expert arena; callers also own its lifetime and cleanup. - Linux MAP_SHARED only for now. A Windows named-file-mapping backend can implement the same backing contract separately. This is intended to be the smallest upstreamable primitive needed for the request-per-GPU design from #127. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:00:28 +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#2472
No description provided.