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

Lwj/bug fix #690

Merged
merged 2 commits into from
May 16, 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
8 changes: 4 additions & 4 deletions libspu/mpc/cheetah/ot/basic_ot_prot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ NdArrayRef BasicOTProtocols::PackedB2A(const NdArrayRef &inp) {
const int64_t n = inp.numel();
size_t nbits = share_t->nbits() == 0 ? 1 : share_t->nbits();
if (n >= 8) {
// 8bits-align
// 8bits-align for a larger input
nbits = (nbits + 7) / 8 * 8;
}
SPU_ENFORCE(nbits > 0 && nbits <= 8 * SizeOf(field));

auto rand_bits = DISPATCH_ALL_FIELDS(field, "single_b2a", [&]() {
if ((n * inp.elsize()) & 7) {
// The SseTranspose requires the #columns is multiple of 8
// Thus, we call the less efficient RandBits.
if ((nbits & 7) or (n * inp.elsize()) & 7) {
// The SseTranspose requires the #rows and #columns is multiple of 8.
// Thus, we call the less efficient RandBits on margin cases.
return RandBits(field, {static_cast<int64_t>(n * nbits)});
}

Expand Down
4 changes: 2 additions & 2 deletions libspu/mpc/cheetah/ot/basic_ot_prot_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ TEST_P(BasicOTProtTest, SingleB2A) {

TEST_P(BasicOTProtTest, PackedB2A) {
size_t kWorldSize = 2;
Shape shape = {11, 12, 13};
Shape shape = {2};
FieldType field = std::get<0>(GetParam());
auto ot_type = std::get<1>(GetParam());
for (size_t nbits : {8}) {
for (size_t nbits : {3, 8, 9}) {
size_t packed_nbits = nbits;
auto boolean_t = makeType<BShrTy>(field, packed_nbits);

Expand Down
Loading