Skip to content

Add logic to stream weights in EmbeddingKVDB #2930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions torchrec/distributed/batched_embedding_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ def _populate_ssd_tbe_params(config: GroupedEmbeddingConfig) -> Dict[str, Any]:
)
ssd_tbe_params["cache_sets"] = int(max_cache_sets)

ssd_tbe_params["table_names"] = [table.name for table in config.embedding_tables]
ssd_tbe_params["table_offsets"] = []
for emb_tbl in config.embedding_tables:
local_metadata = emb_tbl.local_metadata
if (
local_metadata is not None
and local_metadata.shard_offsets is not None
and len(local_metadata.shard_offsets) >= 1
):
ssd_tbe_params["table_offsets"].append(local_metadata.shard_offsets[0])

return ssd_tbe_params


Expand Down
5 changes: 5 additions & 0 deletions torchrec/distributed/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class KeyValueParams:
enable_async_update: Optional[bool]: whether to enable async update for l2 cache
bulk_init_chunk_size: int: number of rows to insert into rocksdb in each chunk
lazy_bulk_init_enabled: bool: whether to enable lazy(async) bulk init for SSD TBE
enable_raw_embedding_streaming: Optional[bool]: enable raw embedding streaming for SSD TBE

# Parameter Server (PS) Attributes
ps_hosts (Optional[Tuple[Tuple[str, int]]]): List of PS host ip addresses
Expand All @@ -660,6 +661,9 @@ class KeyValueParams:
enable_async_update: Optional[bool] = None # enable L2 cache async update
bulk_init_chunk_size: Optional[int] = None # number of rows
lazy_bulk_init_enabled: Optional[bool] = None # enable lazy bulk init
enable_raw_embedding_streaming: Optional[bool] = (
None # enable raw embedding streaming for SSD TBE
)

# Parameter Server (PS) Attributes
ps_hosts: Optional[Tuple[Tuple[str, int], ...]] = None
Expand All @@ -686,6 +690,7 @@ def __hash__(self) -> int:
self.enable_async_update,
self.bulk_init_chunk_size,
self.lazy_bulk_init_enabled,
self.enable_raw_embedding_streaming,
)
)

Expand Down
Loading