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 14, 05:30 UTC
[Misc] Remove unnecessary memoryviews in shm_broadcast.py (#25721)
Signed-off-by: Nick Hill <nhill@redhat.com>
Nick Hill committed
Sep 25, 2025 at 20:11 UTC
983056e456a418662601f2f4414a27b2c576bf67
1 file changed
+4
-4
vllm/distributed/device_communicators/shm_broadcast.py
+4
-4
@@ -136,8 +136,8 @@ class ShmRingBuffer:
136
self.shared_memory = shared_memory.SharedMemory(
137
create=True, size=self.total_bytes_of_buffer)
138
# initialize the metadata section to 0
139
- with memoryview(self.shared_memory.buf[self.metadata_offset:]
140
- ) as metadata_buffer:
139
+ with self.shared_memory.buf[self.
140
+ metadata_offset:] as metadata_buffer:
141
torch.frombuffer(metadata_buffer, dtype=torch.uint8).fill_(0)
142
else:
143
# we are opening an existing buffer
@@ -182,14 +182,14 @@ class ShmRingBuffer:
182
def get_data(self, current_idx: int):
183
start = self.data_offset + current_idx * self.max_chunk_bytes
184
end = start + self.max_chunk_bytes
185
- with memoryview(self.shared_memory.buf[start:end]) as buf:
185
+ with self.shared_memory.buf[start:end] as buf:
186
yield buf
187
188
@contextmanager
189
def get_metadata(self, current_idx: int):
190
start = self.metadata_offset + current_idx * self.metadata_size
191
end = start + self.metadata_size
192
- with memoryview(self.shared_memory.buf[start:end]) as buf:
192
+ with self.shared_memory.buf[start:end] as buf:
193
yield buf
194
195