Skip to content

Commit bf44dbe

Browse files
authored
build(deps): Align protobuf and related dependencies with the gRPC v1.81.1 bump (#516)
* fix: Pass utf8_range_DIR to triton-core build The protobuf bundled with gRPC v1.81.1 (v33.5) installs utf8_range as a separate CMake package and protobuf-config.cmake references the utf8_range::utf8_validity imported target. find_package(Protobuf CONFIG) with only Protobuf_DIR set fails at generate time with 'the target was not found'. Provide utf8_range_DIR alongside Protobuf_DIR. * fix: Adapt model_config_utils to protobuf v33 API Three breakages against the protobuf bundled with gRPC v1.81.1: - FieldDescriptor::name() now returns absl::string_view; wrap in std::string for concatenation. - JsonPrintOptions::always_print_primitive_fields was removed; use its designated replacement always_print_fields_with_no_presence. - MessageToJsonString's absl::Status return is nodiscard and fails the -Werror build when ignored; propagate it as an INTERNAL status. * fix: Log auto-completed model config with stable text format protobuf v33 makes DebugString() output intentionally unstable (injects a 'goo.gle/debugstr' marker that is not valid text format), which polluted the 'Server side auto-completed config' log and broke L0_logging's log_format parser. Serialize with TextFormat::PrintToString at the call site instead of LOG_PROTOBUF_VERBOSE.
1 parent 0e81b4a commit bf44dbe

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ if(NOT TRITON_CORE_HEADERS_ONLY)
246246

247247
# Location where protobuf-config.cmake will be installed
248248
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${TRITON_THIRD_PARTY_INSTALL_PREFIX}/protobuf/${LIB_DIR}/cmake/protobuf")
249+
set(_FINDPACKAGE_UTF8_RANGE_CONFIG_DIR "${TRITON_THIRD_PARTY_INSTALL_PREFIX}/protobuf/${LIB_DIR}/cmake/utf8_range")
249250

250251
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
251252
set(TRITON_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install)
@@ -286,6 +287,7 @@ if(NOT TRITON_CORE_HEADERS_ONLY)
286287
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/triton-core"
287288
CMAKE_CACHE_ARGS
288289
-DProtobuf_DIR:PATH=${_FINDPACKAGE_PROTOBUF_CONFIG_DIR}
290+
-Dutf8_range_DIR:PATH=${_FINDPACKAGE_UTF8_RANGE_CONFIG_DIR}
289291
${_CMAKE_ARGS_OPENSSL_ROOT_DIR}
290292
${_CMAKE_ARGS_CMAKE_TOOLCHAIN_FILE}
291293
${_CMAKE_ARGS_VCPKG_TARGET_TRIPLET}

src/model_config_utils.cc

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "model_config_utils.h"
2828

29+
#include <google/protobuf/text_format.h>
2930
#include <google/protobuf/util/json_util.h>
3031
#include <google/protobuf/util/message_differencer.h>
3132

@@ -754,7 +755,21 @@ GetNormalizedModelConfig(
754755
RETURN_IF_ERROR(
755756
AutoCompleteBackendFields(model_name, std::string(path), config));
756757

757-
LOG_PROTOBUF_VERBOSE(1, "Server side auto-completed config: ", (*config));
758+
// Not using LOG_PROTOBUF_VERBOSE: it serializes via protobuf DebugString(),
759+
// which protobuf v33 deliberately makes unstable (injects a
760+
// "goo.gle/debugstr" marker) to discourage parsing. That marker is not valid
761+
// text format and pollutes the logged config. Serialize with
762+
// TextFormat::PrintToString for stable, parseable output.
763+
if (LOG_VERBOSE_IS_ON(1)) {
764+
std::string auto_completed_config;
765+
google::protobuf::TextFormat::PrintToString(
766+
*config, &auto_completed_config);
767+
triton::common::LogMessage(
768+
__FILE__, __LINE__, triton::common::Logger::Level::kINFO,
769+
"Server side auto-completed config: ", false)
770+
.stream()
771+
<< auto_completed_config;
772+
}
758773

759774
RETURN_IF_ERROR(NormalizeModelConfig(min_compute_capability, config));
760775

@@ -1976,7 +1991,7 @@ CollectInt64Fields(
19761991
const google::protobuf::Reflection* refl = message->GetReflection();
19771992
for (int i = 0; i < desc->field_count(); ++i) {
19781993
const google::protobuf::FieldDescriptor* field = desc->field(i);
1979-
const std::string fullname = prefix + "::" + field->name();
1994+
const std::string fullname = prefix + "::" + std::string(field->name());
19801995
switch (field->type()) {
19811996
case google::protobuf::FieldDescriptor::TYPE_MESSAGE: {
19821997
if (field->is_repeated()) {
@@ -2201,9 +2216,15 @@ ModelConfigToJson(
22012216
std::string config_json_str;
22022217
::google::protobuf::util::JsonPrintOptions options;
22032218
options.preserve_proto_field_names = true;
2204-
options.always_print_primitive_fields = true;
2205-
::google::protobuf::util::MessageToJsonString(
2219+
options.always_print_fields_with_no_presence = true;
2220+
const auto to_json_status = ::google::protobuf::util::MessageToJsonString(
22062221
config, &config_json_str, options);
2222+
if (!to_json_status.ok()) {
2223+
return Status(
2224+
Status::Code::INTERNAL,
2225+
"failed to convert model configuration to JSON: " +
2226+
std::string(to_json_status.message()));
2227+
}
22072228

22082229
// We need to verify that every field 64-bit field in the
22092230
// ModelConfig protobuf is being handled. We hardcode the known

0 commit comments

Comments
 (0)