From 3d5f4d4cd5d86788151664597bcebea666c34700 Mon Sep 17 00:00:00 2001 From: Giancarlo Delfin <32987265+TheEpicDolphin@users.noreply.github.com> Date: Mon, 28 Sep 2026 13:46:25 -0700 Subject: [PATCH] [Perf][Spec Decode] Avoid triton recompiles in the acceptance estimator (#57107) Signed-off-by: Giancarlo Delfin Co-authored-by: Woosuk Kwon --- vllm/v1/worker/gpu/spec_decode/acceptance_estimator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vllm/v1/worker/gpu/spec_decode/acceptance_estimator.py b/vllm/v1/worker/gpu/spec_decode/acceptance_estimator.py index 46065d0546..f7a4a2f2c1 100644 --- a/vllm/v1/worker/gpu/spec_decode/acceptance_estimator.py +++ b/vllm/v1/worker/gpu/spec_decode/acceptance_estimator.py @@ -20,7 +20,7 @@ _INIT_SLOPE = 0.5 _INIT_BIAS = -0.2 -@triton.jit +@triton.jit(do_not_specialize=["num_reqs"]) def _accumulate_kernel( info_ptr, grad_ptr, @@ -160,7 +160,7 @@ def _refit_kernel( tl.store(counts_ptr + k, 0.0, mask=mask) -@triton.jit +@triton.jit(do_not_specialize=["num_tokens"]) def _local_max_sumexp_kernel( local_max_ptr, local_max_stride, @@ -216,7 +216,7 @@ def _local_max_sumexp_kernel( ) -@triton.jit +@triton.jit(do_not_specialize=["num_tokens"]) def _predict_kernel( features_ptr, features_stride, @@ -422,7 +422,8 @@ class OnlineAcceptanceEstimator: self.predictions.stride(0), self.counts, num_reqs, - BLOCK_R=triton.next_power_of_2(max(num_reqs, 1)), + BLOCK_R=max(256, triton.next_power_of_2(num_reqs)), + num_warps=1 if num_reqs <= 256 else 4, ) self._steps_since_refit += 1