Skip to content

Commit

Permalink
rename sl to strobelight (#124455)
Browse files Browse the repository at this point in the history
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: #124455
Approved by: https://github.com/oulgen
  • Loading branch information
laithsakka authored and pytorchmergebot committed Apr 19, 2024
1 parent 0feab7d commit acbf888
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions torch/_dynamo/convert_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import torch._logging
from torch._guards import compile_context, CompileContext, CompileId, tracing
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 (
ConstraintViolationError,
GuardOnDataDependentSymNode,
Expand Down Expand Up @@ -452,7 +452,7 @@ def register_bytecode_hook(hook: BytecodeHook) -> RemovableHandle:
return handle


@compiletime_sl_profile_meta(phase_name="_compile")
@compiletime_strobelight_meta(phase_name="_compile")
@_use_lazy_graph_module(config.use_lazy_graph_module)
@maybe_cprofile
def _compile(
Expand Down
4 changes: 2 additions & 2 deletions torch/_inductor/compile_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from torch._logging import trace_structured
from torch._ops import OpOverload
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.passes.fake_tensor_prop import FakeTensorProp

Expand Down Expand Up @@ -1349,7 +1349,7 @@ def partition_fn(graph, joint_inputs, **kwargs):
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.maybe_cprofile
def bw_compiler(model: torch.fx.GraphModule, example_inputs: List[torch.Tensor]):
Expand Down
6 changes: 3 additions & 3 deletions torch/_utils_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def throw_abstract_impl_not_imported_error(opname, module, context):


# Meta only, act as nop otherwise.
def compiletime_sl_profile_meta(phase_name):
def compiletime_sl_profile_inner(function):
def compiletime_strobelight_meta(phase_name):
def compiletime_strobelight_meta_inner(function):
@functools.wraps(function)
def wrapper_function(*args, **kwargs):
return function(*args, **kwargs)

return wrapper_function

return compiletime_sl_profile_inner
return compiletime_strobelight_meta_inner


# Meta only, see
Expand Down

0 comments on commit acbf888

Please sign in to comment.