Skip to content

Commit f68bc72

Browse files
Tony Zhangfacebook-github-bot
authored andcommitted
Moving data classes to types file.
Summary: Part of refactor to make lp_planner.py smaller, part 1, moving rank and shard info to types.py Differential Revision: D72186211 fbshipit-source-id: 501e20689446ed75335cd48b825713611a66a56f
1 parent c5166ef commit f68bc72

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

torchrec/distributed/planner/types.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,27 @@ def __str__(self) -> str:
342342
return f"Shard size: {tuple(self.size)}, offset: {tuple(self.offset)}, storage: {str(self.storage)}, perf: {str(self.perf)}, rank: {self.rank}"
343343

344344

345+
@dataclass
346+
class Rank:
347+
key: str
348+
hbm: float
349+
ddr: float
350+
node_key: str
351+
352+
353+
@dataclass
354+
class ShardInfo:
355+
key: str
356+
sharding_type: str
357+
compute_kernel: str
358+
table_name: str
359+
rank_key: str # either a number or DUMMY_RANK_KEY
360+
shard: Shard
361+
module_fqn: str
362+
_index_in_shards: int
363+
_index_in_search_space: int
364+
365+
345366
class ShardingOption:
346367
"""
347368
One way of sharding an embedding table. In the enumerator, we generate

0 commit comments

Comments
 (0)