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
dynamo
Commits
defe5de7
Unverified
Commit
defe5de7
authored
Nov 04, 2025
by
Michael Feil
Committed by
GitHub
Nov 05, 2025
Browse files
feat: release gil for publisher (#3747)
Signed-off-by:
michaelfeil
<
me@michaelfeil.eu
>
parent
7cfac6b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
29 deletions
+41
-29
lib/bindings/python/rust/llm/kv.rs
lib/bindings/python/rust/llm/kv.rs
+41
-29
No files found.
lib/bindings/python/rust/llm/kv.rs
View file @
defe5de7
...
...
@@ -263,7 +263,7 @@ impl KvEventPublisher {
#[pyo3(signature
=
(event_id,
token_ids,
num_block_tokens,
block_hashes,
lora_id,
parent_hash=None))]
fn
publish_stored
(
&
mut
self
,
_
py
:
Python
,
py
:
Python
,
event_id
:
u64
,
token_ids
:
Vec
<
u32
>
,
num_block_tokens
:
Vec
<
u64
>
,
...
...
@@ -271,27 +271,38 @@ impl KvEventPublisher {
lora_id
:
u64
,
parent_hash
:
Option
<
i64
>
,
)
->
PyResult
<
()
>
{
let
kv_block_size
=
self
.kv_block_size
as
u32
;
let
dp_rank
=
self
.dp_rank
;
let
warning_count
=
self
.warning_count
.clone
();
let
inner
=
self
.inner
.clone
();
py
.allow_threads
(||
{
let
block_hashes_u64
:
Vec
<
u64
>
=
block_hashes
.iter
()
.map
(|
&
h
|
h
as
u64
)
.collect
();
let
event
=
KvCacheEvent
{
event_id
,
data
:
KvCacheEventData
::
Stored
(
KvCacheStoreData
{
parent_hash
:
parent_hash
.map
(
ExternalSequenceBlockHash
::
from
),
blocks
:
create_stored_blocks
(
self
.
kv_block_size
as
u32
,
kv_block_size
,
&
token_ids
,
&
num_block_tokens
,
&
block_hashes_u64
,
lora_id
,
&
self
.
warning_count
,
&
warning_count
,
),
}),
dp_rank
:
self
.
dp_rank
,
dp_rank
,
};
self
.inner
.publish
(
event
)
.map_err
(
to_pyerr
)
inner
.publish
(
event
)
.map_err
(
to_pyerr
)
})
}
fn
publish_removed
(
&
self
,
_
py
:
Python
,
event_id
:
u64
,
block_hashes
:
Vec
<
i64
>
)
->
PyResult
<
()
>
{
fn
publish_removed
(
&
self
,
py
:
Python
,
event_id
:
u64
,
block_hashes
:
Vec
<
i64
>
)
->
PyResult
<
()
>
{
let
dp_rank
=
self
.dp_rank
;
let
inner
=
self
.inner
.clone
();
py
.allow_threads
(||
{
let
block_hashes
:
Vec
<
ExternalSequenceBlockHash
>
=
block_hashes
.into_iter
()
.map
(
ExternalSequenceBlockHash
::
from
)
...
...
@@ -299,10 +310,11 @@ impl KvEventPublisher {
let
event
=
KvCacheEvent
{
event_id
,
data
:
KvCacheEventData
::
Removed
(
KvCacheRemoveData
{
block_hashes
}),
dp_rank
:
self
.
dp_rank
,
dp_rank
,
};
self
.inner
.publish
(
event
)
.map_err
(
to_pyerr
)
inner
.publish
(
event
)
.map_err
(
to_pyerr
)
})
}
}
...
...
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