[Piecewise Cuda Graph] rename, refactor and add more logging (#13675)
Co-authored-by: Minglei Zhu <mingleizhu1122@gmail.com> Co-authored-by: Ke Bao <ISPObaoke@163.com> Co-authored-by: Oasis-Git <ayw.sirius19@gmail.com>
This commit is contained in:
co-authored by
Minglei Zhu
Ke Bao
Oasis-Git
parent
475962a139
commit
d754ce973e
@@ -20,6 +20,7 @@ from sglang.srt.compilation.compilation_counter import compilation_counter
|
||||
from sglang.srt.compilation.compiler_interface import EagerAdapter, InductorAdaptor
|
||||
from sglang.srt.compilation.cuda_piecewise_backend import CUDAPiecewiseBackend
|
||||
from sglang.srt.compilation.pass_manager import PostGradPassManager
|
||||
from sglang.srt.utils.common import rank0_log
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -357,6 +358,7 @@ class SGLangBackend:
|
||||
config: CompilationConfig,
|
||||
graph_pool: Any,
|
||||
):
|
||||
rank0_log(f"Initializing SGLangBackend")
|
||||
assert graph_pool is not None
|
||||
self.graph_pool = graph_pool
|
||||
|
||||
@@ -375,6 +377,7 @@ class SGLangBackend:
|
||||
self.inductor_config["post_grad_custom_post_pass"] = self.post_grad_pass_manager
|
||||
|
||||
def __call__(self, graph: fx.GraphModule, example_inputs) -> Callable:
|
||||
rank0_log(f"SGLangBackend __call__")
|
||||
base_cache_dir = os.path.expanduser(
|
||||
os.getenv("SGLANG_CACHE_DIR", "~/.cache/sglang/")
|
||||
)
|
||||
@@ -441,7 +444,7 @@ class SGLangBackend:
|
||||
with open(graph_path, "w") as f:
|
||||
f.write(src)
|
||||
|
||||
logger.debug("Computation graph saved to %s", graph_path)
|
||||
rank0_log(f"Computation graph saved to {graph_path}")
|
||||
|
||||
self._called = True
|
||||
return self.split_gm
|
||||
|
||||
@@ -11,6 +11,7 @@ from typing import Any, Callable, Optional, Union
|
||||
import torch
|
||||
|
||||
from sglang.srt.compilation.compilation_config import CompilationConfig
|
||||
from sglang.srt.utils.common import rank0_log
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -129,6 +130,7 @@ def install_torch_compiled(
|
||||
fullgraph: bool = True,
|
||||
graph_pool: Any = None,
|
||||
):
|
||||
rank0_log(f"install_torch_compiled")
|
||||
unbound_fwd = module.__class__.forward
|
||||
if not callable(unbound_fwd):
|
||||
raise TypeError("module.__class__.forward must be callable")
|
||||
|
||||
Reference in New Issue
Block a user