Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
983056e4
Unverified
Commit
983056e4
authored
Sep 25, 2025
by
Nick Hill
Committed by
GitHub
Sep 26, 2025
Browse files
[Misc] Remove unnecessary memoryviews in shm_broadcast.py (#25721)
Signed-off-by:
Nick Hill
<
nhill@redhat.com
>
parent
13dd93c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
vllm/distributed/device_communicators/shm_broadcast.py
vllm/distributed/device_communicators/shm_broadcast.py
+4
-4
No files found.
vllm/distributed/device_communicators/shm_broadcast.py
View file @
983056e4
...
@@ -136,8 +136,8 @@ class ShmRingBuffer:
...
@@ -136,8 +136,8 @@ class ShmRingBuffer:
self
.
shared_memory
=
shared_memory
.
SharedMemory
(
self
.
shared_memory
=
shared_memory
.
SharedMemory
(
create
=
True
,
size
=
self
.
total_bytes_of_buffer
)
create
=
True
,
size
=
self
.
total_bytes_of_buffer
)
# initialize the metadata section to 0
# initialize the metadata section to 0
with
memoryview
(
self
.
shared_memory
.
buf
[
self
.
metadata_offset
:]
with
self
.
shared_memory
.
buf
[
self
.
)
as
metadata_buffer
:
metadata_offset
:]
as
metadata_buffer
:
torch
.
frombuffer
(
metadata_buffer
,
dtype
=
torch
.
uint8
).
fill_
(
0
)
torch
.
frombuffer
(
metadata_buffer
,
dtype
=
torch
.
uint8
).
fill_
(
0
)
else
:
else
:
# we are opening an existing buffer
# we are opening an existing buffer
...
@@ -182,14 +182,14 @@ class ShmRingBuffer:
...
@@ -182,14 +182,14 @@ class ShmRingBuffer:
def
get_data
(
self
,
current_idx
:
int
):
def
get_data
(
self
,
current_idx
:
int
):
start
=
self
.
data_offset
+
current_idx
*
self
.
max_chunk_bytes
start
=
self
.
data_offset
+
current_idx
*
self
.
max_chunk_bytes
end
=
start
+
self
.
max_chunk_bytes
end
=
start
+
self
.
max_chunk_bytes
with
memoryview
(
self
.
shared_memory
.
buf
[
start
:
end
]
)
as
buf
:
with
self
.
shared_memory
.
buf
[
start
:
end
]
as
buf
:
yield
buf
yield
buf
@
contextmanager
@
contextmanager
def
get_metadata
(
self
,
current_idx
:
int
):
def
get_metadata
(
self
,
current_idx
:
int
):
start
=
self
.
metadata_offset
+
current_idx
*
self
.
metadata_size
start
=
self
.
metadata_offset
+
current_idx
*
self
.
metadata_size
end
=
start
+
self
.
metadata_size
end
=
start
+
self
.
metadata_size
with
memoryview
(
self
.
shared_memory
.
buf
[
start
:
end
]
)
as
buf
:
with
self
.
shared_memory
.
buf
[
start
:
end
]
as
buf
:
yield
buf
yield
buf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment