rocm: fix hipBLASLt BGRADB wgrad failure on gfx950#1618
Conversation
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.
There was a problem hiding this comment.
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.
| provider.gradient_accumulation_fusion = getattr( | ||
| args, "gradient_accumulation_fusion", provider.gradient_accumulation_fusion | ||
| ) |
There was a problem hiding this comment.
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").
| 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 | |
| ) |
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