ROCm#
Host event wait#
In multiprocess mode with LMCache-driven transfer, the LMCache server makes its transfer stream wait on an event recorded by the serving engine before it copies KV cache. On AMD Instinct MI3xx this pending wait can slow the engine’s kernels: the hardware queues of the two processes may share a compute pipe of the GPU’s command processor. The symptom is lower output throughput and higher inter-token latency with LMCache than without it, on a workload whose cache hits should make it faster.
If you see this, enable the host event wait for the LMCache server process only:
LMCACHE_ROCM_HOST_EVENT_WAIT=1 lmcache server ...
The server then waits for the engine’s event on the host and queues its copies
only once the event has completed, so no wait is pending on the GPU. The
variable accepts 1, true, yes or on, is off by default, and has
no effect on other platforms.
The wait blocks the server thread that handles the request. Connections that share a thread wait for each other’s events, and
--max-gpu-workersdefaults to 1. We recommend--max-gpu-workersequal to the number of engine worker processes connected to the server, so that each connection waits only for its own events. In the one case we measured, one engine with tensor-parallel size 8, a single thread performed the same as eight. Data-parallel deployments and several engines sharing one server were not measured.Do not set the variable for the serving engine. Its stream waits would block the engine’s host thread. An engine started from the same shell or container as the server inherits the server’s environment, so set the variable inline on the
lmcache servercommand as shown above. Do notexportit, and do not set it for a whole container that also runs the engine.With
--isolated-ipcthe variable is ignored and a warning is logged.An event still pending after 10 seconds falls back to the wait on the GPU, with a warning in the server log.
Limitation on ROCm releases before 7.14. There the wait on the GPU is a kernel that holds a compute unit. After the fallback above, an engine kernel that needs every compute unit still cannot run. From ROCm 7.14 on the wait is a barrier in the GPU’s command processor instead of a kernel, so the fallback does not block such a kernel.