Fix the deadlock in multi-node tp (#1122)

This commit is contained in:
Lianmin Zheng
2024-08-16 01:39:24 -07:00
committed by GitHub
parent 6aa8ad14f8
commit 5a261bd055
7 changed files with 54 additions and 16 deletions

View File

@@ -142,7 +142,7 @@ class CudaGraphRunner:
set_torch_compile_config()
def can_run(self, batch_size):
return batch_size < self.max_bs
return batch_size <= self.max_bs
def capture(self, batch_size_list):
self.batch_size_list = batch_size_list
@@ -239,12 +239,23 @@ class CudaGraphRunner:
return forward(input_ids, input_metadata.positions, input_metadata)
for _ in range(2):
torch.cuda.synchronize()
self.model_runner.tp_group.barrier()
run_once()
torch.cuda.synchronize()
self.model_runner.tp_group.barrier()
torch.cuda.synchronize()
self.model_runner.tp_group.barrier()
with torch.cuda.graph(graph, pool=self.graph_memory_pool, stream=stream):
out = run_once()
torch.cuda.synchronize()
self.model_runner.tp_group.barrier()
self.graph_memory_pool = graph.pool()
return graph, None, out, flashinfer_decode_wrapper
@@ -278,7 +289,9 @@ class CudaGraphRunner:
)
# Replay
torch.cuda.synchronize()
self.graphs[bs].replay()
torch.cuda.synchronize()
output = self.output_buffers[bs]
# Unpad