diff --git a/mediapipe/calculators/tensor/inference_calculator_gl_advanced.cc b/mediapipe/calculators/tensor/inference_calculator_gl_advanced.cc index 8fd55efa7..8aee46185 100644 --- a/mediapipe/calculators/tensor/inference_calculator_gl_advanced.cc +++ b/mediapipe/calculators/tensor/inference_calculator_gl_advanced.cc @@ -141,7 +141,7 @@ InferenceCalculatorGlAdvancedImpl::GpuInferenceRunner::Process( } // Run inference. { - MEDIAPIPE_PROFILING(GPU_TASK_INVOKE, cc); + MEDIAPIPE_PROFILING(GPU_TASK_INVOKE_ADVANCED, cc); return tflite_gpu_runner_->Invoke(); } })); diff --git a/mediapipe/framework/calculator_profile.proto b/mediapipe/framework/calculator_profile.proto index d86162ea5..0b5498c4e 100644 --- a/mediapipe/framework/calculator_profile.proto +++ b/mediapipe/framework/calculator_profile.proto @@ -136,6 +136,8 @@ message GraphTrace { GPU_TASK_INVOKE = 16; TPU_TASK_INVOKE = 17; CPU_TASK_INVOKE = 18; + GPU_TASK_INVOKE_ADVANCED = 19; + TPU_TASK_INVOKE_ASYNC = 20; } // The timing for one packet set being processed at one caclulator node. diff --git a/mediapipe/framework/profiler/trace_buffer.h b/mediapipe/framework/profiler/trace_buffer.h index b44d8f0bf..b5e2d9994 100644 --- a/mediapipe/framework/profiler/trace_buffer.h +++ b/mediapipe/framework/profiler/trace_buffer.h @@ -112,6 +112,10 @@ struct TraceEvent { static constexpr EventType GPU_TASK_INVOKE = GraphTrace::GPU_TASK_INVOKE; static constexpr EventType TPU_TASK_INVOKE = GraphTrace::TPU_TASK_INVOKE; static constexpr EventType CPU_TASK_INVOKE = GraphTrace::CPU_TASK_INVOKE; + static constexpr EventType GPU_TASK_INVOKE_ADVANCED = + GraphTrace::GPU_TASK_INVOKE_ADVANCED; + static constexpr EventType TPU_TASK_INVOKE_ASYNC = + GraphTrace::TPU_TASK_INVOKE_ASYNC; }; // Packet trace log buffer. diff --git a/mediapipe/framework/profiler/trace_builder.cc b/mediapipe/framework/profiler/trace_builder.cc index ce5bf1e25..9c3661ffe 100644 --- a/mediapipe/framework/profiler/trace_builder.cc +++ b/mediapipe/framework/profiler/trace_builder.cc @@ -57,7 +57,6 @@ struct hash { namespace mediapipe { namespace { - void BasicTraceEventTypes(TraceEventRegistry* result) { // The initializer arguments below are: event_type, description, // is_packet_event, is_stream_event, id_event_data. @@ -84,6 +83,15 @@ void BasicTraceEventTypes(TraceEventRegistry* result) { "A time measured by GPU clock and by CPU clock.", true, false}, {TraceEvent::PACKET_QUEUED, "An input queue size when a packet arrives.", true, true, false}, + + {TraceEvent::GPU_TASK_INVOKE, "CPU timing for initiating a GPU task."}, + {TraceEvent::TPU_TASK_INVOKE, "CPU timing for initiating a TPU task."}, + {TraceEvent::CPU_TASK_INVOKE, "CPU timing for initiating a CPU task."}, + {TraceEvent::GPU_TASK_INVOKE_ADVANCED, + "CPU timing for initiating a GPU task bypassing the TFLite " + "interpreter."}, + {TraceEvent::TPU_TASK_INVOKE_ASYNC, + "CPU timing for async initiation of a TPU task."}, }; for (const TraceEventType& t : basic_types) { (*result)[t.event_type()] = t;