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 #438

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 0 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,3 @@ build:macos --host_macos_minimum_os=12.0

build:linux --copt=-fopenmp
build:linux --linkopt=-fopenmp

build:asan --features=asan
build:ubsan --features=ubsan

11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
>
> please add your unreleased change here.

- [Feature] Add Odd-Even Merge Sort to replace the bitonic sort.
- [Feature] Add radix sort support for ABY3.
- [Feature] Integrate with secretflow/psi.
- [Feature] Add Linux aarch64 support.
- [Improvement] Optimize sort memory usage.
- [Feature] Add Odd-Even Merge Sort to replace the bitonic sort
- [Feature] Add radix sort support for ABY3
- [Feature] Integrate with secretflow/psi
- [Feature] Add Linux aarch64 support
- [Feature] Add equal support for SEMI2K and ABY3
- [Improvement] Optimize sort memory usage
- [Deprecated] macOS 11.x is no longer supported

## 20231108
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ bazel build //... -c opt
bazel test //...

# [optional] build & test with ASAN or UBSAN, for macOS users please use configs with macOS prefix
bazel test //... --config=[macos-]asan
bazel test //... --config=[macos-]ubsan
bazel test //... --features=asan
bazel test //... --features=ubsan
```

### Bazel build options
Expand Down
70 changes: 70 additions & 0 deletions libspu/mpc/ab_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,74 @@ TEST_P(ConversionTest, MSB) {
});
}

TEST_P(ConversionTest, EqualAA) {
const auto factory = std::get<0>(GetParam());
const RuntimeConfig& conf = std::get<1>(GetParam());
const size_t npc = std::get<2>(GetParam());

utils::simulate(npc, [&](std::shared_ptr<yacl::link::Context> lctx) {
auto obj = factory(conf, lctx);

if (!obj->hasKernel("equal_aa")) {
return;
}
/* GIVEN */
auto r0 = rand_p(obj.get(), kShape);
auto r1 = rand_p(obj.get(), kShape);
auto r2 = rand_p(obj.get(), kShape);
std::memcpy(r2.data().data(), r0.data().data(), 16);
std::vector<Value> test_values = {r0, r1, r2};

for (auto& test_value : test_values) {
auto l_value = p2a(obj.get(), r0);
auto r_value = p2a(obj.get(), test_value);
auto prev = obj->prot()->getState<Communicator>()->getStats();
auto tmp = dynDispatch(obj.get(), "equal_aa", l_value, r_value);
auto cost = obj->prot()->getState<Communicator>()->getStats() - prev;
auto out_value = b2p(obj.get(), tmp);
auto t_value = equal_pp(obj.get(), r0, test_value);

/* THEN */
EXPECT_VALUE_EQ(out_value, t_value);
EXPECT_TRUE(verifyCost(obj->prot()->getKernel("equal_aa"), "equal_aa",
conf.field(), kShape, npc, cost));
}
});
}

TEST_P(ConversionTest, EqualAP) {
const auto factory = std::get<0>(GetParam());
const RuntimeConfig& conf = std::get<1>(GetParam());
const size_t npc = std::get<2>(GetParam());

utils::simulate(npc, [&](std::shared_ptr<yacl::link::Context> lctx) {
auto obj = factory(conf, lctx);

if (!obj->hasKernel("equal_ap")) {
return;
}
/* GIVEN */
auto r0 = rand_p(obj.get(), kShape);
auto r1 = rand_p(obj.get(), kShape);
auto r2 = rand_p(obj.get(), kShape);
std::memcpy(r2.data().data(), r0.data().data(), 16);
std::vector<Value> test_values = {r0, r1, r2};

for (auto& test_value : test_values) {
auto l_value = p2a(obj.get(), r0);
auto r_value = test_value;
auto prev = obj->prot()->getState<Communicator>()->getStats();
auto tmp = dynDispatch(obj.get(), "equal_ap", l_value, r_value);
auto cost = obj->prot()->getState<Communicator>()->getStats() - prev;
auto out_value = b2p(obj.get(), tmp);
auto t_value = equal_pp(obj.get(), r0, test_value);

/* THEN */
EXPECT_VALUE_EQ(out_value, t_value);
EXPECT_TRUE(verifyCost(obj->prot()->getKernel("equal_ap"), "equal_ap",
conf.field(), kShape, npc, cost));
}
});
}

} // namespace spu::mpc::test
Loading
Loading