Skip to content
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

Correcting Perf Estimates for TWRW #2782

Closed
wants to merge 1 commit into from
Closed
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
28 changes: 21 additions & 7 deletions torchrec/distributed/planner/shard_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,21 +715,35 @@ def _get_twrw_sharding_perf(

# inter host comm
if world_size > local_world_size:
inter_host_fwd_fwd_output_write_size = (
batch_outputs * world_size * emb_dim * fwd_a2a_comm_data_type_size
)
fwd_comms += (
inter_host_fwd_fwd_output_write_size
* (local_world_size / world_size)
/ inter_host_bw
inter_host_fwd_output_write_size = (
batch_outputs
* (
world_size / local_world_size
) # this is the size of the procress group.
* emb_dim
* fwd_a2a_comm_data_type_size
)
fwd_comms += inter_host_fwd_output_write_size / inter_host_bw

fwd_compute = (
input_read_size + embedding_lookup_size + fwd_output_write_size
) / device_bw

# intra host comm (i.e. all gather)
bwd_comms = bwd_output_write_size / intra_host_bw

# inter host comm (i.e. all to all)
if world_size > local_world_size:
inter_host_bwd_output_write_size = (
batch_outputs
* (
world_size / local_world_size
) # this is the size of the procress group.
* emb_dim
* bwd_a2a_comm_data_type_size
)
bwd_comms += inter_host_bwd_output_write_size / inter_host_bw

bwd_grad_indice_weights_kernel = (
fwd_compute * WEIGHTED_KERNEL_MULTIPLIER if is_weighted else 0
)
Expand Down
Loading