A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 8, 14:13 UTC
[Bugfix] Fix memory inconsistency in cross-process shared memory (#32022)
Signed-off-by: Zetong Li <slippersss@126.com>
Zetong Li committed
Feb 10, 2026 at 16:22 UTC
5f970120f06daab162b8692cfce39b0f366b9b47
1 file changed
+6
vllm/distributed/device_communicators/shm_broadcast.py
+6
@@ -488,6 +488,12 @@ class MessageQueue:
488
for i in range(1, self.buffer.n_reader + 1):
489
# set read flag to 0, meaning it is not read yet
490
metadata_buffer[i] = 0
491
+ # Memory fence here ensures the order of the buffer and flag
492
+ # writes. This guarantees that when `metadata_buffer[0] = 1` is
493
+ # visible to readers, `buf` can be completely ready. Without
494
+ # this, some CPU architectures with weak ordering may incur
495
+ # memory inconsistency.
496
+ memory_fence()
497
# mark the block as written
498
metadata_buffer[0] = 1
499
# Memory fence ensures the write is visible to readers on other cores