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
3216003c
Unverified
Commit
3216003c
authored
Jun 06, 2025
by
Olga Andreeva
Committed by
GitHub
Jun 06, 2025
Browse files
feat: KVBM dynamo runtime + event manger (#1195)
parent
d95baeed
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
905 additions
and
1 deletion
+905
-1
lib/llm/src/block_manager.rs
lib/llm/src/block_manager.rs
+1
-1
lib/llm/src/block_manager/config.rs
lib/llm/src/block_manager/config.rs
+5
-0
lib/llm/src/block_manager/state.rs
lib/llm/src/block_manager/state.rs
+11
-0
lib/llm/tests/block_manager.rs
lib/llm/tests/block_manager.rs
+888
-0
No files found.
lib/llm/src/block_manager.rs
View file @
3216003c
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
//! mechanisms. It handles storage allocation, block management, and safe access
//! mechanisms. It handles storage allocation, block management, and safe access
//! patterns for both system memory and remote (NIXL) storage.
//! patterns for both system memory and remote (NIXL) storage.
mod
config
;
pub
mod
config
;
mod
state
;
mod
state
;
pub
mod
block
;
pub
mod
block
;
...
...
lib/llm/src/block_manager/config.rs
View file @
3216003c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
use
super
::
events
::
EventManager
;
use
super
::
*
;
use
super
::
*
;
#[derive(Debug,
Clone)]
#[derive(Debug,
Clone)]
...
@@ -173,6 +174,10 @@ pub struct KvBlockManagerConfig {
...
@@ -173,6 +174,10 @@ pub struct KvBlockManagerConfig {
// Specific configuration for the disk layout
// Specific configuration for the disk layout
#[builder(default,
setter(strip_option))]
#[builder(default,
setter(strip_option))]
pub
disk_layout
:
Option
<
KvManagerLayoutConfig
<
DiskStorage
>>
,
pub
disk_layout
:
Option
<
KvManagerLayoutConfig
<
DiskStorage
>>
,
/// Event manager to handle block related events
#[builder(default)]
pub
event_manager
:
Option
<
Arc
<
dyn
EventManager
>>
,
}
}
impl
KvBlockManagerConfig
{
impl
KvBlockManagerConfig
{
...
...
lib/llm/src/block_manager/state.rs
View file @
3216003c
...
@@ -19,6 +19,7 @@ use super::offload::OffloadManager;
...
@@ -19,6 +19,7 @@ use super::offload::OffloadManager;
use
super
::{
use
super
::{
block
::{
Block
,
GlobalRegistry
,
ImmutableBlock
},
block
::{
Block
,
GlobalRegistry
,
ImmutableBlock
},
config
::
NixlOptions
,
config
::
NixlOptions
,
events
::{
EventManager
,
NullEventManager
},
};
};
use
cudarc
::
driver
::
CudaStream
;
use
cudarc
::
driver
::
CudaStream
;
use
std
::
sync
::
Arc
;
use
std
::
sync
::
Arc
;
...
@@ -77,6 +78,10 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
...
@@ -77,6 +78,10 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
let
mut
nixl_backends
:
HashMap
<
String
,
Arc
<
nixl_sys
::
Backend
>>
=
HashMap
::
new
();
let
mut
nixl_backends
:
HashMap
<
String
,
Arc
<
nixl_sys
::
Backend
>>
=
HashMap
::
new
();
let
global_registry
=
GlobalRegistry
::
default
();
let
global_registry
=
GlobalRegistry
::
default
();
let
event_manager
=
config
.event_manager
.clone
()
.unwrap_or_else
(||
NullEventManager
::
new
());
// Create a NIXL agent if NIXL is enabled and instantiate requested backends
// Create a NIXL agent if NIXL is enabled and instantiate requested backends
// TODO: Build a map of NIXL backends to block pools/sets
// TODO: Build a map of NIXL backends to block pools/sets
...
@@ -150,6 +155,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
...
@@ -150,6 +155,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
worker_id
,
worker_id
,
global_registry
.clone
(),
global_registry
.clone
(),
async_rt_handle
.clone
(),
async_rt_handle
.clone
(),
Some
(
event_manager
.clone
()),
)
?
;
)
?
;
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
}
}
...
@@ -172,6 +178,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
...
@@ -172,6 +178,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
worker_id
,
worker_id
,
global_registry
.clone
(),
global_registry
.clone
(),
async_rt_handle
.clone
(),
async_rt_handle
.clone
(),
Some
(
event_manager
.clone
()),
)
?
;
)
?
;
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
}
else
{
}
else
{
...
@@ -193,6 +200,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
...
@@ -193,6 +200,7 @@ impl<Metadata: BlockMetadata> KvBlockManagerState<Metadata> {
worker_id
,
worker_id
,
global_registry
.clone
(),
global_registry
.clone
(),
async_rt_handle
.clone
(),
async_rt_handle
.clone
(),
Some
(
event_manager
.clone
()),
)
?
;
)
?
;
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
(
Some
(
Arc
::
new
(
pool
)),
Some
(
blocks
))
}
else
{
}
else
{
...
@@ -495,12 +503,15 @@ fn create_block_pool<S: Storage + NixlRegisterableStorage, M: BlockMetadata>(
...
@@ -495,12 +503,15 @@ fn create_block_pool<S: Storage + NixlRegisterableStorage, M: BlockMetadata>(
worker_id
:
WorkerID
,
worker_id
:
WorkerID
,
global_registry
:
GlobalRegistry
,
global_registry
:
GlobalRegistry
,
async_runtime
:
Handle
,
async_runtime
:
Handle
,
event_manager
:
Option
<
Arc
<
dyn
EventManager
>>
,
)
->
Result
<
(
BlockPool
<
S
,
M
>
,
Vec
<
Block
<
S
,
M
>>
)
>
{
)
->
Result
<
(
BlockPool
<
S
,
M
>
,
Vec
<
Block
<
S
,
M
>>
)
>
{
let
blocks
=
block
::
layout_to_blocks
::
<
_
,
M
>
(
layout
,
block_set_idx
,
worker_id
)
?
;
let
blocks
=
block
::
layout_to_blocks
::
<
_
,
M
>
(
layout
,
block_set_idx
,
worker_id
)
?
;
let
event_manager
=
event_manager
.unwrap_or_else
(||
NullEventManager
::
new
());
let
pool
=
BlockPool
::
<
S
,
M
>
::
builder
()
let
pool
=
BlockPool
::
<
S
,
M
>
::
builder
()
.cancel_token
(
cancellation_token
)
.cancel_token
(
cancellation_token
)
.global_registry
(
global_registry
)
.global_registry
(
global_registry
)
.async_runtime
(
async_runtime
)
.async_runtime
(
async_runtime
)
.event_manager
(
event_manager
)
.build
()
?
;
.build
()
?
;
Ok
((
pool
,
blocks
))
Ok
((
pool
,
blocks
))
}
}
lib/llm/tests/block_manager.rs
0 → 100644
View file @
3216003c
This diff is collapsed.
Click to expand it.
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