[Feat]Add scheduler recv skipper weights to environment configuration (#13855)
This commit is contained in:
@@ -31,6 +31,11 @@ SGLang supports various environment variables that can be used to configure its
|
|||||||
| `SGLANG_FUSED_MLA_ENABLE_ROPE_FUSION` | Enable RoPE fusion in Fused Multi-Layer Attention | `1` |
|
| `SGLANG_FUSED_MLA_ENABLE_ROPE_FUSION` | Enable RoPE fusion in Fused Multi-Layer Attention | `1` |
|
||||||
| `SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP` | Disable overlap schedule for consecutive prefill batches | `false` |
|
| `SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP` | Disable overlap schedule for consecutive prefill batches | `false` |
|
||||||
| `SGLANG_DISABLE_FA4_WARMUP` | Disable Flash Attention 4 warmup passes (set to `1`, `true`, `yes`, or `on` to disable) | `false` |
|
| `SGLANG_DISABLE_FA4_WARMUP` | Disable Flash Attention 4 warmup passes (set to `1`, `true`, `yes`, or `on` to disable) | `false` |
|
||||||
|
| `SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DEFAULT` | Default weight value for scheduler recv skipper counter (used when forward mode doesn't match specific modes). Only active when `--scheduler-recv-interval > 1`. The counter accumulates weights and triggers request polling when reaching the interval threshold. | `1000` |
|
||||||
|
| `SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DECODE` | Weight increment for decode forward mode in scheduler recv skipper. Works with `--scheduler-recv-interval` to control polling frequency during decode phase. | `1` |
|
||||||
|
| `SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_VERIFY` | Weight increment for target verify forward mode in scheduler recv skipper. Works with `--scheduler-recv-interval` to control polling frequency during verification phase. | `1` |
|
||||||
|
| `SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_NONE` | Weight increment when forward mode is None in scheduler recv skipper. Works with `--scheduler-recv-interval` to control polling frequency when no specific forward mode is active. | `1` |
|
||||||
|
|
||||||
|
|
||||||
## DeepGEMM Configuration (Advanced Optimization)
|
## DeepGEMM Configuration (Advanced Optimization)
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,13 @@ class Envs:
|
|||||||
SGLANG_RETRACT_DECODE_STEPS = EnvInt(20)
|
SGLANG_RETRACT_DECODE_STEPS = EnvInt(20)
|
||||||
SGLANG_CLIP_MAX_NEW_TOKENS_ESTIMATION = EnvInt(4096)
|
SGLANG_CLIP_MAX_NEW_TOKENS_ESTIMATION = EnvInt(4096)
|
||||||
|
|
||||||
|
# Scheduler: recv interval
|
||||||
|
SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DEFAULT = EnvInt(1000)
|
||||||
|
SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DECODE = EnvInt(1)
|
||||||
|
SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_TARGET_VERIFY = EnvInt(1)
|
||||||
|
SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_NONE = EnvInt(1)
|
||||||
|
|
||||||
|
|
||||||
# Scheduler: others:
|
# Scheduler: others:
|
||||||
SGLANG_EMPTY_CACHE_INTERVAL = EnvFloat(-1) # in seconds. Set if you observe high memory accumulation over a long serving period.
|
SGLANG_EMPTY_CACHE_INTERVAL = EnvFloat(-1) # in seconds. Set if you observe high memory accumulation over a long serving period.
|
||||||
SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP = EnvBool(False)
|
SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP = EnvBool(False)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from sglang.srt.environ import envs
|
||||||
from sglang.srt.model_executor.forward_batch_info import ForwardMode
|
from sglang.srt.model_executor.forward_batch_info import ForwardMode
|
||||||
from sglang.srt.server_args import ServerArgs
|
from sglang.srt.server_args import ServerArgs
|
||||||
|
|
||||||
@@ -14,11 +15,20 @@ class SchedulerRecvSkipper:
|
|||||||
assert not server_args.enable_dp_attention
|
assert not server_args.enable_dp_attention
|
||||||
self._counter = 0
|
self._counter = 0
|
||||||
self._threshold = server_args.scheduler_recv_interval
|
self._threshold = server_args.scheduler_recv_interval
|
||||||
|
# All can be tuned if needed
|
||||||
|
self._default_weight = envs.SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DEFAULT.get()
|
||||||
|
self._weight_of_forward_mode = {
|
||||||
|
ForwardMode.DECODE: envs.SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_DECODE.get(),
|
||||||
|
ForwardMode.TARGET_VERIFY: envs.SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_TARGET_VERIFY.get(),
|
||||||
|
None: envs.SGLANG_SCHEDULER_RECV_SKIPPER_WEIGHT_NONE.get(),
|
||||||
|
}
|
||||||
|
|
||||||
def handle(self, last_forward_mode: ForwardMode):
|
def handle(self, last_forward_mode: ForwardMode):
|
||||||
should_recv = False
|
should_recv = False
|
||||||
|
|
||||||
last_weight = _WEIGHT_OF_FORWARD_MODE.get(last_forward_mode, _DEFAULT_WEIGHT)
|
last_weight = self._weight_of_forward_mode.get(
|
||||||
|
last_forward_mode, self._default_weight
|
||||||
|
)
|
||||||
self._counter += last_weight
|
self._counter += last_weight
|
||||||
|
|
||||||
if self._counter >= self._threshold:
|
if self._counter >= self._threshold:
|
||||||
@@ -26,12 +36,3 @@ class SchedulerRecvSkipper:
|
|||||||
should_recv = True
|
should_recv = True
|
||||||
|
|
||||||
return should_recv
|
return should_recv
|
||||||
|
|
||||||
|
|
||||||
# All can be tuned if needed
|
|
||||||
_DEFAULT_WEIGHT = 1000
|
|
||||||
_WEIGHT_OF_FORWARD_MODE = {
|
|
||||||
ForwardMode.DECODE: 1,
|
|
||||||
ForwardMode.TARGET_VERIFY: 1,
|
|
||||||
None: 1,
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user