[ROCm][Bugfix] Reduce CUDA graph divergences (#57229)
Signed-off-by: Matthew Wong <Matthew.Wong2@amd.com>
This commit is contained in:
@@ -1632,10 +1632,7 @@ def get_pcp_group() -> GroupCoordinator:
|
||||
|
||||
|
||||
@contextmanager
|
||||
def graph_capture(
|
||||
device: torch.device,
|
||||
graph_capture_context: GraphCaptureContext | None = None,
|
||||
):
|
||||
def graph_capture(device: torch.device):
|
||||
"""`graph_capture` is a context manager which should surround the code that
|
||||
is capturing the CUDA graph. Its main purpose is to ensure that some
|
||||
operations will be run after the graph is captured, before the graph
|
||||
@@ -1647,13 +1644,8 @@ def graph_capture(
|
||||
the graph capture is running on a separate stream from the default stream,
|
||||
in order to explicitly distinguish the kernels to capture
|
||||
from other kernels possibly launched on background in the default stream.
|
||||
|
||||
A caller may pass an explicit ``graph_capture_context`` to control the
|
||||
stream used (e.g. to capture on the default stream).
|
||||
"""
|
||||
context = graph_capture_context or GraphCaptureContext(
|
||||
torch.cuda.Stream(device=device)
|
||||
)
|
||||
context = GraphCaptureContext(torch.cuda.Stream(device=device))
|
||||
with (
|
||||
get_tp_group().graph_capture(context),
|
||||
get_pp_group().graph_capture(context),
|
||||
|
||||
Reference in New Issue
Block a user