[ROCm][Bugfix] Register MRV2 sampler JIT warmups (#58092)
Signed-off-by: Andreas Karatzas <akaratza@amd.com> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
26879f3260
commit
96e203b08e
@@ -5252,3 +5252,27 @@ steps:
|
||||
- amdgfx950nightly
|
||||
- amdmi355
|
||||
optional: true
|
||||
|
||||
- label: ":amd: (MI355) MRV2 Sampler JIT Warmup"
|
||||
timeout_in_minutes: 10
|
||||
mirror_hardwares: [amdexperimental, amdproduction, amdgfx950nightly, amdmi355]
|
||||
dind: false
|
||||
agent_pool: mi355_1
|
||||
num_gpus: 1
|
||||
optional: true
|
||||
working_dir: "/vllm-workspace/"
|
||||
source_file_dependencies:
|
||||
- tests/jit_monitor/
|
||||
- tests/models/utils.py
|
||||
- tests/models/registry.py
|
||||
- tests/utils.py
|
||||
- vllm/v1/worker/gpu/
|
||||
- vllm/v1/worker/gpu_worker.py
|
||||
- vllm/model_executor/warmup/
|
||||
- vllm/v1/sample/ops/topk_topp_sampler.py
|
||||
- vllm/utils/jit_monitor.py
|
||||
- vllm/config/observability.py
|
||||
- vllm/platforms/rocm.py
|
||||
- vllm/envs.py
|
||||
commands:
|
||||
- pytest -v -s tests/jit_monitor/test_no_runtime_jit_rocm.py --timeout=300
|
||||
|
||||
@@ -20,3 +20,24 @@ steps:
|
||||
# instead of running until the build timeout.
|
||||
- export PYTHONFAULTHANDLER=1
|
||||
- pytest -v -s jit_monitor/test_no_runtime_jit.py --timeout=900 --timeout-method=thread
|
||||
mirror:
|
||||
amd:
|
||||
# Focused MRV2 regression; the broader model/backend matrix is pending.
|
||||
label: ':amd: (MI355) MRV2 Sampler JIT Warmup'
|
||||
dind: false
|
||||
device: mi355_1
|
||||
num_devices: 1
|
||||
timeout_in_minutes: 10
|
||||
working_dir: /vllm-workspace/
|
||||
depends_on:
|
||||
- image-build-amd
|
||||
source_file_dependencies:
|
||||
- tests/jit_monitor/
|
||||
- tests/models/utils.py
|
||||
- tests/utils.py
|
||||
- vllm/v1/worker/gpu/
|
||||
- vllm/v1/sample/ops/topk_topp_sampler.py
|
||||
- vllm/platforms/rocm.py
|
||||
- vllm/envs.py
|
||||
commands:
|
||||
- pytest -v -s tests/jit_monitor/test_no_runtime_jit_rocm.py --timeout=300
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Keep the MRV2 sampler warmup registry populated on ROCm."""
|
||||
|
||||
import pytest
|
||||
|
||||
from vllm import LLM
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
from ..models.utils import dummy_hf_overrides
|
||||
from ..utils import create_new_process_for_each_test
|
||||
from .test_no_runtime_jit import _run_shape_battery
|
||||
|
||||
pytestmark = pytest.mark.skipif(not current_platform.is_rocm(), reason="Requires ROCm")
|
||||
|
||||
|
||||
def _worker_monitor_state(worker):
|
||||
from vllm.utils import jit_monitor
|
||||
|
||||
return (
|
||||
jit_monitor.is_active(),
|
||||
worker.observability_config.jit_monitor_mode,
|
||||
)
|
||||
|
||||
|
||||
@create_new_process_for_each_test("spawn")
|
||||
def _run_rocm_shape_battery() -> None:
|
||||
llm = LLM(
|
||||
"Qwen/Qwen3-0.6B",
|
||||
max_model_len=2048,
|
||||
max_num_seqs=8,
|
||||
gpu_memory_utilization=0.03,
|
||||
kv_cache_memory_bytes=256 * 1024 * 1024,
|
||||
load_format="dummy",
|
||||
hf_overrides=dummy_hf_overrides,
|
||||
enforce_eager=False,
|
||||
jit_monitor_mode="error",
|
||||
)
|
||||
try:
|
||||
states = llm.collective_rpc(_worker_monitor_state, timeout=30)
|
||||
assert states and all(state == (True, "error") for state in states)
|
||||
_run_shape_battery(llm)
|
||||
finally:
|
||||
llm.llm_engine.engine_core.shutdown(timeout=30)
|
||||
|
||||
|
||||
def test_v2_sampler_warmup_rocm(monkeypatch, tmp_path):
|
||||
"""Warmup must cover the existing prefill, decode, and sampler battery.
|
||||
|
||||
A fresh cache and child process prevent previous model executions from
|
||||
hiding a missing warmup specialization.
|
||||
"""
|
||||
monkeypatch.setenv("VLLM_USE_V2_MODEL_RUNNER", "1")
|
||||
monkeypatch.setenv("VLLM_ROCM_USE_AITER", "0")
|
||||
monkeypatch.setenv("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
|
||||
monkeypatch.setenv("VLLM_ALLOW_INSECURE_SERIALIZATION", "1")
|
||||
monkeypatch.setenv("TRITON_CACHE_DIR", str(tmp_path / "triton"))
|
||||
monkeypatch.setenv("VLLM_CACHE_ROOT", str(tmp_path / "vllm"))
|
||||
monkeypatch.setenv("TORCHINDUCTOR_CACHE_DIR", str(tmp_path / "inductor"))
|
||||
_run_rocm_shape_battery()
|
||||
@@ -442,6 +442,15 @@ class GPUModelRunner(LoRAModelRunnerMixin):
|
||||
self.vllm_config, self.req_states, self.is_pooling_model, config_processors
|
||||
)
|
||||
if self.is_last_pp_rank and not self.is_pooling_model:
|
||||
from vllm.v1.sample.ops.topk_topp_sampler import (
|
||||
register_top_k_top_p_warmups,
|
||||
)
|
||||
|
||||
# V2 bypasses TopKTopPSampler, which registers native warmups.
|
||||
# CUDA also needs these for its FlashInfer fallback paths.
|
||||
with self.jit_warmup_registry.activate():
|
||||
register_top_k_top_p_warmups()
|
||||
|
||||
sampler_kwargs: dict[str, Any] = {
|
||||
"vllm_config": self.vllm_config,
|
||||
"max_num_reqs": self.max_num_reqs,
|
||||
|
||||
Reference in New Issue
Block a user