pytorch/torch/_dynamo
Edward Z. Yang bca696ae81 Switch times to us in CompilationMetrics and improvements (#138975)
Companion logger diff: https://www.internalfb.com/diff/D65012523

* Using float seconds for timestamps is bad because our internal system defaults to float32 precision and you don't even get second precision for timestamps in float32
* We decide to use microseconds instead of milliseconds because millisecond granularity you can end up with the same timestamp if compilation is happening very quickly; much better to force non-overlapping spans
* Because there are so many new fields and I don't feel like reimplementing each on BwdCompilationMetrics, BwdCompilationMetrics is no more, it's just that everything in CompilationMetrics is now optional.
* The actual frame compile times collection is not modified (still float) to reduce blast radius, so I just convert to microseconds before making the record. At float64 precision (Python's default), you get about microsecond precision on timestamps so shouldn't be a data problem (https://www.leebutterman.com/2021/02/01/store-your-unix-epoch-times-as-float64.html)
* I rename some entries for clarity. In particular, whenever a timing contains all of the its lower phases (e.g., how Inductor also contains Triton compilation) we put "cumulative" in its name.  If something doesn't happen at compile time but is delayed until we have actual real inputs, we put "runtime" in its name.

Test plan:

```
buck2 run @mode/opt @mode/inplace //scripts/oulgen:runner
```

And then inspect https://fburl.com/scuba/dynamo_compile/sandbox/mslu7f5w and verify the us columns are populated and meaningful.

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/138975
Approved by: https://github.com/masnesral
2024-10-28 17:17:18 +00:00
..
backends Made DDPOptimizer work with HOPs (#138787) 2024-10-25 18:59:01 +00:00
polyfills [Dynamo] Trace enter/exit of TorchFunctionModes (#135422) (#137114) 2024-10-09 02:29:40 +00:00
repro Add option to save real tensors in TORCH_COMPILE_DEBUG repro (#138110) 2024-10-28 16:18:22 +00:00
variables [Dynamo] Refactor wrap_fx_proxy (#138933) 2024-10-28 08:05:33 +00:00
__init__.py Make automatic_dynamic state live per CodeId, rather than on code object (#138740) 2024-10-27 03:08:41 +00:00
_trace_wrapped_higher_order_op.py [FlexAttention] Support training bias for eager (#136910) (#137526) 2024-10-15 18:55:22 +00:00
bytecode_analysis.py
bytecode_transformation.py [dynamo, 3.13] fix typo in remove_fused_load_store (#137652) 2024-10-10 19:53:42 +00:00
cache_size.py [dynamo][refactor][config-cleanp] Use guard_manager consistently instead of check_fn (#138896) 2024-10-26 15:14:46 +00:00
callback.py turn CompilationCallbackHandler into dataclass (#137312) 2024-10-05 19:03:28 +00:00
code_context.py
codegen.py Have as_tensor always return a float64 tensor in dynamo (#138598) 2024-10-24 20:50:28 +00:00
compiled_autograd.py [compiled autograd] tls access helpers (#138061) 2024-10-22 08:03:52 +00:00
comptime.py
config.py [dynamo][config-cleanup] Remove enable_cpp_guard_manager=False codepath (#138512) 2024-10-25 16:41:55 +00:00
convert_frame.py Switch times to us in CompilationMetrics and improvements (#138975) 2024-10-28 17:17:18 +00:00
create_parameter_op.py type _dynamo/create_parameter_op.py (#136958) 2024-10-02 10:23:37 +00:00
current_scope_id.py
debug_utils.py [logging/debugging] handle None (constant) args in debug log (#137032) 2024-10-02 01:43:22 +00:00
decorators.py [dynamo] add torch.compiler.set_stance (#137504) 2024-10-16 16:18:25 +00:00
device_interface.py Have Triton custom extension test use privateuseone device (#137611) 2024-10-11 21:27:29 +00:00
distributed.py
eval_frame.py [pytorch] Plumb compile context from dynamo.export to aot_compile (#138793) 2024-10-28 17:07:44 +00:00
exc.py [tlparse] Add dynamo_graph_break_reason logging to trace_structured (#138778) 2024-10-25 02:00:04 +00:00
external_utils.py type _dynamo/external_utils.py (#137185) 2024-10-03 15:18:53 +00:00
funcname_cache.py
guards.py [dynamo][guards] Log average time of constructed guard_manager (#138941) 2024-10-26 15:14:46 +00:00
hooks.py
logging.py Make automatic_dynamic state live per CodeId, rather than on code object (#138740) 2024-10-27 03:08:41 +00:00
mutation_guard.py Allow Lazy Module to be modelled as UnspecializedNNModuleVariable (#138639) 2024-10-26 02:17:07 +00:00
output_graph.py [pytorch] Plumb compile context from dynamo.export to aot_compile (#138793) 2024-10-28 17:07:44 +00:00
pgo.py Make automatic_dynamic state live per CodeId, rather than on code object (#138740) 2024-10-27 03:08:41 +00:00
profiler.py type _dynamo/profiler.py (#137351) 2024-10-07 18:54:33 +00:00
replay_record.py type _dynamo/replay_record.py (#137183) 2024-10-04 20:29:24 +00:00
resume_execution.py [Dynamo] Trace enter/exit of TorchFunctionModes (#135422) (#137114) 2024-10-09 02:29:40 +00:00
side_effects.py [dynamo] Remove mutable_local.source and index on VariableTracker rather than MutableLocalBase (#137905) 2024-10-18 20:20:42 +00:00
source.py [Dynamo] Disable torch function compilation during guard execution and in compiled bytecode (#137669) 2024-10-19 04:12:45 +00:00
symbolic_convert.py Refactor core algorithm for automatic dynamic shapes (#138717) 2024-10-27 03:08:41 +00:00
tensor_version_op.py
test_case.py
test_minifier_common.py config: simplify most of the config handling and fix some bugs (#138377) 2024-10-22 13:40:26 +00:00
testing.py [dynamo][refactor][config-cleanp] Use guard_manager consistently instead of check_fn (#138896) 2024-10-26 15:14:46 +00:00
trace_rules.py Add sym_sum to TorchInGraphFunctionVariable (#138848) 2024-10-27 20:04:35 +00:00
types.py [dynamo][refactor][config-cleanp] Use guard_manager consistently instead of check_fn (#138896) 2024-10-26 15:14:46 +00:00
utils.py Switch times to us in CompilationMetrics and improvements (#138975) 2024-10-28 17:17:18 +00:00