Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][Distributed] remove graph mode function #4818

Merged
merged 6 commits into from
May 16, 2024

Conversation

youkaichao
Copy link
Member

Users only need to use with graph_capture() to manage the context when they capture the graph, before the graph can be replayed.

Inside the capture, we need to turn on graph mode. Outside the capture, there is no need to call graph mode.

Therefore, these two functions can be merged into one.

@@ -103,7 +103,7 @@ def multiple_tp_with_vllm_worker_fn():
device = torch.device(f"cuda:{torch.distributed.get_rank()}")
ensure_model_parallel_initialized(2, 2)
tensor = torch.ones(16, 1024, 1024, dtype=torch.float32, device=device)
with graph_mode():
with graph_capture():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, how do we make sure it's not using custom all reduce?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, even before this PR, we cannot make sure it's not using custom all reduce. It is true in CI because our CI does not have custom allreduce.

To solve this problem, another refactor is needed. We need to expose a new function to create tp groups with different communicators. That's my next PR to come!

vllm/worker/model_runner.py Outdated Show resolved Hide resolved
vllm/worker/model_runner.py Outdated Show resolved Hide resolved
Comment on lines +17 to +19
@dataclass
class GraphCaptureContext:
stream: torch.cuda.Stream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work for non-CUDA backends?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For XPU, this will be torch.xpu.Stream .

Copy link
Collaborator

@WoosukKwon WoosukKwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for addressing my comments!

@youkaichao youkaichao merged commit e081880 into vllm-project:main May 16, 2024
17 of 18 checks passed
@youkaichao youkaichao deleted the graph branch May 17, 2024 00:48
dtrifiro pushed a commit to dtrifiro/vllm that referenced this pull request May 21, 2024
tybalex pushed a commit to tybalex/vllm-function-call that referenced this pull request May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants