From 3046c496f81a78e7df8498f1f066507daab05ac3 Mon Sep 17 00:00:00 2001 From: shaojian Date: Wed, 6 Nov 2024 10:37:43 +0800 Subject: [PATCH 1/3] repo-sync-2024-11-06T10:37:34+0800 --- .licenserc.yaml | 1 + heu/experimental/tfhe/src/BUILD.bazel | 2 +- .../algorithms/paillier_zahlen/public_key.cc | 1 - heu/library/phe/base/serializable_types.cc | 14 +++++++------- heu/library/phe/phe_test/ser_test.cc | 2 +- heu/pylib/numpy_binding/BUILD.bazel | 2 +- heu/pylib/version.py | 5 ++++- third_party/bazel_cpp/repositories.bzl | 1 + 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.licenserc.yaml b/.licenserc.yaml index e28f4228..f0025d22 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -36,6 +36,7 @@ header: # <1> - 'LICENSE' - 'NOTICE' - '.bazelversion' + - '.bazelignore' - '.clang-format' - '.gitattributes' - '.gitignore' diff --git a/heu/experimental/tfhe/src/BUILD.bazel b/heu/experimental/tfhe/src/BUILD.bazel index 9db267f9..7e43a9b5 100644 --- a/heu/experimental/tfhe/src/BUILD.bazel +++ b/heu/experimental/tfhe/src/BUILD.bazel @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_static_library") load("//third_party/bazel_rust/cargo:crates.bzl", "all_crate_deps") load("//third_party/bazel_rust/cargo:rust_cxx_bridge.bzl", "rust_cxx_bridge") +load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) diff --git a/heu/library/algorithms/paillier_zahlen/public_key.cc b/heu/library/algorithms/paillier_zahlen/public_key.cc index a50670eb..02b48079 100644 --- a/heu/library/algorithms/paillier_zahlen/public_key.cc +++ b/heu/library/algorithms/paillier_zahlen/public_key.cc @@ -45,5 +45,4 @@ std::string PublicKey::ToString() const { n_.ToHexString(), n_.BitCount(), h_s_.ToHexString(), PlaintextBound().ToHexString(), PlaintextBound().BitCount()); } - } // namespace heu::lib::algorithms::paillier_z diff --git a/heu/library/phe/base/serializable_types.cc b/heu/library/phe/base/serializable_types.cc index ef888044..151ac1f5 100644 --- a/heu/library/phe/base/serializable_types.cc +++ b/heu/library/phe/base/serializable_types.cc @@ -58,12 +58,13 @@ yacl::Buffer SerializableVariant::Serialize(bool with_meta) const { } } }); - uint8_t idx = GetAlignedIdx(); + size_t idx = GetAlignedIdx(); // Cast `idx` to `size_t` for compatibility + // with older versions // Append idx to the end of payload to reduce memory copying auto payload_sz = payload.size(); payload.resize(static_cast(payload_sz + sizeof(idx))); - *reinterpret_cast(payload.data() + payload_sz) = idx; + *reinterpret_cast(payload.data() + payload_sz) = idx; return payload; } @@ -111,12 +112,11 @@ void SerializableVariant::EmplaceInstance( template void SerializableVariant::Deserialize(yacl::ByteContainerView in) { - YACL_ENFORCE(in.size() > sizeof(uint8_t), "Illegal buffer size {}", - in.size()); + YACL_ENFORCE(in.size() > sizeof(size_t), "Illegal buffer size {}", in.size()); - uint8_t idx = *reinterpret_cast(in.data() + in.size() - - sizeof(uint8_t)); - yacl::ByteContainerView payload(in.data(), in.size() - sizeof(uint8_t)); + uint8_t idx = + *reinterpret_cast(in.data() + in.size() - sizeof(size_t)); + yacl::ByteContainerView payload(in.data(), in.size() - sizeof(size_t)); EmplaceInstance(idx); Visit([&](auto &clazz) { FOR_EACH_TYPE(clazz) clazz.Deserialize(payload); }); diff --git a/heu/library/phe/phe_test/ser_test.cc b/heu/library/phe/phe_test/ser_test.cc index 6a85fb8c..9afc8bee 100644 --- a/heu/library/phe/phe_test/ser_test.cc +++ b/heu/library/phe/phe_test/ser_test.cc @@ -82,7 +82,7 @@ TEST_P(SerTest, VarSerialize) { EXPECT_NE(ct0, Ciphertext()); EXPECT_NE(ct0, Ciphertext(he_kit_.GetSchemaType())); buffer = ct0.Serialize(); - EXPECT_GT(buffer.size(), sizeof(uint8_t)) << buffer; + EXPECT_GT(buffer.size(), sizeof(size_t)) << buffer; Ciphertext ct1; ct1.Deserialize(buffer); diff --git a/heu/pylib/numpy_binding/BUILD.bazel b/heu/pylib/numpy_binding/BUILD.bazel index 7505ded7..423b2429 100644 --- a/heu/pylib/numpy_binding/BUILD.bazel +++ b/heu/pylib/numpy_binding/BUILD.bazel @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library") load("@yacl//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test") +load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library") package(default_visibility = ["//visibility:public"]) diff --git a/heu/pylib/version.py b/heu/pylib/version.py index d9956c19..33a98e4f 100644 --- a/heu/pylib/version.py +++ b/heu/pylib/version.py @@ -1,3 +1,6 @@ + + + # Copyright 2023 Ant Group Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,4 +16,4 @@ # limitations under the License. -__version__ = "0.6.0.dev20241015" +__version__ = "0.6.0.dev0" diff --git a/third_party/bazel_cpp/repositories.bzl b/third_party/bazel_cpp/repositories.bzl index 0776bac4..f09e1f67 100644 --- a/third_party/bazel_cpp/repositories.bzl +++ b/third_party/bazel_cpp/repositories.bzl @@ -15,6 +15,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + def heu_cpp_deps(): _bazel_skylib() _com_github_eigenteam_eigen() From e8780f7d4550ca2d2bbec864768775f9eac53089 Mon Sep 17 00:00:00 2001 From: shaojian-ant <121606618+shaojian-ant@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:41:32 +0800 Subject: [PATCH 2/3] Update version.py --- heu/pylib/version.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/heu/pylib/version.py b/heu/pylib/version.py index 33a98e4f..cf3c182c 100644 --- a/heu/pylib/version.py +++ b/heu/pylib/version.py @@ -1,6 +1,3 @@ - - - # Copyright 2023 Ant Group Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,4 +13,4 @@ # limitations under the License. -__version__ = "0.6.0.dev0" +__version__ = "0.6.0.dev20241106" From fdba1fece0e19772a1c288aaea4580e4735074c5 Mon Sep 17 00:00:00 2001 From: shaojian-ant <121606618+shaojian-ant@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:46:12 +0800 Subject: [PATCH 3/3] Update repositories.bzl --- third_party/bazel_cpp/repositories.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/bazel_cpp/repositories.bzl b/third_party/bazel_cpp/repositories.bzl index f09e1f67..0776bac4 100644 --- a/third_party/bazel_cpp/repositories.bzl +++ b/third_party/bazel_cpp/repositories.bzl @@ -15,7 +15,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - def heu_cpp_deps(): _bazel_skylib() _com_github_eigenteam_eigen()