[AMD] Preserve the AITER expert mask across torch_memory_saver pause/resume (#34220)

This commit is contained in:
Zhiyao Jiang
2026-08-10 19:59:15 -07:00
committed by GitHub
parent b498f46271
commit dd20826e0a
2 changed files with 6 additions and 0 deletions
@@ -413,6 +413,11 @@ class FusedMoE(torch.nn.Module):
self.quant_method.create_moe_runner(self, self.moe_runner_config)
self.dispatcher = create_moe_dispatcher(self.moe_runner_config)
# Dispatchers are not nn.Modules, so they cannot register their own
# buffers; the AITER expert mask would not survive a memory-saver resume.
expert_mask = getattr(self.dispatcher, "expert_mask_gpu", None)
if expert_mask is not None:
self.register_buffer("expert_mask_gpu", expert_mask, persistent=False)
self._use_ascend_fuseep = get_moe_a2a_backend().is_ascend_fuseep()
if (
@@ -56,6 +56,7 @@ _NON_PERSISTENT_BUFFER_PATTERNS = (
"inv_freq",
"freqs_cis",
"_weight_fp32",
"expert_mask_gpu",
)