-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Open
Labels
Description
Motivation.
Currently, all the compiled kernels are loaded in _custom_ops.py by:
import vllm._C
import vllm._moe_C
...This has several limits:
- It needs to guarantee that the dynamic libraries are under the vllm's directory (usually under site-package).
- If plugin(or out_of_tree) wanna reuse this file and adapted or registered the same kernels, they have to copy their kernels from plugin to vllm's folder during the installation.
Proposed Change.
We want to offer a platform interface to support load the platform-specific kernel operations:
class Platform:
@classmethod
def import_general_kernels(cls) -> None:
""" Import any platform-specific C kernels. """
import vllm._C # noqa: F401
# import vllm.some_other_kernels
@classmethod
def import_moe_kernels(cls) -> None:
"""
Import any platform-specific Mixture of Experts kernels.
"""
import vllm._moe_C # noqa: F401and then, to load them by:
# in _custom_ops.py
try:
current_platform.import_general_kernels()
except ImportError as e:
logger.warning("Failed to load kernels with %r", e)
supports_moe_ops = False
with contextlib.suppress(ImportError):
current_platform.import_moe_kernels()
supports_moe_ops = True
I've made a draft pr in #25823, any comments or help would be appreciated!
Feedback Period.
9.28 ~ 10.8
CC List.
@NickLucche @youkaichao @mgoin @ProExpertProg @MatthewBonanni
Any Other Things.
No response
Before submitting a new issue...
- Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
noooop and NickLucche