Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][Bugfix][Perf] Introduce MQLLMEngine to avoid asyncio OH #8157

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
a7a6e43
[Benchmark] Add async throughput benchmark
njhill Aug 28, 2024
ce7d159
wip
njhill Aug 29, 2024
569cd43
Merge remote-tracking branch 'njhill/async-llm-eng-bench' into reduce…
robertgshaw2-redhat Aug 29, 2024
d99ce6f
stash
robertgshaw2-redhat Aug 31, 2024
8d6b2e9
remove proxy
robertgshaw2-redhat Sep 2, 2024
14f3637
stash
robertgshaw2-redhat Sep 2, 2024
3b8311b
added mp_llm_engine
robertgshaw2-redhat Sep 2, 2024
5e2eb74
fixed
robertgshaw2-redhat Sep 2, 2024
aa62f2e
format
robertgshaw2-redhat Sep 2, 2024
863081b
cleanup
robertgshaw2-redhat Sep 2, 2024
965b97a
revert asyncllmengine
robertgshaw2-redhat Sep 2, 2024
8fd72f6
fix nit
robertgshaw2-redhat Sep 2, 2024
ddeb7c6
format
robertgshaw2-redhat Sep 2, 2024
6539e10
Merge branch 'main' into reduce-asyncio-oh
robertgshaw2-redhat Sep 2, 2024
4b111e4
clean
robertgshaw2-redhat Sep 2, 2024
a5ffd2c
fix
robertgshaw2-redhat Sep 2, 2024
1395872
stash
robertgshaw2-redhat Sep 2, 2024
938cf85
move files
robertgshaw2-redhat Sep 2, 2024
72d1d42
cleanup code
robertgshaw2-redhat Sep 3, 2024
fcdcfc9
refactor, cleanup
robertgshaw2-redhat Sep 3, 2024
659169e
updated
robertgshaw2-redhat Sep 3, 2024
9886f3d
make health check work
robertgshaw2-redhat Sep 3, 2024
5b2f057
format
robertgshaw2-redhat Sep 3, 2024
ae4564c
awk -> ack
robertgshaw2-redhat Sep 3, 2024
f9ccecc
add better shutdown
robertgshaw2-redhat Sep 3, 2024
89b730b
cleanup comment
robertgshaw2-redhat Sep 3, 2024
f3dc82b
more awk --> ack
robertgshaw2-redhat Sep 3, 2024
ac97a9e
use constant
robertgshaw2-redhat Sep 3, 2024
becd7ab
format
robertgshaw2-redhat Sep 3, 2024
b7f49ed
remove set to None
robertgshaw2-redhat Sep 3, 2024
58ae3b0
Merge remote-tracking branch 'origin/main' into reduce-asyncio-oh
njhill Sep 4, 2024
d0f9641
Remove redundant pass
njhill Sep 4, 2024
aa64042
Merge branch 'main' into reduce-asyncio-oh
robertgshaw2-redhat Sep 4, 2024
5c6e5ef
review comments
alexm-redhat Sep 4, 2024
25174a5
format
alexm-redhat Sep 4, 2024
db55c1a
add async socket reads and socket writes
alexm-redhat Sep 4, 2024
f97e1f2
Some error handling
njhill Sep 4, 2024
dd96d3e
remove async benchmark
robertgshaw2-redhat Sep 7, 2024
14d4afe
stash
robertgshaw2-redhat Sep 7, 2024
bc386ea
Merge branch 'main' into reduce-asyncio-oh-alex
robertgshaw2-redhat Sep 7, 2024
c0d0d60
adding error handling
robertgshaw2-redhat Sep 7, 2024
b7c1fcc
error handling
robertgshaw2-redhat Sep 7, 2024
a661b76
added
robertgshaw2-redhat Sep 7, 2024
5d00f3a
formatting in place
robertgshaw2-redhat Sep 7, 2024
5598494
added error handling
robertgshaw2-redhat Sep 8, 2024
98aaa7d
change name
robertgshaw2-redhat Sep 8, 2024
ba5ef38
change name
robertgshaw2-redhat Sep 8, 2024
18b5a94
added dead_error to asyncengine
robertgshaw2-redhat Sep 8, 2024
b048961
moved tests under openai
robertgshaw2-redhat Sep 8, 2024
6b2e18b
updated tests
robertgshaw2-redhat Sep 8, 2024
7a7ff5b
revert executor change
robertgshaw2-redhat Sep 8, 2024
b7e1fe9
revert
robertgshaw2-redhat Sep 8, 2024
48068d5
executor class
robertgshaw2-redhat Sep 8, 2024
e3daa28
cleanup format
robertgshaw2-redhat Sep 8, 2024
7880b75
format
robertgshaw2-redhat Sep 8, 2024
29fe3c8
shorten
robertgshaw2-redhat Sep 8, 2024
a720947
Revert change
robertgshaw2-redhat Sep 8, 2024
5b8cee6
enable shutdown for tp>1
robertgshaw2-redhat Sep 8, 2024
97a241d
format
robertgshaw2-redhat Sep 8, 2024
6d0570e
added error handling
robertgshaw2-redhat Sep 8, 2024
eb26791
format
robertgshaw2-redhat Sep 8, 2024
e256050
try out hwm
robertgshaw2-redhat Sep 9, 2024
59c5aca
Add stop_remote_worker_execution_loop for TP case
njhill Sep 9, 2024
62f654a
Revert unnecessary stop_remote_worker_execution_loop
njhill Sep 10, 2024
75c6157
fixed magicmock errored
robertgshaw2-redhat Sep 10, 2024
6f1cced
Merge branch 'main' into reduce-asyncio-oh-alex
robertgshaw2-redhat Sep 10, 2024
370c104
fall back to asyncllmengine if pp
robertgshaw2-redhat Sep 10, 2024
0cf9551
formatting
robertgshaw2-redhat Sep 10, 2024
72f72fd
stash
robertgshaw2-redhat Sep 10, 2024
ded4540
Merge branch 'main' into reduce-asyncio-oh-alex
robertgshaw2-redhat Sep 10, 2024
364ed7f
remove DO_LOG_STATS RPC call
robertgshaw2-redhat Sep 10, 2024
f7fdf69
cleanup health check
robertgshaw2-redhat Sep 10, 2024
7e61cdb
Use pickle for requests too
njhill Sep 10, 2024
3e84c8c
Remove hwm
robertgshaw2-redhat Sep 10, 2024
2559813
Simplify configs setup
njhill Sep 10, 2024
d0a0f8b
stash
robertgshaw2-redhat Sep 10, 2024
70e4916
Merge branch 'reduce-asyncio-oh-alex' of https://github.com/neuralmag…
robertgshaw2-redhat Sep 10, 2024
021fed3
added tests
robertgshaw2-redhat Sep 10, 2024
fd6ee43
added failed health check
robertgshaw2-redhat Sep 11, 2024
ccb43a3
rename
robertgshaw2-redhat Sep 11, 2024
1aa0823
added failed abort test
robertgshaw2-redhat Sep 11, 2024
fe22fe2
formatting
robertgshaw2-redhat Sep 11, 2024
3ce8702
Some more startup RPC simplification
njhill Sep 11, 2024
1f3fc24
fix yapf conflict
njhill Sep 11, 2024
ead62dd
fix entrypoints tests
alexm-redhat Sep 11, 2024
672fb81
stash
robertgshaw2-redhat Sep 11, 2024
86312e4
fix Intel/TPU tests
alexm-redhat Sep 11, 2024
c4f6898
Merge branch 'reduce-asyncio-oh-alex' of https://github.com/neuralmag…
robertgshaw2-redhat Sep 11, 2024
678e8e5
Merge branch 'reduce-asyncio-oh-alex' of https://github.com/neuralmag…
robertgshaw2-redhat Sep 11, 2024
78b9e21
fix
robertgshaw2-redhat Sep 11, 2024
66c6961
formatting
robertgshaw2-redhat Sep 11, 2024
6e1e2bb
cleanup
robertgshaw2-redhat Sep 11, 2024
610b349
cleanup
robertgshaw2-redhat Sep 11, 2024
28bb8a4
format
robertgshaw2-redhat Sep 11, 2024
b266249
fix poller
robertgshaw2-redhat Sep 11, 2024
f8036a5
add graceful shutdown on abort after client closed
robertgshaw2-redhat Sep 11, 2024
a649f75
cleanup formatting
robertgshaw2-redhat Sep 11, 2024
5b3535d
added test abort
robertgshaw2-redhat Sep 11, 2024
7097e05
fix up tests
robertgshaw2-redhat Sep 11, 2024
ad3d0f8
added abort tests
robertgshaw2-redhat Sep 12, 2024
6e9c6c9
added another accurayc test
robertgshaw2-redhat Sep 12, 2024
fb8e2f9
add multistep test for accuracy of mq llm engine
robertgshaw2-redhat Sep 12, 2024
75523b2
added test genertion
robertgshaw2-redhat Sep 12, 2024
5546d2e
fixed accuracy test launch
robertgshaw2-redhat Sep 12, 2024
6403f49
added load test
robertgshaw2-redhat Sep 12, 2024
bc68b51
Merge branch 'main' into reduce-asyncio-oh-alex
robertgshaw2-redhat Sep 12, 2024
3bb5e52
remove file
robertgshaw2-redhat Sep 12, 2024
2ac814f
format
robertgshaw2-redhat Sep 12, 2024
179a667
added load test
robertgshaw2-redhat Sep 12, 2024
97d6c09
format
robertgshaw2-redhat Sep 12, 2024
78badc1
added load test
robertgshaw2-redhat Sep 12, 2024
a499733
format
alexm-redhat Sep 12, 2024
6a5d8d8
stash
robertgshaw2-redhat Sep 12, 2024
dfab5eb
Merge branch 'reduce-asyncio-oh-alex' of https://github.com/neuralmag…
robertgshaw2-redhat Sep 12, 2024
96f84fe
format
robertgshaw2-redhat Sep 12, 2024
ae14670
Merge branch 'main' into reduce-asyncio-oh-alex
robertgshaw2-redhat Sep 14, 2024
117c024
format
robertgshaw2-redhat Sep 14, 2024
c059713
remove debug print
robertgshaw2-redhat Sep 14, 2024
1af3297
removed stray
robertgshaw2-redhat Sep 14, 2024
97ae38d
updated
robertgshaw2-redhat Sep 14, 2024
d0fab11
switch model to avoid OOM in TPU test
robertgshaw2-redhat Sep 14, 2024
bb4d839
Merge remote-tracking branch 'origin/main' into reduce-asyncio-oh-alex
njhill Sep 16, 2024
1967f6a
Adjust timeouts
njhill Sep 16, 2024
a911323
stahs
robertgshaw2-redhat Sep 17, 2024
95ff4f3
make timeout 10000 ms
robertgshaw2-redhat Sep 17, 2024
302868e
format
robertgshaw2-redhat Sep 17, 2024
add68ee
Update examples/openai_chat_completion_client.py
robertgshaw2-redhat Sep 17, 2024
242b952
adjust RPC timeout on TPU
robertgshaw2-redhat Sep 17, 2024
3dafa26
add longer delay for check ehalth
robertgshaw2-redhat Sep 17, 2024
836a9d2
Update client.py
robertgshaw2-redhat Sep 18, 2024
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
Prev Previous commit
Next Next commit
revert executor change
  • Loading branch information
