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

support cpu device for pruned-array benchmark #1874

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ def pruned_array( # noqa C901
E,
requests_data_file=requests_data_file,
tables=tables,
use_cpu=True if device == "cpu" else False,
)
requests = [(a.int().to(device), b.int().to(device), c) for (a, b, c) in requests]

Expand Down
5 changes: 4 additions & 1 deletion fbgemm_gpu/fbgemm_gpu/split_embedding_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def generate_requests( # noqa C901
# and mu_L
sigma_L: Optional[int] = None,
emulate_pruning: bool = False,
use_cpu: bool = False,
) -> List[Tuple[torch.IntTensor, torch.IntTensor, Optional[torch.Tensor]]]:
if requests_data_file is not None:
indices_tensor, offsets_tensor, lengths_tensor = torch.load(requests_data_file)
Expand Down Expand Up @@ -309,7 +310,9 @@ def generate_requests( # noqa C901
) # per sample weights will always be FP32
)
rs.append(
get_table_batched_offsets_from_dense(all_indices[it].view(T, B, L))
get_table_batched_offsets_from_dense(
all_indices[it].view(T, B, L), use_cpu=use_cpu
)
+ (weights_tensor,)
)
return rs
Expand Down