rename sl to strobelight (#124455)

Summary:
TORCH_COMPILE_SL_PROFILE ->TORCH_COMPILE_STROBELIGHT
SL_MAX_STACK_LENGTH -> COMPILE_STROBELIGHT_MAX_STACK_LENGTH
SL_MAX_PROFILE_TIME -> COMPILE_STROBELIGHT_MAX_PROFILE_TIME
profile_with_sl() -> strobelight()
compiletime_sl_profile_meta() -> compiletime_strobelight_meta()

Test Plan:
1. run and verify
```
TORCH_COMPILE_STROBELIGHT=TRUE buck2 run  @//mode/inplace  @//mode/opt  //caffe2/fb/strobelight:compiletime_profiler_example
```
2. run and verify
```
buck2 run  @//mode/inplace  @//mode/opt  //caffe2/fb/strobelight:function_profiler_example --local-only
```
3. run and verify truncated stack for
```
TORCH_COMPILE_STROBELIGHT=TRUE COMPILE_STROBELIGHT_MAX_STACK_LENGTH=1 buck2 run  @//mode/inplace  @//mode/opt  //caffe2/fb/strobelight:compiletime_profiler_example
```
4. add infinite loop in _verify and verify samples for
```
COMPILE_STROBELIGHT_MAX_PROFILE_TIME=30 TORCH_COMPILE_STROBELIGHT=TRUE buck2 run  @//mode/inplace  @//mode/opt  //caffe2/fb/strobelight:compiletime_profiler_example
```

Reviewed By: oulgen

Differential Revision: D56327139

Pull Request resolved: https://github.com/pytorch/pytorch/pull/124455
Approved by: https://github.com/oulgen
This commit is contained in:
Laith Sakka 2024-04-19 22:50:13 +00:00 committed by PyTorch MergeBot
parent 0feab7d6c3
commit acbf888a13
3 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ import torch
import torch._logging import torch._logging
from torch._guards import compile_context, CompileContext, CompileId, tracing from torch._guards import compile_context, CompileContext, CompileId, tracing
from torch._logging import structured from torch._logging import structured
from torch._utils_internal import compiletime_sl_profile_meta, signpost_event from torch._utils_internal import compiletime_strobelight_meta, signpost_event
from torch.fx.experimental.symbolic_shapes import ( from torch.fx.experimental.symbolic_shapes import (
ConstraintViolationError, ConstraintViolationError,
GuardOnDataDependentSymNode, GuardOnDataDependentSymNode,
@ -452,7 +452,7 @@ def register_bytecode_hook(hook: BytecodeHook) -> RemovableHandle:
return handle return handle
@compiletime_sl_profile_meta(phase_name="_compile") @compiletime_strobelight_meta(phase_name="_compile")
@_use_lazy_graph_module(config.use_lazy_graph_module) @_use_lazy_graph_module(config.use_lazy_graph_module)
@maybe_cprofile @maybe_cprofile
def _compile( def _compile(

View File

@ -36,7 +36,7 @@ from torch._inductor.utils import BoxedBool, count_tangents
from torch._logging import trace_structured from torch._logging import trace_structured
from torch._ops import OpOverload from torch._ops import OpOverload
from torch._subclasses.fake_tensor import FakeTensor from torch._subclasses.fake_tensor import FakeTensor
from torch._utils_internal import compiletime_sl_profile_meta from torch._utils_internal import compiletime_strobelight_meta
from torch.fx.experimental.symbolic_shapes import free_unbacked_symbols from torch.fx.experimental.symbolic_shapes import free_unbacked_symbols
from torch.fx.passes.fake_tensor_prop import FakeTensorProp from torch.fx.passes.fake_tensor_prop import FakeTensorProp
@ -1349,7 +1349,7 @@ def compile_fx(
graph, joint_inputs, **kwargs, compiler="inductor" graph, joint_inputs, **kwargs, compiler="inductor"
) )
@compiletime_sl_profile_meta(phase_name="bw_compiler") @compiletime_strobelight_meta(phase_name="bw_compiler")
@dynamo_utils.dynamo_timed @dynamo_utils.dynamo_timed
@dynamo_utils.maybe_cprofile @dynamo_utils.maybe_cprofile
def bw_compiler(model: torch.fx.GraphModule, example_inputs: List[torch.Tensor]): def bw_compiler(model: torch.fx.GraphModule, example_inputs: List[torch.Tensor]):

View File

@ -63,15 +63,15 @@ def throw_abstract_impl_not_imported_error(opname, module, context):
# Meta only, act as nop otherwise. # Meta only, act as nop otherwise.
def compiletime_sl_profile_meta(phase_name): def compiletime_strobelight_meta(phase_name):
def compiletime_sl_profile_inner(function): def compiletime_strobelight_meta_inner(function):
@functools.wraps(function) @functools.wraps(function)
def wrapper_function(*args, **kwargs): def wrapper_function(*args, **kwargs):
return function(*args, **kwargs) return function(*args, **kwargs)
return wrapper_function return wrapper_function
return compiletime_sl_profile_inner return compiletime_strobelight_meta_inner
# Meta only, see # Meta only, see