From f00741dad5f60ab1535f2de171e272847a60dfe5 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 28 Oct 2021 17:08:31 +0800 Subject: [PATCH] feat(build): bazel build support flatbuffer serialization GitOrigin-RevId: 4755c27e06eeae005dbd17628cb79f0eacf8fa1d --- .gitattributes | 1 + src/serialization/impl/flatbuffers_helper.cpp | 3 +++ src/serialization/impl/serializer_oss.cpp | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 0f1dbf43e..8f1c91f59 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,3 +18,4 @@ ci/resource/dump/roi_align_backward_8.8.0.mdl filter=lfs diff=lfs merge=lfs -tex ci/resource/dump/relayout_format_8.10.0.mdl filter=lfs diff=lfs merge=lfs -text ci/resource/dump/batch_conv_bias_with_policy_8.8.0.mdl filter=lfs diff=lfs merge=lfs -text ci/resource/prof/model_with_err_assert.mdl filter=lfs diff=lfs merge=lfs -text +ci/resource/prof/test_mge.mge filter=lfs diff=lfs merge=lfs -text diff --git a/src/serialization/impl/flatbuffers_helper.cpp b/src/serialization/impl/flatbuffers_helper.cpp index 85f92c8c7..d1de002b6 100644 --- a/src/serialization/impl/flatbuffers_helper.cpp +++ b/src/serialization/impl/flatbuffers_helper.cpp @@ -67,6 +67,9 @@ megdnn::DType load_dtype(const fbs::DType* dtype) { return dtype::Quantized4Asymm{param->scale(), param->zero_point()}; case DTypeEnum::DTypeEnum_Quantized8Asymm: return dtype::Quantized8Asymm{param->scale(), param->zero_point()}; + default: + // Float16 may be disabled + megdnn_trap(); } return {}; } diff --git a/src/serialization/impl/serializer_oss.cpp b/src/serialization/impl/serializer_oss.cpp index d30d6971e..b24302376 100644 --- a/src/serialization/impl/serializer_oss.cpp +++ b/src/serialization/impl/serializer_oss.cpp @@ -638,12 +638,12 @@ void GraphLoaderOSS::OprLoadContextImpl::load_tensor_value( mgb_throw_if( consumed_size > data_size, SerializationError, "Custom tensor value loader consumed more data than " - "available: consumed %lu, has %u", + "available: consumed %zu, has %u", consumed_size, data_size); if (consumed_size < data_size) { mgb_log_warn( "Tensor value loader consumed less data than available: " - "consumed %lu bytes, has %u bytes", + "consumed %zu bytes, has %u bytes", consumed_size, data_size); file->skip(data_size - consumed_size); } -- GitLab