Skip to content

Commit e96a735

Browse files
fzyzcjyispobock
authored andcommitted
Fix DeepSeek DP Attention + torch compile (sgl-project#5367)
Co-authored-by: ispobock <[email protected]>
1 parent a5b7ba1 commit e96a735

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

python/sglang/srt/layers/dp_attention.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ def _dp_gather(
192192

193193
if local_tokens.shape[0] > 0 and (is_partial or get_attention_tp_rank() == 0):
194194
assert (
195-
global_tokens.untyped_storage().data_ptr()
196-
!= local_tokens.untyped_storage().data_ptr()
195+
local_tokens.untyped_storage() is not global_tokens.untyped_storage()
197196
), "aliasing between global_tokens and local_tokens not allowed"
198197
memcpy_triton(
199198
global_tokens, local_tokens, 0, local_start_pos, local_num_tokens, False
@@ -243,8 +242,7 @@ def dp_scatter(
243242
assert global_tokens.is_contiguous()
244243
if local_tokens.shape[0] > 0:
245244
assert (
246-
local_tokens.untyped_storage().data_ptr()
247-
!= global_tokens.untyped_storage().data_ptr()
245+
local_tokens.untyped_storage() is not global_tokens.untyped_storage()
248246
), "aliasing between local_tokens and global_tokens not allowed"
249247
memcpy_triton(
250248
local_tokens, global_tokens, 0, local_start_pos, local_num_tokens, True

test/srt/parse_results.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import json
2-
import pandas as pd
31
import argparse
2+
import json
43
import os
4+
5+
import pandas as pd
56
from tabulate import tabulate
67

78
# Parse command-line arguments

test/srt/test_dp_attention.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def setUpClass(cls):
2828
"--enable-dp-attention",
2929
"--dp",
3030
"2",
31+
"--enable-torch-compile",
32+
"--torch-compile-max-bs",
33+
"2",
3134
],
3235
)
3336

0 commit comments

Comments
 (0)