Fix bug in momentum type declaration in HIP TBE kernel#147
Open
aryaman-gupta wants to merge 5 commits intoaryaman/upstreamfrom
Open
Fix bug in momentum type declaration in HIP TBE kernel#147aryaman-gupta wants to merge 5 commits intoaryaman/upstreamfrom
aryaman-gupta wants to merge 5 commits intoaryaman/upstreamfrom
Conversation
avbokovoy
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in the HIP TBE kernel which defined the data type of
p_momentumascache_t. Whencache_tishalf, this declaresp_momentumashalf, which is incorrect and inconsistent with the Python code (https://github.com/ROCm/FBGEMM/blob/aryaman/hip-tbe-momentum-fix/fbgemm_gpu/fbgemm_gpu/split_table_batched_embeddings_ops_training.py#L1232-L1240). Before pytorch@ea2a302 was merged,cache_twas alwaysfloat, so this bug did not show up.Here, the datatype for
p_momentumis determined using PyTorch'sacc_type, which returnsfloatwhencache_tishalf. This is also how the CUDA codepath appears to handle the datatype for the momentum buffer (references: https://github.com/ROCm/FBGEMM/blob/aryaman/hip-tbe-momentum-fix/fbgemm_gpu/codegen/genscript/optimizer_args.py#L956-L961, https://github.com/ROCm/FBGEMM/blob/aryaman/hip-tbe-momentum-fix/fbgemm_gpu/codegen/genscript/optimizers.py#L266)