mirror of
https://github.com/circify/circ.git
synced 2026-04-21 03:00:54 -04:00
zero bool ilp cost
This commit is contained in:
@@ -29,6 +29,8 @@ if __name__ == "__main__":
|
||||
db_tests + \
|
||||
mnist_tests
|
||||
|
||||
tests = kmeans_tests_2
|
||||
|
||||
# TODO: add support unsigned + int promotion
|
||||
# unsigned_arithmetic_tests + \
|
||||
|
||||
|
||||
@@ -36,94 +36,94 @@ function mpc_test_bool {
|
||||
RUST_BACKTRACE=1 measure_time $BIN --parties $parties $cpath mpc --cost-model "hycc" --selection-scheme "b"
|
||||
}
|
||||
|
||||
# build mpc arithmetic tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_sub.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult_add_pub.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mod.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add_unsigned.c
|
||||
# # build mpc arithmetic tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_sub.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult_add_pub.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mod.c
|
||||
# # mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add_unsigned.c
|
||||
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_equals.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_than.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_equals.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_than.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_equals.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_equals.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_than.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_equals.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_than.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_equals.c
|
||||
|
||||
# build nary arithmetic tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/nary_arithmetic_tests/2pc_nary_arithmetic_add.c
|
||||
# # build nary arithmetic tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/nary_arithmetic_tests/2pc_nary_arithmetic_add.c
|
||||
|
||||
# build bitwise tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_and.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_or.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_xor.c
|
||||
# # build bitwise tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_and.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_or.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_xor.c
|
||||
|
||||
# build boolean tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_and.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_or.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_equals.c
|
||||
# # build boolean tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_and.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_or.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_equals.c
|
||||
|
||||
# build nary boolean tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/nary_boolean_tests/2pc_nary_boolean_and.c
|
||||
# # build nary boolean tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/nary_boolean_tests/2pc_nary_boolean_and.c
|
||||
|
||||
# build const tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_arith.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_bool.c
|
||||
# # build const tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_arith.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_bool.c
|
||||
|
||||
# build if statement tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_bool.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_int.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_only_if.c
|
||||
# # build if statement tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_bool.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_int.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_only_if.c
|
||||
|
||||
# build shift tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/shift_tests/2pc_lhs.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/shift_tests/2pc_rhs.c
|
||||
# # build shift tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/shift_tests/2pc_lhs.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/shift_tests/2pc_rhs.c
|
||||
|
||||
# build div tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/div_tests/2pc_div.c
|
||||
# # build div tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/div_tests/2pc_div.c
|
||||
|
||||
# build array tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_sum.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index_2.c
|
||||
# # build array tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_sum.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index_2.c
|
||||
|
||||
# build circ/compiler array tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_1.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_2.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_3.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_sum_c.c
|
||||
# # build circ/compiler array tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_1.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_2.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_3.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_sum_c.c
|
||||
|
||||
# build function tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/function_tests/2pc_function_add.c
|
||||
# # build function tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/function_tests/2pc_function_add.c
|
||||
|
||||
# build struct tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/2pc_struct_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/2pc_struct_array_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/ret_struct.c
|
||||
# # build struct tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/2pc_struct_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/2pc_struct_array_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/struct_tests/ret_struct.c
|
||||
|
||||
# build matrix tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_assign_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_ptr_add.c
|
||||
# # build matrix tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_assign_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/matrix_tests/2pc_matrix_ptr_add.c
|
||||
|
||||
# build ptr tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/ptr_tests/2pc_ptr_add.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/ptr_tests/2pc_ptr_arith.c
|
||||
# # build ptr tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/ptr_tests/2pc_ptr_add.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/ptr_tests/2pc_ptr_arith.c
|
||||
|
||||
# build misc tests
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/misc_tests/2pc_millionaires.c
|
||||
mpc_test 2 ./examples/C/mpc/unit_tests/misc_tests/2pc_multi_var.c
|
||||
# # build misc tests
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/misc_tests/2pc_millionaires.c
|
||||
# mpc_test 2 ./examples/C/mpc/unit_tests/misc_tests/2pc_multi_var.c
|
||||
|
||||
# build hycc benchmarks bool-only
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/biomatch/2pc_biomatch.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/biomatch/biomatch.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/kmeans/2pc_kmeans_.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/gauss/2pc_gauss_inline.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_join.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_join2.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_merge.c
|
||||
mpc_test_bool 2 ./examples/C/mpc/benchmarks/mnist/mnist.c
|
||||
# # build hycc benchmarks bool-only
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/biomatch/2pc_biomatch.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/biomatch/biomatch.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/kmeans/2pc_kmeans_.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/gauss/2pc_gauss_inline.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_join.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_join2.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/db/db_merge.c
|
||||
# mpc_test_bool 2 ./examples/C/mpc/benchmarks/mnist/mnist.c
|
||||
|
||||
# # build hycc benchmarks
|
||||
# mpc_test 2 ./examples/C/mpc/benchmarks/biomatch/2pc_biomatch.c
|
||||
|
||||
@@ -47,6 +47,9 @@ pub struct CostModel {
|
||||
|
||||
/// Zero costs
|
||||
zero: FxHashMap<ShareType, f64>,
|
||||
|
||||
/// Zero bool
|
||||
zero_bool: FxHashMap<ShareType, f64>,
|
||||
}
|
||||
|
||||
impl CostModel {
|
||||
@@ -58,10 +61,14 @@ impl CostModel {
|
||||
zero.insert(ShareType::Arithmetic, 0.0);
|
||||
zero.insert(ShareType::Boolean, 0.0);
|
||||
zero.insert(ShareType::Yao, 0.0);
|
||||
|
||||
let mut zero_bool: FxHashMap<ShareType, f64> = FxHashMap::default();
|
||||
zero_bool.insert(ShareType::Boolean, 0.0);
|
||||
CostModel {
|
||||
conversions,
|
||||
ops,
|
||||
zero: zero,
|
||||
zero,
|
||||
zero_bool,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,9 +132,8 @@ impl CostModel {
|
||||
| Op::Field(_)
|
||||
| Op::Update(..)
|
||||
| Op::Tuple
|
||||
| Op::Select
|
||||
| Op::Store
|
||||
| Op::Call(..) => Some(&self.zero),
|
||||
Op::Select | Op::Store => Some(&self.zero_bool),
|
||||
_ => {
|
||||
let op_name = match op.clone() {
|
||||
// assume comparisions are unsigned
|
||||
|
||||
Reference in New Issue
Block a user