dsv4.1: Top-k kernels and candidate selection (#39648)
Co-authored-by: BBuf <1182563586@qq.com> Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: DarkSharpness <2040703891@qq.com> Co-authored-by: DarkSharpness <76582120+DarkSharpness@users.noreply.github.com> Co-authored-by: Ke Bao <ispobaoke@gmail.com> Co-authored-by: Khoa Pham <khoa.pham@radixark.ai> Co-authored-by: Xiaoyu Zhang <1182563586@qq.com> Co-authored-by: Xiaoyu Zhang <xiaoyu.zhang@radixark.ai> Co-authored-by: Yuhao Yang <47235274+yhyang201@users.noreply.github.com> Co-authored-by: Yuwei An <ayw.sirius19@gmail.com> Co-authored-by: Zhichen Zeng <zczeng@uw.edu> Co-authored-by: Ziyi Xu <ziyi.xu@radixark.ai>
This commit is contained in:
co-authored by
BBuf
Cheng Wan
Claude Opus 5
Cursor
DarkSharpness
DarkSharpness
Ke Bao
Khoa Pham
Xiaoyu Zhang
Yuhao Yang
Yuwei An
Zhichen Zeng
Ziyi Xu
parent
a64be2e430
commit
faaff1eca8
@@ -5,6 +5,7 @@ from types import SimpleNamespace
|
||||
|
||||
import torch
|
||||
|
||||
from sglang.kernels.ops.attention.dsv4.topk import topk_v2_plan_is_written
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.layers.attention.dsa.dsa_topk_backend import DSATopKBackend
|
||||
from sglang.srt.layers.attention.dsa_backend import DeepseekSparseAttnBackend
|
||||
@@ -101,6 +102,8 @@ def assert_metadata_equal(test, actual, expected):
|
||||
for name, value in actual_buffers.items():
|
||||
reference = expected_buffers[name]
|
||||
if name == "topk_v2_plan":
|
||||
if not topk_v2_plan_is_written(expected.dsa_seqlens_expanded):
|
||||
continue
|
||||
# Unused plan rows are intentionally uninitialized. Active rows are
|
||||
# compacted by atomicAdd, so compare them in request order.
|
||||
torch.testing.assert_close(value[0], reference[0])
|
||||
|
||||
Reference in New Issue
Block a user