@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / f8c3af2d85
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 14:45 UTC

[vLLM IR] add `import_ir_kernels()` to support OOT platforms (#38807)

Signed-off-by: Icey <1790571317@qq.com>

Xiaoshuang Wang committed Apr 4, 2026 at 01:25 UTC f8c3af2d85a18823d70f359408f7ca72a1c5b9ac
2 files changed +14 -2
vllm/config/kernel.py
+5 -2
@@ -68,10 +68,13 @@ class IrOpPriorityConfig:
68 def set_priority(self):
69 """
70 Context manager to set the IR op priority for all op members.
71 - It also imports vllm.kernels to ensure all implementations are made available.
71 + It also imports IR kernel implementations for the current platform
72 + to ensure all implementations are made available.
73 """
73 - import vllm.kernels # noqa: F401, registers IR op implementations
74 from vllm.ir.op import IrOp
75 + from vllm.platforms import current_platform
76 +
77 + current_platform.import_ir_kernels()
78
79 with contextlib.ExitStack() as stack:
80 for field in fields(self):
vllm/platforms/interface.py
+9
@@ -207,6 +207,15 @@ class Platform:
207 """
208 return cls.simple_compile_backend
209
210 + @classmethod
211 + def import_ir_kernels(cls) -> None:
212 + """
213 + The default implementation imports ``vllm.kernels``, which registers
214 + the built-in IR op implementations. Out-of-tree (OOT) platforms should
215 + override this method to import their own kernel modules.
216 + """
217 + import vllm.kernels # noqa: F401
218 +
219 @classmethod
220 def device_id_to_physical_device_id(cls, device_id: int):
221 # Treat empty device control env var as unset. This is a valid