Skip to content

Commit 87f72eb

Browse files
Damian Reevesfacebook-github-bot
authored andcommitted
Improve visual logging for best iterative plan (#2591)
Summary: Pull Request resolved: #2591 Eyeballing the EmbeddingOffloadScaleupProposer logs to find the best plan used can be hard when the numbers are very similar. This diffs marks the improved plans with a 'BEST' label. Looking for the last BEST gives you the final plan chosen. Reviewed By: keyan Differential Revision: D66435767 fbshipit-source-id: 0b1160e1d5261530bc476adfd509234e1e29adc6
1 parent 371fc53 commit 87f72eb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

torchrec/distributed/planner/proposers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ def __init__(self, use_depth: bool = True) -> None:
476476
self.starting_proposal: List[ShardingOption] = []
477477
self.proposal: Optional[List[ShardingOption]] = None
478478
self.search: Optional[LuusJaakolaSearch] = None
479+
self.best_perf_rating: float = 1e99
479480

480481
def _build_proposal_from_sharding_options(
481482
self,
@@ -666,8 +667,13 @@ def feedback(
666667
0, search_budget, max_iterations=16, left_cost=perf_rating
667668
)
668669

670+
best = False
671+
if perf_rating is not None and perf_rating < self.best_perf_rating:
672+
self.best_perf_rating = perf_rating
673+
best = True
674+
669675
logger.info(
670-
f"EmbeddingOffloadScaleupProposer - proposed size={round(bytes_to_gb(hbm_used_previously), 2)} GB, score={perf_rating}"
676+
f"EmbeddingOffloadScaleupProposer - proposed size={bytes_to_gb(hbm_used_previously):.2f} GB, score={perf_rating}{' BEST' if best else ''}"
671677
)
672678

673679
if not partitionable:

0 commit comments

Comments
 (0)