robertgshaw2-redhat committed Sep 8, 2024
commit 7a7ff5b1178487e5198371f743d2075f72cbe414
68 changes: 66 additions & 2 deletions vllm/engine/async_llm_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
from typing_extensions import assert_never

import vllm.envs as envs
from vllm.config import (DecodingConfig, LoRAConfig, ModelConfig,
from vllm.config import (DecodingConfig, EngineConfig, LoRAConfig, ModelConfig,
ParallelConfig, SchedulerConfig)
from vllm.core.scheduler import SchedulerOutputs
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.engine.async_timeout import asyncio_timeout
from vllm.engine.llm_engine import (DecoderPromptComponents, LLMEngine,
PromptComponents, SchedulerOutputState)
from vllm.engine.metrics_types import StatLoggerBase
from vllm.executor.executor_base import get_executor_cls
from vllm.executor.executor_base import ExecutorAsyncBase
from vllm.executor.ray_utils import initialize_ray_cluster, ray
from vllm.executor.ray_utils import ray
from vllm.inputs import (EncoderDecoderLLMInputs, LLMInputs, PromptInputs,
SingletonPromptInputs)
Expand Down Expand Up @@ -649,6 +650,69 @@ def __init__(self,

# Lazy initialized fields
self._request_tracker: RequestTracker

@classmethod
def _get_executor_cls(
cls, engine_config: EngineConfig) -> Type[ExecutorAsyncBase]:
distributed_executor_backend = (
engine_config.parallel_config.distributed_executor_backend)
if isinstance(distributed_executor_backend, type):
if not issubclass(distributed_executor_backend, ExecutorAsyncBase):
raise TypeError(
"distributed_executor_backend must be a subclass of "
f"ExecutorAsyncBase. Got {distributed_executor_backend}.")
if distributed_executor_backend.uses_ray: # type: ignore
initialize_ray_cluster(engine_config.parallel_config)
executor_class = distributed_executor_backend
elif engine_config.device_config.device_type == "neuron":
from vllm.executor.neuron_executor import NeuronExecutorAsync
executor_class = NeuronExecutorAsync
elif engine_config.device_config.device_type == "tpu":
if distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_tpu_executor import RayTPUExecutorAsync
executor_class = RayTPUExecutorAsync
else:
assert distributed_executor_backend is None
from vllm.executor.tpu_executor import TPUExecutorAsync
executor_class = TPUExecutorAsync
elif engine_config.device_config.device_type == "cpu":
from vllm.executor.cpu_executor import CPUExecutorAsync
executor_class = CPUExecutorAsync
elif engine_config.device_config.device_type == "openvino":
assert distributed_executor_backend is None, (
"Distributed execution is not supported with "
"the OpenVINO backend.")
from vllm.executor.openvino_executor import OpenVINOExecutorAsync
executor_class = OpenVINOExecutorAsync
elif engine_config.device_config.device_type == "xpu":
if distributed_executor_backend is None:
from vllm.executor.xpu_executor import XPUExecutorAsync
executor_class = XPUExecutorAsync
elif distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_xpu_executor import RayXPUExecutorAsync
executor_class = RayXPUExecutorAsync
elif distributed_executor_backend == "mp":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.multiproc_xpu_executor import (
MultiprocessingXPUExecutorAsync)
executor_class = MultiprocessingXPUExecutorAsync
else:
raise RuntimeError(
"Not supported distributed execution model on XPU device.")
elif distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_gpu_executor import RayGPUExecutorAsync
executor_class = RayGPUExecutorAsync
elif distributed_executor_backend == "mp":
from vllm.executor.multiproc_gpu_executor import (
MultiprocessingGPUExecutorAsync)
executor_class = MultiprocessingGPUExecutorAsync
else:
from vllm.executor.gpu_executor import GPUExecutorAsync
executor_class = GPUExecutorAsync
return executor_class

@classmethod
def from_engine_args(
Expand Down
62 changes: 0 additions & 62 deletions vllm/executor/executor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,65 +149,3 @@ async def check_health_async(self) -> None:
"""Checks if the executor is healthy. If not, it should raise an
exception."""
self.check_health()


def get_executor_cls(engine_config: EngineConfig) -> Type["ExecutorAsyncBase"]:
distributed_executor_backend = (
engine_config.parallel_config.distributed_executor_backend)
if isinstance(distributed_executor_backend, type):
if not issubclass(distributed_executor_backend, ExecutorAsyncBase):
raise TypeError(
"distributed_executor_backend must be a subclass of "
f"ExecutorAsyncBase. Got {distributed_executor_backend}.")
if distributed_executor_backend.uses_ray: # type: ignore
initialize_ray_cluster(engine_config.parallel_config)
executor_class = distributed_executor_backend
elif engine_config.device_config.device_type == "neuron":
from vllm.executor.neuron_executor import NeuronExecutorAsync
executor_class = NeuronExecutorAsync
elif engine_config.device_config.device_type == "tpu":
if distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_tpu_executor import RayTPUExecutorAsync
executor_class = RayTPUExecutorAsync
else:
assert distributed_executor_backend is None
from vllm.executor.tpu_executor import TPUExecutorAsync
executor_class = TPUExecutorAsync
elif engine_config.device_config.device_type == "cpu":
from vllm.executor.cpu_executor import CPUExecutorAsync
executor_class = CPUExecutorAsync
elif engine_config.device_config.device_type == "openvino":
assert distributed_executor_backend is None, (
"Distributed execution is not supported with "
"the OpenVINO backend.")
from vllm.executor.openvino_executor import OpenVINOExecutorAsync
executor_class = OpenVINOExecutorAsync
elif engine_config.device_config.device_type == "xpu":
if distributed_executor_backend is None:
from vllm.executor.xpu_executor import XPUExecutorAsync
executor_class = XPUExecutorAsync
elif distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_xpu_executor import RayXPUExecutorAsync
executor_class = RayXPUExecutorAsync
elif distributed_executor_backend == "mp":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.multiproc_xpu_executor import (
MultiprocessingXPUExecutorAsync)
executor_class = MultiprocessingXPUExecutorAsync
else:
raise RuntimeError(
"Not supported distributed execution model on XPU device.")
elif distributed_executor_backend == "ray":
initialize_ray_cluster(engine_config.parallel_config)
from vllm.executor.ray_gpu_executor import RayGPUExecutorAsync
executor_class = RayGPUExecutorAsync
elif distributed_executor_backend == "mp":
from vllm.executor.multiproc_gpu_executor import (
MultiprocessingGPUExecutorAsync)
executor_class = MultiprocessingGPUExecutorAsync
else:
from vllm.executor.gpu_executor import GPUExecutorAsync
executor_class = GPUExecutorAsync
return executor_class
Loading