sgl-project/sglang · warning
MultiPlatformOp is deprecated; subclass sglang.kernels.fused
Error message
MultiPlatformOp is deprecated; subclass sglang.kernels.fused_op.BaseFusedOp instead (RFC #29630).
What it means
DeprecationWarning raised whenever a class subclasses MultiPlatformOp: the multi-platform operator base is being replaced by sglang.kernels.fused_op.BaseFusedOp (RFC #29630). Old per-platform methods (forward_hip→forward_cuda, forward_cpu→forward_native, etc.) remain callable for plugin compatibility.
Source
Thrown at python/sglang/srt/layers/utils/multi_platform.py:32
import warnings
from sglang.kernels.fused_op import BaseFusedOp
class MultiPlatformOp(BaseFusedOp):
"""Deprecated alias of :class:`sglang.kernels.fused_op.BaseFusedOp`.
Kept attribute-compatible with the original class: ``forward_native`` is
concrete here (raising ``NotImplementedError``) so existing plugin
subclasses that only define platform forwards keep instantiating, and the
old per-platform default methods (``forward_hip`` -> ``forward_cuda``,
``forward_cpu`` -> ``forward_native``, ...) remain callable for plugin
code that invokes them directly.
"""
def __init_subclass__(cls, **kwargs):
warnings.warn(
"MultiPlatformOp is deprecated; subclass "
"sglang.kernels.fused_op.BaseFusedOp instead (RFC #29630).",
DeprecationWarning,
stacklevel=2,
)
super().__init_subclass__(**kwargs)
def forward_native(self, *args, **kwargs):
raise NotImplementedError
def forward_cuda(self, *args, **kwargs):
raise NotImplementedError
def forward_hip(self, *args, **kwargs):
return self.forward_cuda(*args, **kwargs)
def forward_musa(self, *args, **kwargs):
return self.forward_cuda(*args, **kwargs)View on GitHub (pinned to 0132848349)
Solutions
- Rebase the subclass on sglang.kernels.fused_op.BaseFusedOp and rename platform forward methods to the new scheme
- If you invoke forward_hip/forward_cpu directly on other classes, keep callers but plan migration
- Check RFC #29630 for the full migration mapping
Example fix
# before
class MyFusedOp(MultiPlatformOp):
def forward_hip(self, *args): ...
# after
from sglang.kernels.fused_op import BaseFusedOp
class MyFusedOp(BaseFusedOp):
def forward_cuda(self, *args): ... Defensive patterns
Strategy: validation
Validate before calling
from sglang.kernels.fused_op import BaseFusedOp # fails fast if new API absent before subclassing
Prevention
- Subclass BaseFusedOp for new fused ops
- Follow RFC #29630 naming (forward_cuda/forward_native) when porting
When it happens
Trigger: Defining any `class MyOp(MultiPlatformOp)` — __init_subclass__ fires at class-definition (import) time and warns for every subclass.
Common situations: Plugin or downstream operator code subclassing MultiPlatformOp; SGLang's own internal ops until migration completes; upgrading SGLang where the base class was deprecated.
Related errors
- sglang.srt.layers.attention.nsa.dequant_k_cache is deprecate
- sglang.srt.layers.attention.nsa.index_buf_accessor is deprec
- sglang.srt.layers.attention.nsa.nsa_backend_mtp_precompute i
- sglang.srt.layers.attention.nsa.nsa_indexer is deprecated; u
- sglang.srt.layers.attention.nsa.quant_k_cache is deprecated;
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/b8c463dd6bd157a0.
Report an issue: GitHub.