Resolving GPU time-slicing issues
Credits to Scicom (MSC) Berhad and Scicom AI Enterprise for the resources.
It started as a way to save a card: we put our speech-to-text (STT) engine and a small LLM on the same GPU. HAMi capped each one's memory, both loaded fine, and then STT fell over. Its response time went from a fraction of a second to about 28× slower. Memory was split, but compute wasn't, so the CUDA driver time-sliced the two contexts and each engine spent most of its time waiting for the other.
Our model swap hits the same thing for a while: the serving model sits next to the new one while it loads.
We've run like that before. Medians barely moved, but at every handover the slowest requests took up to 14× longer than normal:
So the question: if two engines have to share SMs, does MPS make it cheap?
Time-slicing vs MPS vs MIG
- Time-slicing (default): one CUDA context runs at a time. Kernels from two processes never overlap.
- MPS: both engines submit through one server context, so their kernels run at the same time. No memory, bandwidth or fault isolation.
- MIG: hard partitions. Needs a host-level change, so we didn't test it.
Two things in NVIDIA's docs that matter here. A percentage cap doesn't reserve SMs, it only limits them:
And MPS gives you no bandwidth QoS and no error isolation:
How we tested
- 8 GPUs, k3s, HAMi. No reboot, no host change.
- One Job per pair: start
nvidia-cuda-mps-control -dinside the pod, then both vLLM engines as its clients, then a closed-loop load generator. - Three modes on the same cards: plain (time-slicing), MPS, and MPS with
CUDA_MPS_ACTIVE_THREAD_PERCENTAGE=50per engine. - Pairs: two Whisper engines and two LLM engines, each TP4, both engines spread over the same 4 GPUs. 8 requests in flight per engine. Each mode ran once.
- Every number below is relative to one engine running alone on those cards.
Results
| Whisper pair, both busy | Plain | MPS | MPS, 50% cap |
|---|---|---|---|
| TTFT p50 | +628% | −2% | −5% |
| e2e p50 | +803% | +7% | +2% |
| Throughput, both engines | −77% | +94% | +102% |
Time-sliced, two engines together serve 77% less than one engine alone. Under MPS they serve about twice as much at roughly the same latency: +778% throughput over time-slicing.
| LLM pair, both busy | Plain | MPS | MPS, 50% cap |
|---|---|---|---|
| TTFT p50 | +1,211% | deadlock | +4% |
| ITL p50 | +4,300% | deadlock | +47% |
| e2e p50 | +3,861% | deadlock | +49% |
| Output tok/s, both engines | −93% | 0 | +38% |
Capped MPS gives the LLM pair 20× the output of time-slicing, with 97% lower ITL. The cost: MPS takes 7-13% off one LLM engine's throughput when it runs alone. On a single card (TP1) the gap is smaller: time-slicing adds 114-131% to ITL and MPS keeps it to +34%. TP4 suffers more because every step ends in an all-reduce across 4 cards that each time-slice on their own (our reading, not traced).
The deadlock
Uncapped, both LLM engines stopped producing tokens and vLLM's execute timeout killed both. The MPS log showed no GPU fault. Likely cause: one engine's all-reduce kernels spin on the SMs waiting for their peers, MPS doesn't preempt between clients, so the other engine never runs. With a 50% cap: 0% failed.
Takeaways
- Two TP engines on the same cards: use MPS. +778% throughput for the Whisper pair, 20× output for the LLM pair.
- Cap every client. Uncapped TP pairs can deadlock.
- One fault kills every client on the card.
- HAMi 2.9 has no MPS support. Here each pair ran in one pod with its own daemon; separate pods need a shared per-node daemon.