[Profiler] Add SGLANG_PROFILE_RECORD_SHAPES for recording shapes when profiling (#11641)

Signed-off-by: zejunchen-zejun <zejun.chen@amd.com>
Co-authored-by: HAI <hixiao@gmail.com>
This commit is contained in:
zejunchen-zejun
2025-11-05 15:41:46 +08:00
committed by GitHub
parent b88fab3111
commit 0648eb482d
3 changed files with 6 additions and 0 deletions

View File

@@ -136,6 +136,7 @@ class Envs:
SGLANG_IS_IN_CI_AMD = EnvBool(False)
SGLANG_SET_CPU_AFFINITY = EnvBool(False)
SGLANG_PROFILE_WITH_STACK = EnvBool(True)
SGLANG_PROFILE_RECORD_SHAPES = EnvBool(True)
SGLANG_RECORD_STEP_TIME = EnvBool(False)
SGLANG_FORCE_SHUTDOWN = EnvBool(False)
SGLANG_DEBUG_MEMORY_POOL = EnvBool(False)

View File

@@ -319,6 +319,10 @@ class TokenizerCommunicatorMixin:
self.auto_create_handle_loop()
env_with_stack: bool = get_bool_env_var("SGLANG_PROFILE_WITH_STACK", "true")
with_stack = False if with_stack is False or env_with_stack is False else True
env_record_shapes: bool = get_bool_env_var(
"SGLANG_PROFILE_RECORD_SHAPES", "true"
)
record_shapes = (record_shapes is not False) and env_record_shapes
req = ProfileReq(
type=ProfileReqType.START_PROFILE,
output_dir=output_dir,