Skip to content

Commit 91c7594

Browse files
committed
address review comments
1 parent dfec7fc commit 91c7594

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

python/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ srt_hip = ["sglang[runtime_common]", "torch", "vllm==0.6.3.dev13"]
3131
# xpu is not enabled in public vllm and torch whl,
3232
# need to follow https://docs.vllm.ai/en/latest/getting_started/xpu-installation.htmlinstall vllm
3333
srt_xpu = ["sglang[runtime_common]"]
34+
#For Intel Gaudi(device : hpu) follow the installation guide
35+
#https://docs.vllm.ai/en/latest/getting_started/gaudi-installation.html
36+
srt_hpu = ["sglang[runtime_common]"]
3437

3538
openai = ["openai>=1.0", "tiktoken"]
3639
anthropic = ["anthropic>=0.20.0"]
@@ -46,9 +49,11 @@ test = [
4649
all = ["sglang[srt]", "sglang[openai]", "sglang[anthropic]", "sglang[litellm]"]
4750
all_hip = ["sglang[srt_hip]", "sglang[openai]", "sglang[anthropic]", "sglang[litellm]"]
4851
all_xpu = ["sglang[srt_xpu]", "sglang[openai]", "sglang[anthropic]", "sglang[litellm]"]
52+
all_hpu = ["sglang[srt_hpu]", "sglang[openai]", "sglang[anthropic]", "sglang[litellm]"]
4953
dev = ["sglang[all]", "sglang[test]"]
5054
dev_hip = ["sglang[all_hip]", "sglang[test]"]
5155
dev_xpu = ["sglang[all_xpu]", "sglang[test]"]
56+
dev_hpu = ["sglang[all_hpu]", "sglang[test]"]
5257

5358
[project.urls]
5459
"Homepage" = "https://github.com/sgl-project/sglang"

python/sglang/bench_one_batch.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,7 @@ def correctness_test(
278278

279279

280280
def synchronize(device):
281-
if device == "cuda":
282-
torch.cuda.synchronize()
283-
elif device == "xpu":
284-
torch.xpu.synchronize()
281+
torch.get_device_module(device).synchronize()
285282

286283

287284
def latency_test_run_once(

python/sglang/srt/model_executor/model_runner.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,15 @@ def __init__(
178178
def init_torch_distributed(self):
179179
logger.info("Init torch distributed begin.")
180180
# Init torch distributed
181+
torch.get_device_module(self.device).set_device(self.gpu_id)
181182
if self.device == "cuda":
182-
torch.cuda.set_device(self.gpu_id)
183183
backend = "nccl"
184184
# ToDO(liangan1):Just use gloo to bypass the initilization fail
185185
# Need to use xccl for xpu backend in the future
186186
elif self.device == "xpu":
187-
torch.xpu.set_device(self.gpu_id)
188187
backend = "gloo"
188+
elif self.device == "hpu":
189+
backend = "hccl"
189190

190191
if not self.server_args.enable_p2p_check:
191192
monkey_patch_vllm_p2p_access_check(self.gpu_id)

python/sglang/srt/server_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def add_cli_args(parser: argparse.ArgumentParser):
308308
"--device",
309309
type=str,
310310
default="cuda",
311-
choices=["cuda", "xpu"],
311+
choices=["cuda", "xpu", "hpu"],
312312
help="The device type.",
313313
)
314314
parser.add_argument(

0 commit comments

Comments
 (0)