Skip to content

rocm: fix hipBLASLt BGRADB wgrad failure on gfx950#1618

Open
sreerohi wants to merge 1 commit into
radixark:mainfrom
sreerohi:rocm/te-bgradb-workaround
Open

rocm: fix hipBLASLt BGRADB wgrad failure on gfx950#1618
sreerohi wants to merge 1 commit into
radixark:mainfrom
sreerohi:rocm/te-bgradb-workaround

Conversation

@sreerohi

Copy link
Copy Markdown

The bridge provider defaults gradient_accumulation_fusion to True (via can_enable_gradient_accumulation_fusion) and ignores --no-gradient-accumulation-fusion from the CLI. The fix propagates the flag from Megatron args to the bridge provider.

Context:
hipBLASLt on gfx950 (MI350/MI355) has no algorithm for the triple combination of bf16 output with fp32 accumulate + HIPBLASLT_EPILOGUE_BGRADB epilogue + accumulate=True. This fires during TE's LayerNormLinear backward when gradient_accumulation_fusion=True and the layer has bias. So we don't use gradient_accumulation_fusion and need this change for that to take effect.

Supersedes #1153

hipBLASLt on gfx950 (MI350/MI355) has no algorithm for the triple
combination of bf16 output with fp32 accumulate + HIPBLASLT_EPILOGUE_BGRADB
epilogue + accumulate=True. This fires during TE's LayerNormLinear backward
when gradient_accumulation_fusion=True and the layer has bias.

Root cause: the bridge provider defaults gradient_accumulation_fusion to
True (via can_enable_gradient_accumulation_fusion) and ignores
--no-gradient-accumulation-fusion from the CLI. The fix propagates the
flag from Megatron args to the bridge provider.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the _apply_bridge_runtime_config function in miles/backends/megatron_utils/model_provider.py to honor the Megatron CLI flag for gradient_accumulation_fusion. The reviewer identified a potential AttributeError if provider does not already have the gradient_accumulation_fusion attribute, and suggested guarding the assignment with a hasattr check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +102 to +104
provider.gradient_accumulation_fusion = getattr(
args, "gradient_accumulation_fusion", provider.gradient_accumulation_fusion
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Directly accessing provider.gradient_accumulation_fusion as the default argument to getattr will raise an AttributeError if provider does not have this attribute. To prevent potential runtime errors and maintain consistency with the dsa_attention_backend check above, we should guard this assignment with hasattr(provider, "gradient_accumulation_fusion").

Suggested change
provider.gradient_accumulation_fusion = getattr(
args, "gradient_accumulation_fusion", provider.gradient_accumulation_fusion
)
if hasattr(provider, "gradient_accumulation_fusion"):
provider.gradient_accumulation_fusion = getattr(
args, "gradient_accumulation_fusion", provider.gradient_accumulation_fusion
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant