Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add windows compiler flags #2964

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion common_settings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ COMMON_STATIC_LIBS_COPTS = select({
"-Werror",
],
"//src:windows" : [
"-Wall",
"/W4 /WX",
"/analyze",
"/sdl",
"/guard:cf",
"/analyze",
"/Gy",
"/DYNAMICBASE",
#"/NXCOMPAT",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment?

"/GS",
],
})

Expand Down Expand Up @@ -165,6 +173,8 @@ COMMON_STATIC_LIBS_LINKOPTS = select({
],
"//src:windows" : [
"",
"/LTCG",
"/CETCOMPAT",
],
})
COPTS_PYTHON = select({
Expand Down
2 changes: 1 addition & 1 deletion src/dags/nodesessionmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ std::string NodeSessionMetadata::createSessionKey(const std::set<std::string>& i
}
std::stringstream ss;
size_t j = 0;
for (int32_t i = sessionsLevels.size() - 1; i >= 0; --i, ++j) {
for (size_t i = sessionsLevels.size() - 1; i >= 0; --i, ++j) {
if ((ignoredNodeNames.size() > 0) &&
(ignoredNodeNames.size() > j) &&
(sessionsLevels.size() >= ignoredNodeNames.size()) &&
Expand Down
2 changes: 1 addition & 1 deletion src/embeddings/embeddings_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ EmbeddingsRequest::EncodingFormat EmbeddingsHandler::getEncodingFormat() const {
void EmbeddingsHandler::setPromptTokensUsage(int promptTokens) {
this->promptTokens = promptTokens;
}

#pragma warning( disable : 4244 )
absl::Status EmbeddingsHandler::parseResponse(StringBuffer& buffer, const ov::Tensor& embeddingsTensor, const bool normalizeEmbeddings) {
Writer<StringBuffer> writer(buffer);
writer.StartObject();
Expand Down
3 changes: 3 additions & 0 deletions src/kfs_frontend/kfs_graph_executor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@
#include "opencv2/opencv.hpp"

#if (PYTHON_DISABLE == 0)
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#pragma warning(pop)

#include "../python/python_backend.hpp"
#include "../python/pythonnoderesources.hpp"
Expand Down
4 changes: 3 additions & 1 deletion src/llm/llmnoderesources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "mediapipe/framework/calculator_graph.h"
#pragma GCC diagnostic pop

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#include <pybind11/stl.h>
#pragma warning(pop)

#include "../logging.hpp"
#include "../stringutils.hpp"
Expand Down
3 changes: 3 additions & 0 deletions src/llm/text_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
#include "mediapipe/framework/calculator_framework.h"
#pragma GCC diagnostic pop

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
// Python execution for template processing
#include <pybind11/embed.h> // everything needed for embedding
#include <pybind11/stl.h>
#pragma warning(pop)

namespace ovms {

Expand Down
3 changes: 3 additions & 0 deletions src/llm/text_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
#include <string>

#include <openvino/openvino.hpp>
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
// Python execution for template processing
#include <pybind11/embed.h> // everything needed for embedding
#include <pybind11/stl.h>
#pragma warning(pop)

#include "src/python/utils.hpp"

Expand Down
4 changes: 3 additions & 1 deletion src/python/binding/ovms_py_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
#include "src/python/ovms_py_tensor.hpp"

#include <optional>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#pragma warning(pop)

namespace py = pybind11;
using namespace ovms;
Expand Down
4 changes: 4 additions & 0 deletions src/python/ovms_py_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
#include <string>
#include <vector>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/pybind11.h>
#pragma warning(pop)

namespace py = pybind11;
using namespace ovms;

#pragma warning( disable : 4244 )
OvmsPyTensor::OvmsPyTensor(const std::string& name, const py::buffer& buffer, const std::optional<std::vector<py::ssize_t>>& shape, const std::optional<std::string>& datatype) :
name(name),
refObj(buffer) {
Expand Down
3 changes: 3 additions & 0 deletions src/python/ovms_py_tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
#include <unordered_map>
#include <vector>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/pybind11.h>
#pragma warning(pop)

namespace py = pybind11;

Expand Down
3 changes: 3 additions & 0 deletions src/python/pytensor_ovtensor_converter_calculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "mediapipe/framework/calculator_framework.h"
#pragma GCC diagnostic pop
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#include <pybind11/stl.h>
#pragma warning(pop)

#include "../precision.hpp"
#include "python_backend.hpp"
Expand Down
5 changes: 4 additions & 1 deletion src/python/python_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@

#include "python_backend.hpp"

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/stl.h>
#pragma warning(pop)

#include "../logging.hpp"

namespace py = pybind11;
using namespace py::literals;
using namespace ovms;

#pragma warning( disable : 4101 )
bool PythonBackend::createPythonBackend(PythonBackend** pythonBackend) {
py::gil_scoped_acquire acquire;
try {
Expand Down
4 changes: 3 additions & 1 deletion src/python/python_backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#include <memory>
#include <string>
#include <vector>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#pragma warning(pop)

#include "utils.hpp"

Expand Down
4 changes: 3 additions & 1 deletion src/python/python_executor_calculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "mediapipe/framework/calculator_framework.h"
#pragma GCC diagnostic pop

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#include <pybind11/stl.h>
#pragma warning(pop)

#include "python_backend.hpp"

Expand Down
6 changes: 4 additions & 2 deletions src/python/pythoninterpretermodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

#include <string>
#include <utility>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#pragma warning(pop)

#include "../config.hpp"
#include "../logging.hpp"
Expand All @@ -30,7 +32,7 @@
namespace py = pybind11;

namespace ovms {
Status PythonInterpreterModule::start(const ovms::Config& config) {
Status PythonInterpreterModule::start(const ovms::Config&) {
Copy link
Collaborator

@rasapala rasapala Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this parameter? Why empty? Unused variable?

state = ModuleState::STARTED_INITIALIZE;
SPDLOG_INFO("{} starting", PYTHON_INTERPRETER_MODULE_NAME);
this->threadId = std::this_thread::get_id();
Expand Down
3 changes: 3 additions & 0 deletions src/python/pythonnoderesources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "mediapipe/framework/calculator_graph.h"
#pragma GCC diagnostic pop
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#pragma warning(pop)

#include "../mediapipe_internal/mediapipe_utils.hpp"
#include "src/python/python_executor_calculator.pb.h"
Expand Down
4 changes: 3 additions & 1 deletion src/python/pythonnoderesources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#include <memory>
#include <string>
#include <unordered_map>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#pragma warning(pop)

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Expand Down
4 changes: 3 additions & 1 deletion src/python/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

#include <memory>
#include <string>

#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#pragma warning(pop)

#include "../logging.hpp"
namespace py = pybind11;
Expand Down
3 changes: 3 additions & 0 deletions src/test/llmnode_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
#include <gtest/gtest.h>
#include <openvino/genai/continuous_batching_pipeline.hpp>
#include <openvino/openvino.hpp>
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#pragma warning(pop)

#include "../http_rest_api_handler.hpp"
#include "../http_status_code.hpp"
Expand Down
3 changes: 3 additions & 0 deletions src/test/llmtemplate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
#include <gtest/gtest.h>
#include <openvino/genai/continuous_batching_pipeline.hpp>
#include <openvino/openvino.hpp>
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#pragma warning(pop)
#include <rapidjson/error/en.h>

#include "../filesystem.hpp"
Expand Down
3 changes: 3 additions & 0 deletions src/test/mediapipeflow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
#include "test_utils.hpp"

#if (PYTHON_DISABLE == 0)
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#pragma warning(pop)

#include "../python/pythonnoderesources.hpp"
namespace py = pybind11;
Expand Down
3 changes: 3 additions & 0 deletions src/test/python/ovms_py_tensor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/pybind11.h>
#pragma warning(pop)

#include "bindings/python/ovms_py_tensor.hpp"

Expand Down
3 changes: 3 additions & 0 deletions src/test/pythonnode_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <openvino/openvino.hpp>
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h>
#pragma warning(pop)

#include "../config.hpp"
#include "../dags/pipelinedefinition.hpp"
Expand Down
3 changes: 3 additions & 0 deletions src/test/streaming_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,10 @@ node {
// PYTHON CALCULATOR CASES

#if (PYTHON_DISABLE == 0)
#pragma warning(push)
#pragma warning(disable: 6326 28182 6011 28020)
#include <pybind11/embed.h> // everything needed for embedding
#pragma warning(pop)
namespace py = pybind11;
#include "../python/python_backend.hpp"
// ------------------------- Regular mode
Expand Down