Skip to content

Commit 20ff4c2

Browse files
tarun292facebook-github-bot
authored andcommitted
Add option to disable operator profiling (#136838)
Summary: X-link: pytorch/executorch#5720 For smaller models the overhead of profiling ops might be prohibitively large (distorting the inference execution time significantly) so we provide users an option to disable op profiling and essentially only profile the important events such as inference execution time. To disable operator profiling users need to do: ``` etdump_gen.set_event_tracer_profiling_level(executorch::runtime::EventTracerProfilingLevel::kNoOperatorProfiling); ``` Test Plan: Added test case. Differential Revision: D61883224
1 parent 8765804 commit 20ff4c2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tools/test/test_executorch_gen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def test_codegen_unboxed_specialized(self) -> None:
503503
"""
504504
+ """
505505
506-
internal::EventTracerProfileScope event_tracer_scope(context.internal_event_tracer(), "native_call_op_1");
506+
internal::EventTracerProfileOpScope event_tracer_op_scope(context.internal_event_tracer(), "native_call_op_1");
507507
EXECUTORCH_SCOPE_PROF("native_call_op_1");
508508
bool result_ = at::native::default_kernel(context, );
509509
internal::event_tracer_log_evalue(context.internal_event_tracer(), *stack[0]);
@@ -590,7 +590,7 @@ def test_codegen_unboxed_default(self) -> None:
590590
"""
591591
+ """
592592
593-
internal::EventTracerProfileScope event_tracer_scope(context.internal_event_tracer(), "native_call_op_1");
593+
internal::EventTracerProfileOpScope event_tracer_op_scope(context.internal_event_tracer(), "native_call_op_1");
594594
EXECUTORCH_SCOPE_PROF("native_call_op_1");
595595
bool result_ = at::native::default_kernel(context, );
596596
internal::event_tracer_log_evalue(context.internal_event_tracer(), *stack[0]);
@@ -626,7 +626,7 @@ def test_codegen_unboxed_default_kernel_key_selected(self) -> None:
626626
"""
627627
+ """
628628
629-
internal::EventTracerProfileScope event_tracer_scope(context.internal_event_tracer(), "native_call_op_1");
629+
internal::EventTracerProfileOpScope event_tracer_op_scope(context.internal_event_tracer(), "native_call_op_1");
630630
EXECUTORCH_SCOPE_PROF("native_call_op_1");
631631
bool result_ = at::native::default_kernel(context, );
632632
internal::event_tracer_log_evalue(context.internal_event_tracer(), *stack[0]);

torchgen/gen_executorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def __call__(
271271
[]({contextArg.defn()}, EValue** stack) {{
272272
{code_connector.join(code_list)}
273273
274-
internal::EventTracerProfileScope event_tracer_scope(context.internal_event_tracer(), "native_call_{f.func.name}");
274+
internal::EventTracerProfileOpScope event_tracer_op_scope(context.internal_event_tracer(), "native_call_{f.func.name}");
275275
EXECUTORCH_SCOPE_PROF("native_call_{f.func.name}");
276276
{ret_prefix}{kernel_call}(context, {args_str});
277277
{event_tracer_output_logging}

0 commit comments

Comments
 (0)