[ROCm][CI] Fix AITER state leak in shared_fused_moe_routed_transform test (#38137)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-03-26 09:26:46 -07:00
committed by GitHub
parent 0aac2048bf
commit bdc1719eb9
3 changed files with 21 additions and 3 deletions
+11
View File
@@ -1905,6 +1905,17 @@ def destroy_distributed_environment():
def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
# Reset environment variable cache
envs.disable_envs_cache()
# Reset rocm_aiter_ops class variables to match current os.environ.
# These are class-level attributes that persist across tests and are
# NOT restored by monkeypatch (which only restores os.environ).
from vllm.platforms import current_platform
if current_platform.is_rocm():
from vllm._aiter_ops import rocm_aiter_ops
rocm_aiter_ops.refresh_env_variables()
# Ensure all objects are not frozen before cleanup
gc.unfreeze()