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

repo-sync-2024-11-06T10:37:34+0800 #158

Merged
merged 3 commits into from
Nov 6, 2024
Merged
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
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ header: # <1>
- 'LICENSE'
- 'NOTICE'
- '.bazelversion'
- '.bazelignore'
- '.clang-format'
- '.gitattributes'
- '.gitignore'
Expand Down
2 changes: 1 addition & 1 deletion heu/experimental/tfhe/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down
1 change: 0 additions & 1 deletion heu/library/algorithms/paillier_zahlen/public_key.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions heu/library/phe/base/serializable_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ yacl::Buffer SerializableVariant<Types...>::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<int64_t>(payload_sz + sizeof(idx)));
*reinterpret_cast<uint8_t *>(payload.data<uint8_t>() + payload_sz) = idx;
*reinterpret_cast<size_t *>(payload.data<uint8_t>() + payload_sz) = idx;
return payload;
}

Expand Down Expand Up @@ -111,12 +112,11 @@ void SerializableVariant<HE_PLAINTEXT_TYPES>::EmplaceInstance(

template <typename... Types>
void SerializableVariant<Types...>::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<const uint8_t *>(in.data() + in.size() -
sizeof(uint8_t));
yacl::ByteContainerView payload(in.data(), in.size() - sizeof(uint8_t));
uint8_t idx =
*reinterpret_cast<const size_t *>(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); });
Expand Down
2 changes: 1 addition & 1 deletion heu/library/phe/phe_test/ser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion heu/pylib/numpy_binding/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down
2 changes: 1 addition & 1 deletion heu/pylib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


__version__ = "0.6.0.dev20241015"
__version__ = "0.6.0.dev20241106"
Loading