Skip to content

Add configuration knob for ENSEMBLE_ROWWISE_ADAGRAD, frontend #2955

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

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
1 change: 1 addition & 0 deletions fbgemm_gpu/fbgemm_gpu/split_embedding_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class EmbOptimType(enum.Enum):
SHAMPOO_V2 = "shampoo_v2" # not currently supported for sparse embedding tables
MADGRAD = "madgrad"
EXACT_ROWWISE_WEIGHTED_ADAGRAD = "exact_row_wise_weighted_adagrad" # deprecated
ENSEMBLE_ROWWISE_ADAGRAD = "ensemble_row_wise_adagrad"
NONE = "none"

def __str__(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import fbgemm_gpu.split_embedding_codegen_lookup_invokers as invokers

# from fbgemm_gpu.config import FeatureGateName
from fbgemm_gpu.config import FeatureGate, FeatureGateName
from fbgemm_gpu.runtime_monitor import (
AsyncSeriesTimer,
TBEStatsReporter,
Expand Down Expand Up @@ -1331,6 +1331,12 @@ def _generate_vbe_metadata(
self.current_device,
)

@torch.jit.ignore
def _feature_is_enabled(self, feature: FeatureGateName) -> bool:
# Define proxy method so that it can be marked with @torch.jit.ignore
# This allows models using this class to compile correctly
return FeatureGate.is_enabled(feature)

def forward( # noqa: C901
self,
indices: Tensor,
Expand Down Expand Up @@ -1549,6 +1555,17 @@ def forward( # noqa: C901
offsets=self.row_counter_offsets,
placements=self.row_counter_placements,
)

if self.optimizer == OptimType.ENSEMBLE_ROWWISE_ADAGRAD:
if self._feature_is_enabled(FeatureGateName.TBE_ENSEMBLE_ROWWISE_ADAGRAD):
raise AssertionError(
"ENSEMBLE_ROWWISE_ADAGRAD feature has not landed yet (see D60189486 stack)"
)
else:
raise AssertionError(
"ENSEMBLE_ROWWISE_ADAGRAD is an inactive or deprecated feature!"
)

if self._used_rowwise_adagrad_with_counter:
if (
self._max_counter_update_freq > 0
Expand Down
Loading