Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2dd4e89
Decouple status.hpp from spdlog/fmt; slim down logging.hpp
atobiszei Mar 12, 2026
8c5590c
Phase 2: Remove logging.hpp from headers that don't use logging symbols
atobiszei Mar 12, 2026
dd6571e
Phase 3: Slim modelmanager.hpp - remove openvino, spdlog, sys/stat, m…
atobiszei Mar 12, 2026
7bc73c2
Phase 4: Slim modelconfig.hpp - remove fstream, set, anonymous_input_…
atobiszei Mar 12, 2026
08cd7e0
Phase 5: Introduce ServableNameChecker and MetricProvider interfaces …
atobiszei Mar 12, 2026
948229f
Add ServableType flags to servableExists for unified name collision c…
atobiszei Mar 12, 2026
1aa6003
Move PipelineFactory to unique_ptr, remove template createPipeline wr…
atobiszei Mar 13, 2026
b7d3f4e
Remove pipelineDefinitionExists, replaced by servableExists with Serv…
atobiszei Mar 13, 2026
a09dd9f
Introduce ServableDefinition hierarchy (Phase 1)
atobiszei Mar 13, 2026
a9699ee
Phase 2: Add findServableDefinition, refactor frontend resolution cas…
atobiszei Mar 13, 2026
c9e6bfb
Phase 3A: Expand SingleVersionServableDefinition, unify guards
atobiszei Mar 17, 2026
10bc0ef
Phase 3B: Remove unnecessary includes, move protobuf include to cpp
atobiszei Mar 19, 2026
1e888cf
Phase 3C: Remove transitive includes - tensorinfo from servable.hpp, …
atobiszei Mar 19, 2026
7ff32a5
Phase 3D: Remove protobuf includes from pipelinedefinition.hpp, narro…
atobiszei Mar 19, 2026
f0daff0
Phase 3E-3H: Split mediapipe targets, NodeInitializer registry, remov…
atobiszei Mar 23, 2026
12e505a
Move mediapipe targets to src/mediapipe_internal/BUILD, fix copyright…
atobiszei Mar 23, 2026
580ebd4
Refactor: move filesystem/ and metrics/ to subdirs, extract modelinst…
atobiszei Mar 24, 2026
9601e4e
Merge remote-tracking branch 'origin/main' into atobisze_build_opt_5
atobiszei Mar 24, 2026
75aa6ce
Add license headers to new BUILD files, fix initializeNodes cleanup w…
atobiszei Mar 25, 2026
10a31d9
Add missing model_instance_provider.hpp, remove redundant getName ove…
atobiszei Mar 25, 2026
130bda9
Fix Windows build: forward-declare malloc_trim_win in modelinstance.cpp
atobiszei Mar 25, 2026
de93707
Fix Windows C6313 warning: wrap rapidjson includes with pragma guards…
atobiszei Mar 25, 2026
39d0c7b
Fix Windows linker error: move malloc_trim_win forward declaration in…
atobiszei Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
820 changes: 251 additions & 569 deletions src/BUILD

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/audio/speech_to_text/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ ovms_cc_library(

ovms_cc_library(
name = "s2t_calculator",
srcs = ["s2t_calculator.cc"],
srcs = ["s2t_calculator.cc",
"stt_node_initializer.cpp"],
deps = [
"@mediapipe//mediapipe/framework:calculator_framework",
"//src:httppayload",
Expand All @@ -39,6 +40,8 @@ ovms_cc_library(
"//third_party:genai",
"//src/audio:audio_utils",
"//src:libmodelconfigjsonparser",
"//src/mediapipe_internal:node_initializer",
"//src:libovmsstring_utils",
],
visibility = ["//visibility:public"],
alwayslink = 1,
Expand Down
73 changes: 73 additions & 0 deletions src/audio/speech_to_text/stt_node_initializer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//*****************************************************************************
// Copyright 2026 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <memory>
#include <string>
#include <utility>

#include "src/mediapipe_internal/graph_side_packets.hpp"
#include "src/mediapipe_internal/node_initializer.hpp"
#include "src/stringutils.hpp"
#include "s2t_servable.hpp"
#include "mediapipe/framework/calculator.pb.h"
#include "src/audio/speech_to_text/s2t_calculator.pb.h"

#include "src/logging.hpp"

namespace ovms {
class SttNodeInitializer : public NodeInitializer {
static constexpr const char* CALCULATOR_NAME = "S2tCalculator";

public:
bool matches(const std::string& calculatorName) const override {
return endsWith(calculatorName, CALCULATOR_NAME);
}
Status initialize(
const ::mediapipe::CalculatorGraphConfig_Node& nodeConfig,
const std::string& graphName,
const std::string& basePath,
GraphSidePackets& sidePackets,
PythonBackend* /*pythonBackend*/) override {
auto& sttServableMap = sidePackets.sttServableMap;
if (!nodeConfig.node_options().size()) {
SPDLOG_ERROR("SpeechToText node missing options in graph: {}. ", graphName);
return StatusCode::LLM_NODE_MISSING_OPTIONS;
}
if (nodeConfig.name().empty()) {
SPDLOG_ERROR("SpeechToText node name is missing in graph: {}. ", graphName);
return StatusCode::LLM_NODE_MISSING_NAME;
}
std::string nodeName = nodeConfig.name();
if (sttServableMap.find(nodeName) != sttServableMap.end()) {
SPDLOG_ERROR("SpeechToText node name: {} already used in graph: {}. ", nodeName, graphName);
return StatusCode::LLM_NODE_NAME_ALREADY_EXISTS;
}
mediapipe::S2tCalculatorOptions nodeOptions;
const auto& calculatorOptions = nodeConfig.node_options(0);
if (!calculatorOptions.UnpackTo(&nodeOptions)) {
SPDLOG_ERROR("Failed to unpack calculator options");
return StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID;
}
auto servable = std::make_shared<SttServable>(nodeOptions, basePath);
sttServableMap.insert(std::pair<std::string, std::shared_ptr<SttServable>>(nodeName, std::move(servable)));
return StatusCode::OK;
}
};

static bool sttNodeInitializerRegistered = []() {
NodeInitializerRegistry::instance().add(std::make_unique<SttNodeInitializer>());
return true;
}();
} // namespace ovms
5 changes: 4 additions & 1 deletion src/audio/text_to_speech/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ ovms_cc_library(

ovms_cc_library(
name = "t2s_calculator",
srcs = ["t2s_calculator.cc"],
srcs = ["t2s_calculator.cc",
"tts_node_initializer.cpp"],
deps = [
"@mediapipe//mediapipe/framework:calculator_framework",
"//src:httppayload",
Expand All @@ -46,6 +47,8 @@ ovms_cc_library(
":t2s_servable",
"//src/audio:audio_utils",
"//src:libmodelconfigjsonparser",
"//src/mediapipe_internal:node_initializer",
"//src:libovmsstring_utils",
],
visibility = ["//visibility:public"],
alwayslink = 1,
Expand Down
79 changes: 79 additions & 0 deletions src/audio/text_to_speech/tts_node_initializer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//*****************************************************************************
// Copyright 2026 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>

#include "src/mediapipe_internal/graph_side_packets.hpp"
#include "src/mediapipe_internal/node_initializer.hpp"
#include "src/stringutils.hpp"
#include "t2s_servable.hpp"
#include "mediapipe/framework/calculator.pb.h"
#include "src/audio/text_to_speech/t2s_calculator.pb.h"

#include "src/logging.hpp"

namespace ovms {
class TtsNodeInitializer : public NodeInitializer {
static constexpr const char* CALCULATOR_NAME = "T2sCalculator";

public:
bool matches(const std::string& calculatorName) const override {
return endsWith(calculatorName, CALCULATOR_NAME);
}
Status initialize(
const ::mediapipe::CalculatorGraphConfig_Node& nodeConfig,
const std::string& graphName,
const std::string& basePath,
GraphSidePackets& sidePackets,
PythonBackend* /*pythonBackend*/) override {
auto& ttsServableMap = sidePackets.ttsServableMap;
if (!nodeConfig.node_options().size()) {
SPDLOG_ERROR("TextToSpeech node missing options in graph: {}. ", graphName);
return StatusCode::LLM_NODE_MISSING_OPTIONS;
}
if (nodeConfig.name().empty()) {
SPDLOG_ERROR("TextToSpeech node name is missing in graph: {}. ", graphName);
return StatusCode::LLM_NODE_MISSING_NAME;
}
std::string nodeName = nodeConfig.name();
if (ttsServableMap.find(nodeName) != ttsServableMap.end()) {
SPDLOG_ERROR("TextToSpeech node name: {} already used in graph: {}. ", nodeName, graphName);
return StatusCode::LLM_NODE_NAME_ALREADY_EXISTS;
}
mediapipe::T2sCalculatorOptions nodeOptions;
const auto& calculatorOptions = nodeConfig.node_options(0);
if (!calculatorOptions.UnpackTo(&nodeOptions)) {
SPDLOG_ERROR("Failed to unpack calculator options");
return StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID;
}
try {
auto servable = std::make_shared<TtsServable>(nodeOptions.models_path(), nodeOptions.target_device(), nodeOptions.voices(), nodeOptions.plugin_config(), basePath);
ttsServableMap.insert(std::pair<std::string, std::shared_ptr<TtsServable>>(nodeName, std::move(servable)));
} catch (const std::runtime_error& e) {
SPDLOG_ERROR("TextToSpeech node name: {} initialization failed: {}. ", nodeName, e.what());
return StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID;
}
return StatusCode::OK;
}
};

static bool ttsNodeInitializerRegistered = []() {
NodeInitializerRegistry::instance().add(std::make_unique<TtsNodeInitializer>());
return true;
}();
} // namespace ovms
39 changes: 17 additions & 22 deletions src/capi_frontend/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@
#pragma warning(pop)

#include "../dags/pipeline.hpp"
#include "../dags/pipeline_factory.hpp"
#include "../dags/pipelinedefinition.hpp"
#include "../dags/pipelinedefinitionstatus.hpp"
#include "../dags/pipelinedefinitionunloadguard.hpp"
#include "../servable_definition_unload_guard.hpp"
#include "../execution_context.hpp"
#include "../version.hpp"
#if (MEDIAPIPE_DISABLE == 0)
#include "../mediapipe_internal/mediapipegraphdefinition.hpp"
#endif
#include "../model_service.hpp"
#include "../modelinstance.hpp"
#include "capi_request_utils.hpp" // TODO @atobisze must be before executor
Expand All @@ -49,8 +46,11 @@
#include "../ovms.h" // NOLINT
#include "../prediction_service.hpp"
#include "../profiler.hpp"
#include "../dags/pipelinedefinitionstatus.hpp"
#include "../servable_definition.hpp"
#include "../servablemanagermodule.hpp"
#include "../server.hpp"
#include "../single_version_servable_definition.hpp"
#include "../status.hpp"
#include "../timer.hpp"
#include "buffer.hpp"
Expand All @@ -73,7 +73,7 @@ using ovms::ModelInstanceUnloadGuard;
using ovms::ModelManager;
using ovms::Pipeline;
using ovms::PipelineDefinition;
using ovms::PipelineDefinitionUnloadGuard;
using ovms::ServableDefinitionUnloadGuard;
using ovms::ServableManagerModule;
using ovms::Server;
using ovms::Status;
Expand Down Expand Up @@ -120,10 +120,10 @@ static Status getPipeline(ovms::Server& server, const InferenceRequest* request,
if (!status.ok()) {
return status;
}
return modelManager->createPipeline(pipelinePtr, request->getServableName(), request, response);
return modelManager->getPipelineFactory().create(pipelinePtr, request->getServableName(), request, response, *modelManager);
}

static Status getPipelineDefinition(Server& server, const std::string& servableName, PipelineDefinition** pipelineDefinition, std::unique_ptr<PipelineDefinitionUnloadGuard>& unloadGuard) {
static Status getPipelineDefinition(Server& server, const std::string& servableName, PipelineDefinition** pipelineDefinition, std::unique_ptr<ServableDefinitionUnloadGuard>& unloadGuard) {
ModelManager* modelManager{nullptr};
Status status = getModelManager(server, &modelManager);
if (!status.ok()) {
Expand Down Expand Up @@ -1190,21 +1190,16 @@ DLL_PUBLIC OVMS_Status* OVMS_GetServableState(OVMS_Server* serverPtr, const char
std::shared_ptr<ovms::ModelInstance> modelInstance = modelManager->findModelInstance(servableName, servableVersion);

if (modelInstance == nullptr) {
SPDLOG_DEBUG("Requested model: {} does not exist. Searching for pipeline with that name...", servableName);
PipelineDefinition* pipelineDefinition = nullptr;
pipelineDefinition = modelManager->getPipelineFactory().findDefinitionByName(servableName);
if (!pipelineDefinition) {
#if (MEDIAPIPE_DISABLE == 0)
ovms::MediapipeGraphDefinition* mediapipeDefinition = modelManager->getMediapipeFactory().findDefinitionByName(servableName);
if (mediapipeDefinition) {
*state = convertToServableState(mediapipeDefinition->getStateCode());
return nullptr;
}
#endif
SPDLOG_DEBUG("Requested model: {} does not exist. Searching for definition with that name...", servableName);
auto* definition = modelManager->findServableDefinition(servableName);
if (!definition) {
return reinterpret_cast<OVMS_Status*>(new Status(StatusCode::MODEL_NAME_MISSING));
}
*state = convertToServableState(pipelineDefinition->getStateCode());

auto* svsd = dynamic_cast<ovms::SingleVersionServableDefinition*>(definition);
if (!svsd) {
return reinterpret_cast<OVMS_Status*>(new Status(StatusCode::MODEL_NAME_MISSING));
}
*state = convertToServableState(svsd->getStatus().getStateCode());
return nullptr;
}
if (!status.ok()) {
Expand Down Expand Up @@ -1274,7 +1269,7 @@ DLL_PUBLIC OVMS_Status* OVMS_GetServableMetadata(OVMS_Server* serverPtr, const c
if (status == StatusCode::MODEL_NAME_MISSING) {
SPDLOG_DEBUG("Requested model: {} does not exist. Searching for pipeline with that name...", servableName);
PipelineDefinition* pipelineDefinition = nullptr;
std::unique_ptr<PipelineDefinitionUnloadGuard> unloadGuard;
std::unique_ptr<ServableDefinitionUnloadGuard> unloadGuard;
status = getPipelineDefinition(server, servableName, &pipelineDefinition, unloadGuard);
if (!status.ok() || !pipelineDefinition) {
return reinterpret_cast<OVMS_Status*>(new Status(std::move(status)));
Expand Down
2 changes: 1 addition & 1 deletion src/capi_frontend/capi_request_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <vector>

#include "../ovms.h" // NOLINT
#include "src/logging.hpp"
#include "../precision.hpp"
#include "inferencerequest.hpp"
#include "../shape.hpp"
#include "../logging.hpp"
#include "../status.hpp" // TODO move impl @atobisze
#include "../extractchoice.hpp"
#include "../requesttensorextractor.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/cli_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "graph_export/s2t_graph_cli_parser.hpp"
#include "graph_export/image_generation_graph_cli_parser.hpp"
#include "ovms_exit_codes.hpp"
#include "filesystem.hpp"
#include "localfilesystem.hpp"
#include "filesystem/filesystem.hpp"
#include "filesystem/localfilesystem.hpp"
#include "stringutils.hpp"
#include "version.hpp"

Expand Down
2 changes: 2 additions & 0 deletions src/color_format_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <algorithm>
#include <vector>

#include "logging.hpp"

namespace ovms {

const char ColorFormatConfiguration::COLOR_FORMAT_DELIMITER = ':';
Expand Down
4 changes: 2 additions & 2 deletions src/config_export_module/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ ovms_cc_library(
deps = [
"@com_github_tencent_rapidjson//:rapidjson",
"//src:libovms_server_settings",
"//src:libovmsfilesystem",
"//src:libovmslocalfilesystem",
"//src/filesystem:libovmsfilesystem",
"//src/filesystem:libovmslocalfilesystem",
"//src:libovmslogging",
"//src:libovmsschema",
],
Expand Down
4 changes: 2 additions & 2 deletions src/config_export_module/config_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#pragma warning(pop)

#include "../capi_frontend/server_settings.hpp"
#include "src/filesystem.hpp"
#include "src/localfilesystem.hpp"
#include "src/filesystem/filesystem.hpp"
#include "src/filesystem/localfilesystem.hpp"
#include "src/logging.hpp"
#include "src/schema.hpp"
#include "src/status.hpp"
Expand Down
Loading