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

Enable TBE VBE with SGD #1943

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
4 changes: 3 additions & 1 deletion fbgemm_gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ set(CPU_OPTIMIZERS ${COMMON_OPTIMIZERS} ${CPU_ONLY_OPTIMIZERS})
set(GPU_OPTIMIZERS ${COMMON_OPTIMIZERS} ${GPU_ONLY_OPTIMIZERS})

# Optimizers with the VBE support
set(VBE_OPTIMIZERS rowwise_adagrad)
set(VBE_OPTIMIZERS
rowwise_adagrad
sgd)

# Individual optimizers (not fused with SplitTBE backward)
set(DEFUSED_OPTIMIZERS rowwise_adagrad)
Expand Down
2 changes: 1 addition & 1 deletion fbgemm_gpu/codegen/embedding_common_code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ def sgd() -> Dict[str, Any]:
"split_weight_update_cpu": split_weight_update_cpu,
"has_cpu_support": True,
"has_gpu_support": True,
"has_vbe_support": False,
"has_vbe_support": True,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ def forward( # noqa: C901
if batch_size_per_feature_per_rank is not None:
assert (
self.optimizer == OptimType.EXACT_ROWWISE_ADAGRAD
or self.optimizer == OptimType.EXACT_SGD
), "Variable batch size TBE support is enabled for OptimType.EXACT_ROWWISE_ADAGRAD only"
assert (
self.pooling_mode != PoolingMode.NONE.value
Expand Down
8 changes: 6 additions & 2 deletions fbgemm_gpu/test/split_table_batched_embeddings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,7 @@ def execute_backward_sgd_( # noqa C901
weights_precision=st.sampled_from([SparseType.FP16, SparseType.FP32]),
weighted=st.booleans(),
mixed=st.booleans(),
mixed_B=st.booleans(),
use_cache=st.booleans(),
cache_algorithm=st.sampled_from(CacheAlgorithm),
long_segments=st.booleans(),
Expand Down Expand Up @@ -2138,6 +2139,7 @@ def test_backward_sgd( # noqa C901
weights_precision: SparseType,
weighted: bool,
mixed: bool,
mixed_B: bool,
use_cache: bool,
cache_algorithm: CacheAlgorithm,
long_segments: bool,
Expand All @@ -2153,7 +2155,7 @@ def test_backward_sgd( # noqa C901
weights_precision,
weighted,
mixed,
False, # mixed_B
mixed_B if not use_cpu else False,
use_cache,
cache_algorithm,
long_segments,
Expand All @@ -2171,6 +2173,7 @@ def test_backward_sgd( # noqa C901
L=st.integers(min_value=1, max_value=4),
weighted=st.booleans(),
mixed=st.booleans(),
mixed_B=st.booleans(),
use_cache=st.booleans(),
cache_algorithm=st.sampled_from(CacheAlgorithm),
)
Expand All @@ -2188,6 +2191,7 @@ def test_backward_sgd_really_long_segments( # noqa C901
L: int,
weighted: bool,
mixed: bool,
mixed_B: bool,
use_cache: bool,
cache_algorithm: CacheAlgorithm,
) -> None:
Expand All @@ -2200,7 +2204,7 @@ def test_backward_sgd_really_long_segments( # noqa C901
SparseType.FP32, # weights_precision
weighted,
mixed,
False, # mixed_B
mixed_B,
use_cache,
cache_algorithm,
True, # long_segments
Expand Down