Internal change

PiperOrigin-RevId: 514421618
This commit is contained in:
MediaPipe Team 2023-03-06 08:40:18 -08:00 committed by Copybara-Service
parent 96b2958f18
commit 6c68d4c358
9 changed files with 29 additions and 35 deletions

View File

@ -305,15 +305,16 @@ cc_library(
], ],
deps = [ deps = [
":calculator_base", ":calculator_base",
":calculator_cc_proto",
":calculator_node", ":calculator_node",
":counter_factory", ":counter_factory",
":delegating_executor", ":delegating_executor",
":mediapipe_profiling",
":executor", ":executor",
":graph_output_stream", ":graph_output_stream",
":graph_service", ":graph_service",
":graph_service_manager", ":graph_service_manager",
":input_stream_manager", ":input_stream_manager",
":mediapipe_profiling",
":output_side_packet_impl", ":output_side_packet_impl",
":output_stream", ":output_stream",
":output_stream_manager", ":output_stream_manager",
@ -321,28 +322,18 @@ cc_library(
":output_stream_shard", ":output_stream_shard",
":packet", ":packet",
":packet_generator", ":packet_generator",
":packet_generator_cc_proto",
":packet_generator_graph", ":packet_generator_graph",
":packet_set", ":packet_set",
":packet_type", ":packet_type",
":port", ":port",
":scheduler_queue", ":scheduler_queue",
":status_handler", ":status_handler",
":status_handler_cc_proto",
":thread_pool_executor", ":thread_pool_executor",
":thread_pool_executor_cc_proto",
":timestamp", ":timestamp",
":validated_graph_config", ":validated_graph_config",
":calculator_cc_proto",
":packet_generator_cc_proto",
":status_handler_cc_proto",
":thread_pool_executor_cc_proto",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/synchronization",
"//mediapipe/framework/port:core_proto", "//mediapipe/framework/port:core_proto",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging", "//mediapipe/framework/port:logging",
@ -355,13 +346,19 @@ cc_library(
"//mediapipe/framework/tool:tag_map", "//mediapipe/framework/tool:tag_map",
"//mediapipe/framework/tool:validate", "//mediapipe/framework/tool:validate",
"//mediapipe/framework/tool:validate_name", "//mediapipe/framework/tool:validate_name",
"//mediapipe/gpu:graph_support",
"//mediapipe/gpu:gpu_service", "//mediapipe/gpu:gpu_service",
"//mediapipe/gpu:graph_support",
"//mediapipe/util:cpu_util", "//mediapipe/util:cpu_util",
] + select({ "@com_google_absl//absl/base:core_headers",
"//conditions:default": ["//mediapipe/gpu:gpu_shared_data_internal"], "@com_google_absl//absl/container:fixed_array",
"//mediapipe/gpu:disable_gpu": [], "@com_google_absl//absl/container:flat_hash_map",
}), "@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/synchronization",
],
) )
cc_library( cc_library(
@ -1434,7 +1431,7 @@ cc_test(
"//mediapipe/framework/stream_handler:timestamp_align_input_stream_handler", "//mediapipe/framework/stream_handler:timestamp_align_input_stream_handler",
"//mediapipe/framework/tool:sink", "//mediapipe/framework/tool:sink",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"//mediapipe/gpu:graph_support", "//mediapipe/gpu:gpu_service",
"@com_google_absl//absl/container:fixed_array", "@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",

View File

@ -62,11 +62,9 @@
#include "mediapipe/framework/tool/validate.h" #include "mediapipe/framework/tool/validate.h"
#include "mediapipe/framework/tool/validate_name.h" #include "mediapipe/framework/tool/validate_name.h"
#include "mediapipe/framework/validated_graph_config.h" #include "mediapipe/framework/validated_graph_config.h"
#include "mediapipe/gpu/gpu_service.h"
#include "mediapipe/gpu/graph_support.h" #include "mediapipe/gpu/graph_support.h"
#include "mediapipe/util/cpu_util.h" #include "mediapipe/util/cpu_util.h"
#if !MEDIAPIPE_DISABLE_GPU
#include "mediapipe/gpu/gpu_shared_data_internal.h"
#endif // !MEDIAPIPE_DISABLE_GPU
namespace mediapipe { namespace mediapipe {

View File

@ -53,10 +53,14 @@
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/scheduler.h" #include "mediapipe/framework/scheduler.h"
#include "mediapipe/framework/thread_pool_executor.pb.h" #include "mediapipe/framework/thread_pool_executor.pb.h"
#include "mediapipe/gpu/gpu_service.h"
namespace mediapipe { namespace mediapipe {
#if !MEDIAPIPE_DISABLE_GPU
class GpuResources;
struct GpuSharedData;
#endif // !MEDIAPIPE_DISABLE_GPU
typedef absl::StatusOr<OutputStreamPoller> StatusOrPoller; typedef absl::StatusOr<OutputStreamPoller> StatusOrPoller;
// The class representing a DAG of calculator nodes. // The class representing a DAG of calculator nodes.

View File

@ -60,7 +60,7 @@
#include "mediapipe/framework/tool/sink.h" #include "mediapipe/framework/tool/sink.h"
#include "mediapipe/framework/tool/status_util.h" #include "mediapipe/framework/tool/status_util.h"
#include "mediapipe/framework/type_map.h" #include "mediapipe/framework/type_map.h"
#include "mediapipe/gpu/graph_support.h" #include "mediapipe/gpu/gpu_service.h"
namespace mediapipe { namespace mediapipe {

View File

@ -50,7 +50,6 @@ cc_library(
name = "graph_support", name = "graph_support",
hdrs = ["graph_support.h"], hdrs = ["graph_support.h"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//mediapipe/framework:graph_service"],
) )
cc_library( cc_library(
@ -827,6 +826,7 @@ objc_library(
features = ["-layering_check"], features = ["-layering_check"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":gpu_service",
":gpu_shared_data_internal", ":gpu_shared_data_internal",
":graph_support", ":graph_support",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",

View File

@ -16,6 +16,7 @@
#import "mediapipe/gpu/gpu_buffer.h" #import "mediapipe/gpu/gpu_buffer.h"
#import "mediapipe/gpu/graph_support.h" #import "mediapipe/gpu/graph_support.h"
#import "mediapipe/gpu/gpu_service.h"
#import "mediapipe/gpu/metal_shared_resources.h" #import "mediapipe/gpu/metal_shared_resources.h"
#import "GTMDefines.h" #import "GTMDefines.h"

View File

@ -27,7 +27,7 @@ namespace mediapipe {
class GpuResources { class GpuResources {
GpuResources() = delete; GpuResources() = delete;
}; };
#endif // !MEDIAPIPE_DISABLE_GPU #endif // MEDIAPIPE_DISABLE_GPU
extern const GraphService<GpuResources> kGpuService; extern const GraphService<GpuResources> kGpuService;

View File

@ -116,6 +116,8 @@ GpuResources::~GpuResources() {
#endif // __APPLE__ #endif // __APPLE__
} }
extern const GraphService<GpuResources> kGpuService;
absl::Status GpuResources::PrepareGpuNode(CalculatorNode* node) { absl::Status GpuResources::PrepareGpuNode(CalculatorNode* node) {
CHECK(ContainsKey(node->Contract().ServiceRequests(), kGpuService.key)); CHECK(ContainsKey(node->Contract().ServiceRequests(), kGpuService.key));
std::string node_id = node->GetCalculatorState().NodeName(); std::string node_id = node->GetCalculatorState().NodeName();
@ -195,8 +197,6 @@ GlContext::StatusOrGlContext GpuResources::GetOrCreateGlContext(
GpuSharedData::GpuSharedData() : GpuSharedData(kPlatformGlContextNone) {} GpuSharedData::GpuSharedData() : GpuSharedData(kPlatformGlContextNone) {}
extern const GraphService<GpuResources> kGpuService;
#if !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER #if !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
static std::shared_ptr<GlTextureBuffer> GetGlTextureBufferFromPool( static std::shared_ptr<GlTextureBuffer> GetGlTextureBufferFromPool(
int width, int height, GpuBufferFormat format) { int width, int height, GpuBufferFormat format) {

View File

@ -16,14 +16,8 @@
#ifndef MEDIAPIPE_GPU_GRAPH_SUPPORT_H_ #ifndef MEDIAPIPE_GPU_GRAPH_SUPPORT_H_
#define MEDIAPIPE_GPU_GRAPH_SUPPORT_H_ #define MEDIAPIPE_GPU_GRAPH_SUPPORT_H_
#include "mediapipe/framework/graph_service.h"
namespace mediapipe { namespace mediapipe {
// Forward declaration to avoid depending on GpuResources here.
class GpuResources;
extern const GraphService<GpuResources> kGpuService;
static constexpr char kGpuSharedTagName[] = "GPU_SHARED"; static constexpr char kGpuSharedTagName[] = "GPU_SHARED";
static constexpr char kGpuSharedSidePacketName[] = "gpu_shared"; static constexpr char kGpuSharedSidePacketName[] = "gpu_shared";
static constexpr char kGpuExecutorName[] = "__gpu"; static constexpr char kGpuExecutorName[] = "__gpu";