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

[infra] Update protobuf to 3.20 #14535

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
16 changes: 11 additions & 5 deletions compiler/luci/lang/include/luci/IR/CircleNodeMixins.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ template <uint32_t N, typename Base> class FixedArityNode : public Base
public:
FixedArityNode()
{
_args.resize(N);
for (uint32_t n = 0; n < N; ++n)
if constexpr (N > 0)
{
_args[n] = std::make_unique<loco::Use>(this);
_args.resize(N);
for (uint32_t n = 0; n < N; ++n)
{
_args[n] = std::make_unique<loco::Use>(this);
}
}
}

Expand All @@ -88,9 +91,12 @@ template <uint32_t N, typename Base> class FixedArityNode : public Base

void drop(void) final
{
for (uint32_t n = 0; n < N; ++n)
if constexpr (N > 0)
{
_args.at(n)->node(nullptr);
for (uint32_t n = 0; n < N; ++n)
{
_args.at(n)->node(nullptr);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/mir/src/mir_caffe2_importer/caffe2_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void loadModelFile(const std::string &filename, caffe2::NetDef *net)
file_stream.SetCloseOnDelete(true);

google::protobuf::io::CodedInputStream coded_stream(&file_stream);
coded_stream.SetTotalBytesLimit(INT_MAX, INT_MAX);
coded_stream.SetTotalBytesLimit(INT_MAX);

if (!net->ParseFromCodedStream(&coded_stream))
throw std::runtime_error("Couldn't parse file \"" + filename + "\".");
Expand Down
2 changes: 1 addition & 1 deletion compiler/mir/src/mir_caffe_importer/caffe_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void loadModelFromBinaryFile(const std::string &filename, caffe::NetParameter *n
file_stream.SetCloseOnDelete(true);

google::protobuf::io::CodedInputStream coded_stream(&file_stream);
coded_stream.SetTotalBytesLimit(INT_MAX, INT_MAX);
coded_stream.SetTotalBytesLimit(INT_MAX);

if (!net->ParseFromCodedStream(&coded_stream))
throw std::runtime_error("Couldn't parse file \"" + filename + "\".");
Expand Down
2 changes: 1 addition & 1 deletion compiler/mir/src/mir_onnx_importer/ONNXImporterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void loadModelFromBinaryFile(const std::string &filename, onnx::ModelProto *mode
file_stream.SetCloseOnDelete(true);

google::protobuf::io::CodedInputStream coded_stream(&file_stream);
coded_stream.SetTotalBytesLimit(INT_MAX, INT_MAX);
coded_stream.SetTotalBytesLimit(INT_MAX);

if (!model->ParseFromCodedStream(&coded_stream))
throw std::runtime_error("Couldn't parse file \"" + filename + "\".");
Expand Down
4 changes: 2 additions & 2 deletions infra/cmake/packages/ProtobufConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endfunction(_Protobuf_module_import)
function(_Protobuf_import)
# Let's use find_package here not to export unnecessary definitions
# NOTE Here we use "exact" match to avoid possible infinite loop
find_package(protobuf EXACT 3.5.2 QUIET)
find_package(protobuf EXACT 3.20.1.0 QUIET)

if(NOT protobuf_FOUND)
set(Protobuf_FOUND FALSE PARENT_SCOPE)
Expand Down Expand Up @@ -65,7 +65,7 @@ function(_Protobuf_build)
INSTALL_DIR ${EXT_OVERLAY_DIR}
BUILD_FLAGS -fPIC
EXTRA_OPTS -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_WITH_ZLIB=OFF
IDENTIFIER "3.5.2-fix2"
IDENTIFIER "3.20.1.0"
PKG_NAME "PROTOBUF")

endfunction(_Protobuf_build)
Expand Down
18 changes: 0 additions & 18 deletions infra/cmake/packages/ProtobufSource.patch

This file was deleted.

5 changes: 2 additions & 3 deletions infra/cmake/packages/ProtobufSourceConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ function(_ProtobufSource_import)
nnas_include(OptionTools)

envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com")
envoption(PROTOBUF_URL ${EXTERNAL_DOWNLOAD_SERVER}/protocolbuffers/protobuf/archive/v3.5.2.tar.gz)
envoption(PROTOBUF_URL ${EXTERNAL_DOWNLOAD_SERVER}/protocolbuffers/protobuf/archive/v3.20.1.tar.gz)

ExternalSource_Download(PROTOBUF ${PROTOBUF_URL}
PATCH ${CMAKE_CURRENT_LIST_DIR}/ProtobufSource.patch)
ExternalSource_Download(PROTOBUF ${PROTOBUF_URL})

set(ProtobufSource_DIR ${PROTOBUF_SOURCE_DIR} PARENT_SCOPE)
set(ProtobufSource_FOUND TRUE PARENT_SCOPE)
Expand Down