Repository navigation
fix(umbp): keep the standalone server serving when its GPU-registered DRAM pool is migrated - #756
Merged
Merged
Conversation
Every write handler took client_mu_ exclusively and held it through the backend call, GPU copies included. A write that stalled -- for instance while the KFD driver re-validated the GPU-registered host pool after kernel compaction migrated one of its pages -- therefore blocked BatchExists for every rank, and sglang's scheduler waits on that lookup. A distributed backend on a non-SSD medium already synchronizes puts, gets and lookups itself (DistributedClient's op_mutex_, PageBackend's own lock), since an embedded client drives it from several threads. For it client_mu_ only has to be the lifetime barrier for resolved client mappings: writes now take it shared, and lookups, which dereference no client memory, do not take it at all. Registration, deregistration, Clear, Flush and shutdown still take it exclusively, and every other backend keeps its old locking.
The KFD driver does not pin memory registered with hipHostRegister. When the kernel migrates any page of a registration -- compaction does this continuously on a host with fragmented free memory -- the driver stops the process's queues on every GPU and re-validates the whole registration. For a terabyte DRAM pool on 4 KiB pages one attempt takes minutes, and a migration during the attempt restarts it, so the standalone server can get no GPU work done for a quarter of an hour. Register gather regions in UMBP_DRAM_HOST_REGISTER_CHUNK_MB pieces instead (default 1024; 0 keeps whole-region registration), so a migration re-validates one piece. Pieces are cut at absolute multiples of the piece size and registered in address order on a background thread; a piece is usable as soon as it is registered. HbmCopyEngine::Plan splits host-side ranges at the same boundaries, because hipMemcpy rejects a range spanning two registrations and a gather fragment can use only one piece's device alias. This is the fallback for pools that are not on hugetlbfs pages, which compaction never migrates.
…costs When UMBP_DRAM_USE_HUGEPAGES=1 cannot get enough hugetlbfs pages, the pool falls back to anonymous 4 KiB pages with a one-line warning. For a GPU-registered pool that quietly brings back what reserving hugepages was for: kernel compaction migrates the pages, and every migration stops the process's GPU queues until the driver re-validates the registration. Keep the fallback, but log it as an error with the number of pages asked for and how to avoid it.
isytwu
marked this pull request as ready for review
October 13, 2026 03:11
This was referenced Oct 13, 2026
Merged
This was referenced Nov 23, 2026
Draft
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.
Problem
On MI355X nodes with fragmented host memory, the UMBP standalone process stalled sglang for up to ~15 minutes at the start of a benchmark (no request returned;
BatchExiststook 900+ s on every rank), and GPU IPC registration took 90-150 s per buffer.Root cause
hipHostRegister. KFD does not pin userptr registrations; it mirrors them (HMM).vm.compaction_proactiveness=20) migrates pages of the pool. Every migration firesamdgpu_amdkfd_evict_userptr, which quiesces all of the process's queues on every GPU; the restore worker then re-validates the entire registration (130-150 s per attempt on the affected node), and a migration during the attempt reschedules it.BatchPutRangesnever finish; the write holdsclient_mu_exclusively, so every rank'sBatchExistsblocks, and the sglang scheduler waits on it. KFD ioctls, IPC import included, also wait for the restore.evict_userptrcalls came fromkcompactd -> proactive_compact_node -> ... -> try_to_migrate_one; the eviction windows of the standalone process line up with the stalls, and IPC registrations completed only when a restore attempt ended.Changes
standalone_server.cpp). For a distributed backend on a non-SSD medium, which already synchronizes itself, writes takeclient_mu_shared and lookups take no lock. Registration, deregistration, Clear, Flush and shutdown stay exclusive; other backends are unchanged. A stalled write no longer blocks lookups.HostTierRegistration,HbmCopyEngine::Plan). Gather regions are registered inUMBP_DRAM_HOST_REGISTER_CHUNK_MBpieces (default 1024; 0 keeps whole-region registration), so a migration re-validates one piece; the planner splits host-side ranges at piece boundaries. This is the fallback for pools that are not on hugetlbfs pages.UMBP_DRAM_USE_HUGEPAGES=1cannot get enough hugetlbfs pages, the fallback to 4 KiB pages is logged as an error with the page count and its consequence, instead of a one-line warning.Not included on purpose: transparent hugepages for the pool (tried in #679, reverted in #687; coverage varied from 4% to 100% across our runs).
Recommended deployment
UMBP_DRAM_USE_HUGEPAGES=1. Compaction never moves hugetlb pages, and GPU registration of the pool takes ~5 s instead of minutes.HSA_USERPTR_FOR_PAGED_MEM=0for the standalone process only, so HIP/ROCr's own small host allocations are GTT BOs rather than userptr; with it the standalone process saw no queue eviction at all.Testing
CI on this PR passed: builds (MI355X_AINIC, MI300X_MLX),
mori umbp unit test (MI355X_AINIC), pre-commit, intranode/internode tests.mori umbp single-node hicache smoke testwas skipped while the PR is a draft.Hardware validation of these three commits (applied to
066fd10e; the six files they touch are identical on main), MI355X x8, Kimi-K3, sglang DCP8 conc=48, UMBP standalone process with a 1160 GiB DRAM pool:UMBP_DRAM_USE_HUGEPAGES=1and no pages reservedBatchExists<= 0.03 s throughout; 71.8k input tok/s, 94.8% prefix hit, 0 errors. The standalone process still had its GPU queues evicted (up to 60 s at a time during the benchmark), and writes slowed to tens of seconds in the first minute of the benchmark: degraded, but sglang keeps servingHSA_USERPTR_FOR_PAGED_MEM=0on the standalone process (recommended)BatchExists<= 0.04 s; 70.5k input tok/s, 94.5% prefix hit, 0 errorsUnit tests in a container on the same node, with memlock unlimited, the docker default, and 2 MiB pieces (
UMBP_DRAM_HOST_REGISTER_CHUNK_MB=2):test_hbm_backend12/12 including the newNeverPlansASegmentAcrossAHostRegistrationPiece,test_standalone_shm_ipc11 passed and 1 skipped,test_page_backendandtest_umbp_host_mem_allocatorpassed; thepool_client_ranges/batch_putfailures are the pre-existing remote-path ones (no RDMA in the container), identical to stock.Reference, stock mori on the same line: zero-return phase 931 s,
BatchExistsmax 919.7 s, standalone process queues evicted for up to 931 s at a time. Earlier images carrying the same lock and chunking code, on hugetlb: 5/5 DCP8 rounds warmed up in 2140-2304 s, and the DCP8 3600 s regression passed all six checks (73.3k input tok/s, 95.2% prefix hit; stock 72.4k-74.0k, 95.0-95.2%).Related, not addressed here
On AINIC (ionic),
ibv_reg_mrof host memory is limited to ~2 GiB per MR and ~3 GiB per device with 4 KiB pages, and to ~1 TiB per MR with 2 MiB pages. mori-io registers a whole buffer as one MR on the first cross-node session and aborts if that fails, so a 1.1 TiB pool would abort; multi-node deployments need hugetlb plus chunked MR registration (or 1 GiB pages, or smaller buffers).