Internal change

PiperOrigin-RevId: 533327411
This commit is contained in:
MediaPipe Team 2023-05-18 20:17:07 -07:00 committed by Copybara-Service
parent c248525eeb
commit 937a6b1422
4 changed files with 11 additions and 5 deletions

View File

@ -38,7 +38,10 @@ cc_library(
srcs = ["gpu_service.cc"], srcs = ["gpu_service.cc"],
hdrs = ["gpu_service.h"], hdrs = ["gpu_service.h"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//mediapipe/framework:graph_service"] + select({ deps = [
"//mediapipe/framework:graph_service",
"@com_google_absl//absl/base:core_headers",
] + select({
"//conditions:default": [ "//conditions:default": [
":gpu_shared_data_internal", ":gpu_shared_data_internal",
], ],
@ -630,6 +633,7 @@ cc_library(
"//mediapipe/framework:executor", "//mediapipe/framework:executor",
"//mediapipe/framework/deps:no_destructor", "//mediapipe/framework/deps:no_destructor",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"@com_google_absl//absl/base:core_headers",
] + select({ ] + select({
"//conditions:default": [], "//conditions:default": [],
"//mediapipe:apple": [ "//mediapipe:apple": [

View File

@ -15,6 +15,7 @@
#ifndef MEDIAPIPE_GPU_GPU_SERVICE_H_ #ifndef MEDIAPIPE_GPU_GPU_SERVICE_H_
#define MEDIAPIPE_GPU_GPU_SERVICE_H_ #define MEDIAPIPE_GPU_GPU_SERVICE_H_
#include "absl/base/attributes.h"
#include "mediapipe/framework/graph_service.h" #include "mediapipe/framework/graph_service.h"
#if !MEDIAPIPE_DISABLE_GPU #if !MEDIAPIPE_DISABLE_GPU
@ -29,7 +30,7 @@ class GpuResources {
}; };
#endif // MEDIAPIPE_DISABLE_GPU #endif // MEDIAPIPE_DISABLE_GPU
extern const GraphService<GpuResources> kGpuService; ABSL_CONST_INIT extern const GraphService<GpuResources> kGpuService;
} // namespace mediapipe } // namespace mediapipe

View File

@ -14,6 +14,7 @@
#include "mediapipe/gpu/gpu_shared_data_internal.h" #include "mediapipe/gpu/gpu_shared_data_internal.h"
#include "absl/base/attributes.h"
#include "mediapipe/framework/deps/no_destructor.h" #include "mediapipe/framework/deps/no_destructor.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/gpu/gl_context.h" #include "mediapipe/gpu/gl_context.h"
@ -116,7 +117,7 @@ GpuResources::~GpuResources() {
#endif // __APPLE__ #endif // __APPLE__
} }
extern const GraphService<GpuResources> kGpuService; ABSL_CONST_INIT extern const GraphService<GpuResources> kGpuService;
absl::Status GpuResources::PrepareGpuNode(CalculatorNode* node) { absl::Status GpuResources::PrepareGpuNode(CalculatorNode* node) {
CHECK(node->Contract().ServiceRequests().contains(kGpuService.key)); CHECK(node->Contract().ServiceRequests().contains(kGpuService.key));

View File

@ -103,8 +103,8 @@ class ModelResourcesCache {
}; };
// Global service for mediapipe task model resources cache. // Global service for mediapipe task model resources cache.
const mediapipe::GraphService<ModelResourcesCache> kModelResourcesCacheService( inline constexpr mediapipe::GraphService<ModelResourcesCache>
"mediapipe::tasks::ModelResourcesCacheService"); kModelResourcesCacheService("mediapipe::tasks::ModelResourcesCacheService");
} // namespace core } // namespace core
} // namespace tasks } // namespace tasks