Skip to content
Closed
Show file tree
Hide file tree
Changes from 14 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
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@
from torch._inductor.utils import fresh_cache


def use_aiter_if_available():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hm, not sure if this is a good idea. I think many tests explicity set or dont set this env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated it so that only the function pointers are loaded, which was happening before, but the environment variable is set to 0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@robertgshaw2-redhat I could also do this in _aiter_ops.py, which also works. Basically, the functions get loaded but the env var will be unset:

@@ -36,7 +36,7 @@ def is_aiter_found_and_supported() -> bool:
     Checks: platform (ROCm), device arch (gfx9), library existence,
     and VLLM_ROCM_USE_AITER env variable.
     """
-    if current_platform.is_rocm() and IS_AITER_FOUND and envs.VLLM_ROCM_USE_AITER:
+    if current_platform.is_rocm() and IS_AITER_FOUND:
         from vllm.platforms.rocm import on_gfx9

from vllm.platforms import current_platform
from importlib.util import find_spec

# NOTE: it's not possible to use vllm._aiter_ops.is_aiter_found
# because the aiter ops won't load and all tests that want
# to use aiter will fail because no aiter ops will be loaded.
if current_platform.is_rocm() and find_spec("aiter") is not None:
os.environ["VLLM_ROCM_USE_AITER"] = "1"


use_aiter_if_available()

if TYPE_CHECKING:
from transformers import PreTrainedTokenizer, PreTrainedTokenizerFast
from transformers.generation.utils import GenerateOutput
Expand Down
4 changes: 0 additions & 4 deletions tests/kernels/moe/test_rocm_aiter_topk.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# and the platform is not ROCm.

import importlib.util
import os

import pytest
import torch
Expand All @@ -20,9 +19,6 @@
if not current_platform.is_rocm():
pytest.skip("This test can only run on ROCm.", allow_module_level=True)

# This environment variable must be set so ops will be registered.
os.environ["VLLM_ROCM_USE_AITER"] = "1"

# this import statement is needed to ensure the ops are registered
import vllm.model_executor.layers.fused_moe.rocm_aiter_fused_moe # noqa: F401

Expand Down
1 change: 1 addition & 0 deletions vllm/config/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def enable_norm_pad_fusion(cfg: "VllmConfig") -> bool:
envs.VLLM_ROCM_USE_AITER
and envs.VLLM_ROCM_USE_AITER_RMSNORM
and envs.VLLM_ROCM_USE_AITER_TRITON_GEMM
and cfg.model_config is not None
and cfg.model_config.get_hidden_size() == 2880
)

Expand Down