Skip to content

umbp: hugepage-backed ranged scratch arenas - #830

Merged
TianDi101 merged 3 commits into
mainfrom
fix/umbp-ranged-scratch-hugepages
Oct 23, 2026
Merged

TianDi101 merged 3 commits into
mainfrom
fix/umbp-ranged-scratch-hugepages

Conversation

@TianDi101

@TianDi101 TianDi101 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Each ranged scratch arena (GET and PUT, ranged_scratch_size each) is one host buffer registered as one RDMA memory region, on plain 4 KiB anonymous pages. A region's translation entries are its pages, and NICs cap entries per region, so a large 4 KiB-page arena can be more than the NIC takes.

We hit this on AINIC raising UMBP_DISTRIBUTED_RANGED_SCRATCH_BYTES to 4 GiB / 32 shards (and 8 GiB / 32 on another node pair) to cut ranged-GET shard wait, which was 24% of ranged GET time on a cross-node DSv4 run.

Change

  • ranged_scratch_use_hugepages / ranged_scratch_hugepage_size: back both scratch arenas with hugetlb pages, which on 2 MiB pages means 512x fewer entries per region. Falls back to 4 KiB pages when no hugetlb pages are free, as the SSD staging arena does.
  • Standalone server env UMBP_DISTRIBUTED_RANGED_SCRATCH_USE_HUGEPAGES and UMBP_DISTRIBUTED_RANGED_SCRATCH_HUGEPAGE_SIZE; pybind fields of the same names; runtime-env-vars.md rows.
  • The fallback is silent, so a startup INFO line reports what was actually mapped: [DistributedClient] ranged scratch: 2 arenas x 4096 MiB, 2048 KiB pages (hugetlb).

No size limit is hardcoded. A NIC's per-region limit changes with firmware and driver, so a region the NIC cannot take fails at registration (with #821, as an error instead of a segfault). An earlier revision of this PR added a max_mr_pages startup check for the scratch and SSD staging arenas; it was removed for that reason.

Defaults are unchanged: hugepages are off, and CI's 512 MiB scratch arenas behave as before.

Testing

  • test_umbp_pool_client_ranges at 6db3c20 on an MI355X + AINIC node (gfx950): 30/30 pass, including DistributedScratchHugepageRequestFallsBack. That test requests an unusable hugepage size; the arena falls back to 4 KiB pages and the client still starts.
  • Full UMBP ctest (-LE integration) at 6db3c20: 47/47 pass.
  • Original failure reproduced before the fix: 4 GiB and 8 GiB arenas with 32 shards on 4 KiB pages crash the standalone server on the first remote put, on two node pairs.
  • E2E with 4 GiB / 32 shards on 2 MiB hugepages (cross-node DSv4 agentic run, standalone servers on both nodes, AINIC): both servers logged ranged scratch: 2 arenas x 4096 MiB, 2048 KiB pages (hugetlb). They ran 15 min of warmup plus 40 min of profiling (14.1 TiB of ranged GETs) with 0 transfer, CQE or registration errors. The same 4 GiB / 32 config on 4 KiB pages crashed on the first remote put.

🤖 Generated with Claude Code

TianDi101 and others added 2 commits October 22, 2026 09:30
…page limit

Each ranged scratch arena (GET and PUT) is plain 4 KiB anonymous memory
registered as ONE RDMA memory region. On AINIC (ionic) that caps its size:

- above 2^19 entries (2 GiB at 4 KiB pages) ibv_reg_mr fails with ENOMEM,
  mori falls back to dmabuf export, and hipMemRetainAllocationHandle
  segfaults on the host pointer. With registration lazy, the standalone
  server dies on its first remote put.
- between 2^18 and 2^19 entries (1-2 GiB) the region registers, but the NIC
  translates only the first 2^18 entries: RDMA past 1 GiB silently lands
  1 GiB lower.

So today the arena cannot safely exceed 1 GiB, which is what limited
scaling the ranged GET shard count.

- ranged_scratch_use_hugepages / ranged_scratch_hugepage_size back both
  arenas with hugetlb pages (2 MiB: one region translates up to 512 GiB),
  falling back to 4 KiB pages like the SSD staging arena does.
- ranged_scratch_max_mr_pages (default 2^18; 0 disables) rejects an arena
  that spans more pages than that at startup, measured on the pages
  actually mapped so a hugepage request that fell back is caught too.
- Standalone server env: UMBP_DISTRIBUTED_RANGED_SCRATCH_USE_HUGEPAGES,
  _HUGEPAGE_SIZE, _MAX_MR_PAGES; pybind fields of the same names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The staging arena is one buffer registered as one RDMA region, default
4 GiB, and staging hugepages silently fall back to 4 KiB pages. With an
RDMA engine that region is over ionic's 2^19 entries and the first remote
access segfaults in the dmabuf fallback, like the ranged scratch arenas.

- Rename ranged_scratch_max_mr_pages -> max_mr_pages
  (UMBP_DISTRIBUTED_MAX_MR_PAGES): one limit for every NIC region.
- SsdBackend::Init rejects a staging arena over max_mr_pages, measured on
  the pages actually mapped; PoolClient passes the limit only when
  io_engine.host builds an RDMA engine.
- test_ssd_backend: InitRejectsAStagingArenaOverMaxMrPages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101 TianDi101 changed the title umbp: hugepage-backed ranged scratch + reject arenas over the NIC MR page limit umbp: hugepage-backed ranged scratch + reject scratch/SSD-staging arenas over the NIC MR page limit Oct 22, 2026
@TianDi101

Copy link
Copy Markdown
Collaborator Author

E2E on AINIC: 4 GiB / 32-shard ranged scratch on 2 MiB hugepages ran 15 min of warmup plus 40 min of profiling (14.1 TiB of ranged GETs) on a cross-node DSv4 run, with 0 transfer, CQE or registration errors. The same config on 4 KiB pages segfaulted on the first remote put. Throughput matched the 512 MiB / 8 baseline within noise (251.7k vs 249.9k input tok/s over the same 40 min).

A NIC's per-region translation limit changes with firmware and driver, so
UMBP should not encode one. Remove max_mr_pages
(UMBP_DISTRIBUTED_MAX_MR_PAGES) and its startup checks on the ranged
scratch and SSD staging arenas. Keep hugepage-backed ranged scratch and
the startup line that shows which page size was actually mapped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101 TianDi101 changed the title umbp: hugepage-backed ranged scratch + reject scratch/SSD-staging arenas over the NIC MR page limit umbp: hugepage-backed ranged scratch arenas Oct 22, 2026
@TianDi101
TianDi101 merged commit 3711c92 into main Oct 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant