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 MTIA device type in FBGEEM TBE training #1994

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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class DoesNotHavePrefix(Exception):
class ComputeDevice(enum.IntEnum):
CPU = 0
CUDA = 1
MTIA = 2


class WeightDecayMode(enum.IntEnum):
Expand Down Expand Up @@ -366,7 +367,13 @@ def __init__( # noqa C901
assert all(
cd == compute_devices[0] for cd in compute_devices
), "Heterogenous compute_devices are NOT supported!"
self.use_cpu: bool = all(cd == ComputeDevice.CPU for cd in compute_devices)
# Split TBE has different function schemas for CUDA and CPU.
# For MTIA device type, it uses the CPU one.
self.use_cpu: bool = (
compute_devices[0] == ComputeDevice.CPU
or compute_devices[0] == ComputeDevice.MTIA
)

assert not self.use_cpu or all(
loc == EmbeddingLocation.HOST for loc in locations
), "ComputeDevice.CPU is only for EmbeddingLocation.HOST!"
Expand Down Expand Up @@ -998,7 +1005,7 @@ def forward( # noqa: C901
placements=self.momentum2_placements,
)
# Ensure iter is always on CPU so the increment doesn't synchronize.
if self.iter.is_cuda:
if not self.iter.is_cpu:
self.iter = self.iter.cpu()
self.iter[0] += 1

Expand Down
Loading