mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4514] [Engine] HIP/Linux: split serving on 2× MI50 does not start; two engines on one shared arena run out of the amdgpu memory budget #2029
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2029
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MarcoTool on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4514
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
In short: split serving from #4000 does not start on two AMD cards when the PC has less than about twice the experts' size in RAM. The second engine runs out of a memory budget that the AMD driver keeps for the whole machine. A larger
STRATA_PIN_RESERVE_MIBworks around it; the workaround is at the end.What I saw. I ran split serving on its supported case: two MI50s, the prompt read on card 0, the answer made on card 1, one shared expert arena in
/dev/shm. The prefill engine starts. The decode engine does not become ready, and the kernel log fills withamdgpu: SVM mapping failed, exceeds resident system memory limit."engine_ready_s": 3600prefill: copy streamwith no error lineSTRATA_PIN_RESERVE_MIB=4096verify: copy stream create failed(verify.cpp:1130)STRATA_PIN_RESERVE_MIB=12288What I think is happening. Host memory registered for an AMD GPU is charged to one counter for the whole machine (
amdgpu_amdkfd_gpuvm.c:56-63), limited to RAM × 63/64 − 1.5 GiB (:126-130), 91.3 GiB here. The count follows the process that registers the memory, not the pages, so the arena that is one copy in RAM is counted once per engine. Registering does not take more RAM: it reserves the pages for the GPU and adds them to the driver's count. RAM holds one copy of the arena; the count holds two, and it is the count that reaches the limit. I logged each engine's driver calls with a smallLD_PRELOADshim:Two things in the engine turn this into a failure:
The second engine registers until the driver refuses. When the whole arena is refused,
pinned.cu:463-469registers it slice by slice until a slice fails, which leaves no room for any HIP process. Whichever engine allocates next fails. With problem 2 fixed and no reserve, the decode engine started, and the prefill engine failed on the first request with an error that points elsewhere:verify router: bf16_gemv_fp32_mmvf_multi launch: invalid device function. Windows has a limit for this case (#243,pinned.cu:361-390); Linux does not.The gfx906 build is charged again for every expert it copies from the part it did not register. The HIP build copies through a small staging buffer to avoid this (
expert_cache.cpp:801-811), but only underSTRATA_USE_HIP, which the gfx906 build does not define (expert_cache.cpp:5-6). The copies then register arena pages that stay charged: 4.51 GiB in 4,308 copies here. Adding|| defined(STRATA_HIP_GFX906)to the six guards of that buffer (expert_cache.hpp:247;expert_cache.cpp538, 632, 670, 688, 801) took those charges to 0.Why NVIDIA is not affected. The budget belongs to the amdgpu driver, so only memory registered for AMD cards counts against it; the NVIDIA driver on Linux has no such budget (
pin_budget.hpp:16-18). The same PC shows this: with the prefill engine on an RTX 3070 and the decode engine on the two MI50s, both engines registered the whole arena, 94 GiB in all and above the 91.3 GiB limit, and both started, because only the decode engine's 47 GiB was counted.Measured charges per engine (stock 0.2.7)
From the driver calls (
ALLOC_MEMORY_OF_GPU,FREE_MEMORY_OF_GPU,SVM), overlapping ranges merged. The shim does not see every release bymunmap, so sums are upper bounds.Call stack of one copy's registration (Strata frames resolved with
addr2line):Smallest steps or command that reproduce it
"split_serve": {"prefill_gpu": 0, "decode_gpu": 1}and--shared-expert-arena /dev/shm/<file>.python serve/server.py --config <it>: the decode engine does not become ready, andjournalctl -kshowsSVM mapping failed, exceeds resident system memory limit.Reproduction status
Reproduced locally
Strata version
Strata 0.2.7 · engine 0.1.52, built from source at v0.2.7 (
5e8a4cca) with the one-line gfx906 build fix of #3986 (0.2.7 does not compile for gfx906 without it)Graphics card, memory and system
2× AMD Instinct MI50 32 GB (gfx906) · 94 GiB RAM (Threadripper 1920X) · Ubuntu 22.04, kernel 6.8.0-138, amdgpu DKMS 6.10.5, ROCm 7.14
Model, size and settings
Qwen3.8-Flash-Next IQ3_S · 256K context,
--kv int8,--kv-resident 262144· MTP on · pictures off · split serving, shared arena in/dev/shmLogs
Decode engine, stock build, STRATA_PIN_RESERVE_MIB=4096
Workaround
Set a headroom reserve for both engines, in the run config's
envor the environment:STRATA_PIN_RESERVE_MIB=12288on stock 0.2.7, or4096with the staging guards above. These are values that worked here, not tuned ones.If you need a gfx906 build of 0.2.7 with the staging fix, it is in my fork: PDHyperMix-Strata-MI50
v0.2.7-pdhm-fix-v0.0, with the Strata branch, build steps and the measuring tools.Runs that work, 16K prompt with no cache and 256 answer tokens, one run each:
Direction
The two problems are fixed separately.
Problem 1: two HIP engines on one arena. Leave room when registering: on Linux/HIP, stop registering the arena some way below the point where the driver refuses, as Windows already does (#243). The next allocation of either engine then still fits.
Problem 2: the gfx906 build counts copies. Compile the staging buffer into the gfx906 build, the commit in my fork above. It changes only the build guards.
I will follow up to check that the cause of each is what I describe above, and report back here.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.