diff --git a/.circleci/asan-config.yml b/.circleci/asan-config.yml index 33c6cf87..901cad5d 100644 --- a/.circleci/asan-config.yml +++ b/.circleci/asan-config.yml @@ -19,7 +19,7 @@ version: 2.1 parameters: run-asan: type: boolean - default: false + default: true # Define a job to be invoked later in a workflow. # See: https://circleci.com/docs/2.0/configuration-reference/#jobs @@ -55,7 +55,7 @@ jobs: command: | set +e declare -i test_status - bazel test //libspu/... --features=asan --ui_event_filters=-info,-debug,-warning --test_output=errors | tee test_result.log; test_status=${PIPESTATUS[0]} + bazel test //libspu/... --features=asan --test_timeout=500 --ui_event_filters=-info,-debug,-warning --test_output=errors | tee test_result.log; test_status=${PIPESTATUS[0]} sh ../devtools/rename-junit-xml.sh find bazel-testlogs/ -type f -name "test.log" -print0 | xargs -0 tar -cvzf test_logs.tar.gz diff --git a/libspu/kernel/hal/prot_wrapper.cc b/libspu/kernel/hal/prot_wrapper.cc index 23f46388..7e03454d 100644 --- a/libspu/kernel/hal/prot_wrapper.cc +++ b/libspu/kernel/hal/prot_wrapper.cc @@ -163,6 +163,10 @@ Value _s2v(SPUContext* ctx, const Value& in, int owner) { MAP_UNARY_OP(not_p) MAP_UNARY_OP(not_s) MAP_UNARY_OP(not_v) +// Negate family +MAP_UNARY_OP(negate_p) +MAP_UNARY_OP(negate_s) +MAP_UNARY_OP(negate_v) // Msb family MAP_UNARY_OP(msb_p) MAP_UNARY_OP(msb_s) diff --git a/libspu/kernel/hal/prot_wrapper.h b/libspu/kernel/hal/prot_wrapper.h index 5fb110bc..a3c138ca 100644 --- a/libspu/kernel/hal/prot_wrapper.h +++ b/libspu/kernel/hal/prot_wrapper.h @@ -44,6 +44,10 @@ Value _not_p(SPUContext* ctx, const Value& in); Value _not_s(SPUContext* ctx, const Value& in); Value _not_v(SPUContext* ctx, const Value& in); +Value _negate_p(SPUContext* ctx, const Value& in); +Value _negate_s(SPUContext* ctx, const Value& in); +Value _negate_v(SPUContext* ctx, const Value& in); + Value _msb_p(SPUContext* ctx, const Value& in); Value _msb_s(SPUContext* ctx, const Value& in); Value _msb_v(SPUContext* ctx, const Value& in); diff --git a/libspu/kernel/hal/ring.cc b/libspu/kernel/hal/ring.cc index b016cd71..6844a1b8 100644 --- a/libspu/kernel/hal/ring.cc +++ b/libspu/kernel/hal/ring.cc @@ -77,8 +77,8 @@ Value _cast_type(SPUContext* ctx, const Value& x, const Type& to) { SPU_THROW("unsupport unary op={} for {}", #Name, in); \ } \ } - IMPL_UNARY_OP(_not) +IMPL_UNARY_OP(_negate) IMPL_UNARY_OP(_msb) IMPL_UNARY_OP(_square) @@ -438,13 +438,6 @@ Value _equal(SPUContext* ctx, const Value& x, const Value& y) { _xor(ctx, _less(ctx, y, x), _k1)); } -Value _negate(SPUContext* ctx, const Value& x) { - SPU_TRACE_HAL_LEAF(ctx, x); - - // negate(x) = not(x) + 1 - return _add(ctx, _not(ctx, x), _constant(ctx, 1, x.shape())); -} - Value _sign(SPUContext* ctx, const Value& x) { SPU_TRACE_HAL_LEAF(ctx, x); diff --git a/libspu/mpc/ab_api.cc b/libspu/mpc/ab_api.cc index a0720870..6ba634ad 100644 --- a/libspu/mpc/ab_api.cc +++ b/libspu/mpc/ab_api.cc @@ -86,7 +86,7 @@ Value rand_b(SPUContext* ctx, const Shape& shape) { FORCE_DISPATCH(ctx, shape); } -Value not_a(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } +Value negate_a(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } Value add_ap(SPUContext* ctx, const Value& x, const Value& y) { FORCE_DISPATCH(ctx, x, y); diff --git a/libspu/mpc/ab_api.h b/libspu/mpc/ab_api.h index 94f17d98..68cbb23f 100644 --- a/libspu/mpc/ab_api.h +++ b/libspu/mpc/ab_api.h @@ -29,7 +29,7 @@ Value msb_a2b(SPUContext* ctx, const Value& x); Value rand_a(SPUContext* ctx, const Shape& shape); Value rand_b(SPUContext* ctx, const Shape& shape); -Value not_a(SPUContext* ctx, const Value& x); +Value negate_a(SPUContext* ctx, const Value& x); Value equal_ap(SPUContext* ctx, const Value& x, const Value& y); Value equal_aa(SPUContext* ctx, const Value& x, const Value& y); diff --git a/libspu/mpc/ab_api_test.cc b/libspu/mpc/ab_api_test.cc index 592f9389..9352593d 100644 --- a/libspu/mpc/ab_api_test.cc +++ b/libspu/mpc/ab_api_test.cc @@ -436,7 +436,7 @@ TEST_P(ArithmeticTest, MatMulAV) { }); } -TEST_P(ArithmeticTest, NotA) { +TEST_P(ArithmeticTest, NegateA) { const auto factory = std::get<0>(GetParam()); const RuntimeConfig& conf = std::get<1>(GetParam()); const size_t npc = std::get<2>(GetParam()); @@ -450,15 +450,15 @@ TEST_P(ArithmeticTest, NotA) { /* WHEN */ auto prev = obj->prot()->getState()->getStats(); - auto r_a = not_a(obj.get(), a0); + auto r_a = negate_a(obj.get(), a0); auto cost = obj->prot()->getState()->getStats() - prev; auto r_p = a2p(obj.get(), r_a); - auto r_pp = a2p(obj.get(), not_a(obj.get(), a0)); + auto r_pp = a2p(obj.get(), negate_a(obj.get(), a0)); /* THEN */ EXPECT_VALUE_EQ(r_p, r_pp); - EXPECT_TRUE(verifyCost(obj->prot()->getKernel("not_a"), "not_a", + EXPECT_TRUE(verifyCost(obj->prot()->getKernel("negate_a"), "negate_a", conf.field(), kShape, npc, cost)); }); } diff --git a/libspu/mpc/aby3/arithmetic.cc b/libspu/mpc/aby3/arithmetic.cc index 6c365220..108d2209 100644 --- a/libspu/mpc/aby3/arithmetic.cc +++ b/libspu/mpc/aby3/arithmetic.cc @@ -300,13 +300,10 @@ NdArrayRef V2A::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { }); } -NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { - auto* comm = ctx->getState(); +NdArrayRef NegateA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { const auto* in_ty = in.eltype().as(); const auto field = in_ty->field(); - auto rank = comm->getRank(); - return DISPATCH_ALL_FIELDS(field, [&]() { using el_t = std::make_unsigned_t; using shr_t = std::array; @@ -315,16 +312,9 @@ NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { NdArrayView _out(out); NdArrayView _in(in); - // neg(x) = not(x) + 1 - // not(x) = neg(x) - 1 pforeach(0, in.numel(), [&](int64_t idx) { _out[idx][0] = -_in[idx][0]; _out[idx][1] = -_in[idx][1]; - if (rank == 0) { - _out[idx][1] -= 1; - } else if (rank == 1) { - _out[idx][0] -= 1; - } }); return out; diff --git a/libspu/mpc/aby3/arithmetic.h b/libspu/mpc/aby3/arithmetic.h index 94929715..c6e53340 100644 --- a/libspu/mpc/aby3/arithmetic.h +++ b/libspu/mpc/aby3/arithmetic.h @@ -116,9 +116,9 @@ class RandA : public RandKernel { NdArrayRef proc(KernelEvalContext* ctx, const Shape& shape) const override; }; -class NotA : public UnaryKernel { +class NegateA : public UnaryKernel { public: - static constexpr char kBindName[] = "not_a"; + static constexpr char kBindName[] = "negate_a"; ce::CExpr latency() const override { return ce::Const(0); } diff --git a/libspu/mpc/aby3/protocol.cc b/libspu/mpc/aby3/protocol.cc index 9c92af92..9ca2e019 100644 --- a/libspu/mpc/aby3/protocol.cc +++ b/libspu/mpc/aby3/protocol.cc @@ -54,7 +54,7 @@ void regAby3Protocol(SPUContext* ctx, aby3::B2P, aby3::P2B, aby3::A2B, // Conversion2 aby3::B2ASelector, /*aby3::B2AByOT, aby3::B2AByPPA*/ // B2A aby3::CastTypeB, // Cast - aby3::NotA, // Not + aby3::NegateA, // Negate aby3::AddAP, aby3::AddAA, // Add aby3::MulAP, aby3::MulAA, aby3::MulA1B, // Mul aby3::MatMulAP, aby3::MatMulAA, // MatMul diff --git a/libspu/mpc/api.cc b/libspu/mpc/api.cc index 58a1f4c1..ed155558 100644 --- a/libspu/mpc/api.cc +++ b/libspu/mpc/api.cc @@ -273,22 +273,42 @@ Value rand_s(SPUContext* ctx, const Shape& shape) { return rand_a(ctx, shape); } +// only works for Z2k. +// Neg(x) = Not(x) + 1 +// Not(x) = Neg(x) - 1 +Value not_v(SPUContext* ctx, const Value& x) { + SPU_TRACE_MPC_DISP(ctx, x); + auto k1 = make_p(ctx, 1, x.shape()); + return add_vp(ctx, negate_v(ctx, x), negate_p(ctx, k1)); +} + +Value not_p(SPUContext* ctx, const Value& x) { + SPU_TRACE_MPC_DISP(ctx, x); + auto k1 = make_p(ctx, 1, x.shape()); + return add_pp(ctx, negate_p(ctx, x), negate_p(ctx, k1)); +} + Value not_s(SPUContext* ctx, const Value& x) { + SPU_TRACE_MPC_DISP(ctx, x); + if (x.storage_type().isa()) { + auto ones = make_p(ctx, -1, x.shape()); + return xor_bp(ctx, x, ones); + } else { + SPU_ENFORCE(x.storage_type().isa()); + auto k1 = make_p(ctx, 1, x.shape()); + return add_sp(ctx, negate_s(ctx, x), negate_p(ctx, k1)); + } +} + +Value negate_s(SPUContext* ctx, const Value& x) { SPU_TRACE_MPC_DISP(ctx, x); TRY_DISPATCH(ctx, x); - // TODO: Both A&B could handle not(invert). - // if (x.eltype().isa()) { - // return not_b(ctx, x); - //} else { - // SPU_ENFORCE(x.eltype().isa()); - // return not_a(ctx, x); - //} - return not_a(ctx, _2a(ctx, x)); + return negate_a(ctx, _2a(ctx, x)); } -Value not_v(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } +Value negate_v(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } -Value not_p(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } +Value negate_p(SPUContext* ctx, const Value& x) { FORCE_DISPATCH(ctx, x); } ////////////////////////////////////////////////////////////////////////////// diff --git a/libspu/mpc/api.h b/libspu/mpc/api.h index ea61cc81..50656f9a 100644 --- a/libspu/mpc/api.h +++ b/libspu/mpc/api.h @@ -91,11 +91,16 @@ Value make_p(SPUContext* ctx, uint128_t init, const Shape& shape); Value rand_p(SPUContext* ctx, const Shape& shape); Value rand_s(SPUContext* ctx, const Shape& shape); -// Compute bitwise_not(invert) of a value in ring 2k space. +// Compute bitwise not of a value. Value not_p(SPUContext* ctx, const Value& x); Value not_s(SPUContext* ctx, const Value& x); Value not_v(SPUContext* ctx, const Value& x); +// Compute negate of a value. +Value negate_p(SPUContext* ctx, const Value& x); +Value negate_s(SPUContext* ctx, const Value& x); +Value negate_v(SPUContext* ctx, const Value& x); + Value msb_p(SPUContext* ctx, const Value& x); Value msb_s(SPUContext* ctx, const Value& x); Value msb_v(SPUContext* ctx, const Value& x); diff --git a/libspu/mpc/api_test.cc b/libspu/mpc/api_test.cc index 43cb0cf0..d890258f 100644 --- a/libspu/mpc/api_test.cc +++ b/libspu/mpc/api_test.cc @@ -245,6 +245,7 @@ TEST_BINARY_OP(xor) TEST_UNARY_OP_V(OP) \ TEST_UNARY_OP_P(OP) +TEST_UNARY_OP(negate) TEST_UNARY_OP(not ) TEST_UNARY_OP_V(msb) TEST_UNARY_OP_P(msb) diff --git a/libspu/mpc/cheetah/arithmetic.h b/libspu/mpc/cheetah/arithmetic.h index 26ecbb93..06f4d534 100644 --- a/libspu/mpc/cheetah/arithmetic.h +++ b/libspu/mpc/cheetah/arithmetic.h @@ -63,9 +63,9 @@ class V2A : public UnaryKernel { NdArrayRef proc(KernelEvalContext* ctx, const NdArrayRef& in) const override; }; -class NotA : public UnaryKernel { +class NegateA : public UnaryKernel { public: - static constexpr char kBindName[] = "not_a"; + static constexpr char kBindName[] = "negate_a"; ce::CExpr latency() const override { return ce::Const(0); } diff --git a/libspu/mpc/cheetah/arithmetic_semi2k.cc b/libspu/mpc/cheetah/arithmetic_semi2k.cc index dff06e17..6e6a0882 100644 --- a/libspu/mpc/cheetah/arithmetic_semi2k.cc +++ b/libspu/mpc/cheetah/arithmetic_semi2k.cc @@ -101,13 +101,8 @@ NdArrayRef V2A::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { return x.as(makeType(field)); } -NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { - auto* comm = ctx->getState(); +NdArrayRef NegateA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { auto res = ring_neg(in); - if (comm->getRank() == 0) { - const auto field = in.eltype().as()->field(); - ring_add_(res, ring_not(ring_zeros(field, in.shape()))); - } return res.as(in.eltype()); } diff --git a/libspu/mpc/cheetah/protocol.cc b/libspu/mpc/cheetah/protocol.cc index a18da61e..8b638d57 100644 --- a/libspu/mpc/cheetah/protocol.cc +++ b/libspu/mpc/cheetah/protocol.cc @@ -63,7 +63,7 @@ void regCheetahProtocol(SPUContext* ctx, ctx->prot() ->regKernel()->field(); - return ring_not(in).as(makeType(field)); + return ring_neg(in).as(makeType(field)); } }; -class NotV : public UnaryKernel { +class NegateV : public UnaryKernel { public: - static constexpr char kBindName[] = "not_v"; + static constexpr char kBindName[] = "negate_v"; ce::CExpr latency() const override { return ce::Const(0); } @@ -160,7 +160,7 @@ class NotV : public UnaryKernel { NdArrayRef proc(KernelEvalContext* ctx, const NdArrayRef& in) const override { if (isOwner(ctx, in.eltype())) { - return ring_not(in).as(in.eltype()); + return ring_neg(in).as(in.eltype()); } else { return in; } @@ -954,7 +954,7 @@ void regPV2kTypes() { void regPV2kKernels(Object* obj) { obj->regKernel()->field(); - return ring_not(in).as(makeType(field)); + return ring_neg(in).as(makeType(field)); } }; @@ -488,7 +488,7 @@ void regRef2kProtocol(SPUContext* ctx, ctx->prot() ->regKernel(field)); } -NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { - auto* comm = ctx->getState(); - - // First, let's show negate could be locally processed. - // let X = sum(Xi) % M - // let Yi = neg(Xi) = M-Xi - // - // we get - // Y = sum(Yi) % M - // = n*M - sum(Xi) % M - // = -sum(Xi) % M - // = -X % M - // - // 'not' could be processed accordingly. - // not(X) - // = M-1-X # by definition, not is the complement of 2^k - // = neg(X) + M-1 - // +NdArrayRef NegateA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { auto res = ring_neg(in); - if (comm->getRank() == 0) { - const auto field = in.eltype().as()->field(); - ring_add_(res, ring_not(ring_zeros(field, in.shape()))); - } - return res.as(in.eltype()); } diff --git a/libspu/mpc/securenn/arithmetic.h b/libspu/mpc/securenn/arithmetic.h index e0829464..179c9817 100644 --- a/libspu/mpc/securenn/arithmetic.h +++ b/libspu/mpc/securenn/arithmetic.h @@ -80,9 +80,9 @@ class A2P : public UnaryKernel { NdArrayRef proc(KernelEvalContext* ctx, const NdArrayRef& in) const override; }; -class NotA : public UnaryKernel { +class NegateA : public UnaryKernel { public: - static constexpr char kBindName[] = "not_a"; + static constexpr char kBindName[] = "negate_a"; ce::CExpr latency() const override { return ce::Const(0); } diff --git a/libspu/mpc/securenn/protocol.cc b/libspu/mpc/securenn/protocol.cc index 0fe800b0..3140b06c 100644 --- a/libspu/mpc/securenn/protocol.cc +++ b/libspu/mpc/securenn/protocol.cc @@ -50,7 +50,7 @@ void regSecurennProtocol(SPUContext* ctx, ctx->prot() ->regKernel< securenn::P2A, securenn::A2P, securenn::A2V, securenn::V2A, // - securenn::NotA, // + securenn::NegateA, // securenn::AddAP, securenn::AddAA, // securenn::MulAP, securenn::MulAA, // securenn::MatMulAP, securenn::MatMulAA, securenn::MatMulAA_simple, // diff --git a/libspu/mpc/semi2k/arithmetic.cc b/libspu/mpc/semi2k/arithmetic.cc index 017c4640..53fa2dd9 100644 --- a/libspu/mpc/semi2k/arithmetic.cc +++ b/libspu/mpc/semi2k/arithmetic.cc @@ -116,30 +116,8 @@ NdArrayRef V2A::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { return x.as(makeType(field)); } -NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { - auto* comm = ctx->getState(); - - // First, let's show negate could be locally processed. - // let X = sum(Xi) % M - // let Yi = neg(Xi) = M-Xi - // - // we get - // Y = sum(Yi) % M - // = n*M - sum(Xi) % M - // = -sum(Xi) % M - // = -X % M - // - // 'not' could be processed accordingly. - // not(X) - // = M-1-X # by definition, not is the complement of 2^k - // = neg(X) + M-1 - // +NdArrayRef NegateA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { auto res = ring_neg(in); - if (comm->getRank() == 0) { - const auto field = in.eltype().as()->field(); - ring_add_(res, ring_not(ring_zeros(field, in.shape()))); - } - return res.as(in.eltype()); } diff --git a/libspu/mpc/semi2k/arithmetic.h b/libspu/mpc/semi2k/arithmetic.h index 8b9510f8..2fa11388 100644 --- a/libspu/mpc/semi2k/arithmetic.h +++ b/libspu/mpc/semi2k/arithmetic.h @@ -80,9 +80,9 @@ class V2A : public UnaryKernel { NdArrayRef proc(KernelEvalContext* ctx, const NdArrayRef& in) const override; }; -class NotA : public UnaryKernel { +class NegateA : public UnaryKernel { public: - static constexpr char kBindName[] = "not_a"; + static constexpr char kBindName[] = "negate_a"; ce::CExpr latency() const override { return ce::Const(0); } diff --git a/libspu/mpc/semi2k/protocol.cc b/libspu/mpc/semi2k/protocol.cc index 3acd8344..35cd436c 100644 --- a/libspu/mpc/semi2k/protocol.cc +++ b/libspu/mpc/semi2k/protocol.cc @@ -51,7 +51,7 @@ void regSemi2kProtocol(SPUContext* ctx, ctx->prot() ->regKernel< semi2k::P2A, semi2k::A2P, semi2k::A2V, semi2k::V2A, // - semi2k::NotA, // + semi2k::NegateA, // semi2k::AddAP, semi2k::AddAA, // semi2k::MulAP, semi2k::MulAA, semi2k::SquareA, // semi2k::MatMulAP, semi2k::MatMulAA, // diff --git a/libspu/mpc/spdz2k/abprotocol_spdz2k_test.cc b/libspu/mpc/spdz2k/abprotocol_spdz2k_test.cc index 8bed069f..496a7059 100644 --- a/libspu/mpc/spdz2k/abprotocol_spdz2k_test.cc +++ b/libspu/mpc/spdz2k/abprotocol_spdz2k_test.cc @@ -69,6 +69,10 @@ bool verifyCost(Kernel* kernel, std::string_view name, FieldType field, return succeed; } +Value hack_make_p(SPUContext* ctx, uint128_t init, const Shape& shape) { + return dynDispatch(ctx, "make_p", init, shape); +} + } // namespace TEST_P(BooleanTest, NotB) { @@ -88,7 +92,9 @@ TEST_P(BooleanTest, NotB) { auto r_b = dynDispatch(obj.get(), "not_b", b0); auto cost = obj->prot()->getState()->getStats() - prev; auto r_p = b2p(obj.get(), r_b); - auto r_pp = not_p(obj.get(), p0); + + auto ones = hack_make_p(obj.get(), -1, kShape); + auto r_pp = xor_pp(obj.get(), p0, ones); /* THEN */ EXPECT_VALUE_EQ(r_p, r_pp); diff --git a/libspu/mpc/spdz2k/arithmetic.cc b/libspu/mpc/spdz2k/arithmetic.cc index 11eeb186..4a0714a0 100644 --- a/libspu/mpc/spdz2k/arithmetic.cc +++ b/libspu/mpc/spdz2k/arithmetic.cc @@ -212,10 +212,8 @@ NdArrayRef V2A::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { return res; } -NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { +NdArrayRef NegateA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { const auto field = in.eltype().as()->field(); - const auto key = ctx->getState()->key(); - auto* comm = ctx->getState(); // in const auto& x = getValueShare(in); @@ -225,14 +223,6 @@ NdArrayRef NotA::proc(KernelEvalContext* ctx, const NdArrayRef& in) const { auto neg_x = ring_neg(x); auto neg_x_mac = ring_neg(x_mac); - // add public M-1 - const auto& neg_ones = ring_not(ring_zeros(field, in.shape())); - if (comm->getRank() == 0) { - ring_add_(neg_x, neg_ones); - } - const auto& ones = ring_ones(field, in.shape()); - ring_sub_(neg_x_mac, ring_mul(ones, key)); - return makeAShare(neg_x, neg_x_mac, field); } diff --git a/libspu/mpc/spdz2k/arithmetic.h b/libspu/mpc/spdz2k/arithmetic.h index 7edfe33b..992134ba 100644 --- a/libspu/mpc/spdz2k/arithmetic.h +++ b/libspu/mpc/spdz2k/arithmetic.h @@ -78,9 +78,9 @@ class V2A : public UnaryKernel { NdArrayRef proc(KernelEvalContext* ctx, const NdArrayRef& in) const override; }; -class NotA : public UnaryKernel { +class NegateA : public UnaryKernel { public: - static constexpr char kBindName[] = "not_a"; + static constexpr char kBindName[] = "negate_a"; ce::CExpr latency() const override { return ce::Const(0); } diff --git a/libspu/mpc/spdz2k/protocol.cc b/libspu/mpc/spdz2k/protocol.cc index 46db690a..ffbefd55 100644 --- a/libspu/mpc/spdz2k/protocol.cc +++ b/libspu/mpc/spdz2k/protocol.cc @@ -50,7 +50,7 @@ void regSpdz2kProtocol(SPUContext* ctx, ctx->prot()->addState(ctx->config(), lctx); ctx->prot() ->regKernel(); diff --git a/libspu/mpc/tools/benchmark.cc b/libspu/mpc/tools/benchmark.cc index 615fd918..77d6e631 100644 --- a/libspu/mpc/tools/benchmark.cc +++ b/libspu/mpc/tools/benchmark.cc @@ -158,8 +158,8 @@ DEFINE_BENCHMARK(BenchAndSP, NumelArgs); DEFINE_BENCHMARK(BenchXorSP, NumelArgs); DEFINE_BENCHMARK(BenchS2P, NumelArgs); DEFINE_BENCHMARK(BenchP2S, NumelArgs); -DEFINE_BENCHMARK(BenchNotS, NumelArgs); -DEFINE_BENCHMARK(BenchNotP, NumelArgs); +DEFINE_BENCHMARK(BenchNegateS, NumelArgs); +DEFINE_BENCHMARK(BenchNegateP, NumelArgs); DEFINE_BENCHMARK(BenchLShiftS, NumelShiftArgs); DEFINE_BENCHMARK(BenchLShiftP, NumelShiftArgs); @@ -177,7 +177,7 @@ DEFINE_BENCHMARK(BenchRandB, NumelArgs); DEFINE_BENCHMARK(BenchP2A, NumelArgs); DEFINE_BENCHMARK(BenchA2P, NumelArgs); DEFINE_BENCHMARK(BenchMsbA2b, NumelArgs); -DEFINE_BENCHMARK(BenchNotA, NumelArgs); +DEFINE_BENCHMARK(BenchNegateA, NumelArgs); DEFINE_BENCHMARK(BenchAddAP, NumelArgs); DEFINE_BENCHMARK(BenchMulAP, NumelArgs); DEFINE_BENCHMARK(BenchAddAA, NumelArgs); diff --git a/libspu/mpc/tools/benchmark.h b/libspu/mpc/tools/benchmark.h index 764a50e5..ce64c17c 100644 --- a/libspu/mpc/tools/benchmark.h +++ b/libspu/mpc/tools/benchmark.h @@ -220,8 +220,8 @@ MPC_BENCH_DEFINE(BenchAddSP, OpData1S1P, add_sp, ss[0], ps[0]) MPC_BENCH_DEFINE(BenchMulSP, OpData1S1P, mul_sp, ss[0], ps[0]) MPC_BENCH_DEFINE(BenchAndSP, OpData1S1P, and_sp, ss[0], ps[0]) MPC_BENCH_DEFINE(BenchXorSP, OpData1S1P, xor_sp, ss[0], ps[0]) -MPC_BENCH_DEFINE(BenchNotS, OpData1S, not_s, ss[0]) -MPC_BENCH_DEFINE(BenchNotP, OpData1P, not_p, ps[0]) +MPC_BENCH_DEFINE(BenchNegateS, OpData1S, negate_s, ss[0]) +MPC_BENCH_DEFINE(BenchNegateP, OpData1P, negate_p, ps[0]) MPC_BENCH_DEFINE(BenchLShiftS, OpData1S, lshift_s, ss[0], {state.range(2)}) MPC_BENCH_DEFINE(BenchLShiftP, OpData1P, lshift_p, ps[0], {state.range(2)}) MPC_BENCH_DEFINE(BenchRShiftS, OpData1S, rshift_s, ss[0], {state.range(2)}) @@ -241,7 +241,7 @@ MPC_BENCH_DEFINE(BenchRandB, OpDataBasic, rand_b, Shape{state.range(1)}) MPC_BENCH_DEFINE(BenchP2A, OpData1P, p2a, ps[0]) MPC_BENCH_DEFINE(BenchA2P, OpData1A, a2p, as[0]) MPC_BENCH_DEFINE(BenchMsbA2b, OpData1A, msb_a2b, as[0]) -MPC_BENCH_DEFINE(BenchNotA, OpData1A, not_a, as[0]) +MPC_BENCH_DEFINE(BenchNegateA, OpData1A, negate_a, as[0]) MPC_BENCH_DEFINE(BenchAddAP, OpData1A1P, add_ap, as[0], ps[0]) MPC_BENCH_DEFINE(BenchMulAP, OpData1A1P, mul_ap, as[0], ps[0]) MPC_BENCH_DEFINE(BenchAddAA, OpData2A, add_aa, as[0], as[1])