Skip to content
Open
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
10 changes: 10 additions & 0 deletions miles/backends/megatron_utils/model_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ def _apply_bridge_runtime_config(provider, args: argparse.Namespace) -> None:

if hasattr(provider, "dsa_attention_backend"):
provider.dsa_attention_backend = getattr(args, "dsa_attention_backend", "megatron")
# The bridge provider defaults gradient_accumulation_fusion=True
# (via fusions.can_enable_gradient_accumulation_fusion). On ROCm/gfx950,
# this makes TE's LayerNormLinear backward issue a bias-fused wgrad GEMM
# with bf16 inputs → fp32 output + HIPBLASLT_EPILOGUE_BGRADB + accumulate,
# for which hipBLASLt has no algorithm. Honor the Megatron CLI flag so
# that --no-gradient-accumulation-fusion actually takes effect.
if hasattr(provider, "gradient_accumulation_fusion"):
provider.gradient_accumulation_fusion = getattr(
args, "gradient_accumulation_fusion", provider.gradient_accumulation_fusion
)


# Adapt from https://github.com/volcengine/verl/blob/c3b20575d2bc815fcccd84bddb4c0401fc4b632b/verl/models/llama/megatron/layers/parallel_linear.py#L82
Expand Down
5 changes: 5 additions & 0 deletions tests/ci/rocm_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Shared ROCm detection for CI tests."""

import torch

IS_ROCM = getattr(torch.version, "hip", None) is not None