Skip to content

Commit

Permalink
chore: consider comm pointers as potential functions (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpaulino authored Feb 23, 2024
1 parent 0d8de4d commit d91b5e2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lem/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,16 @@ fn reduce(cprocs: &[(&Symbol, usize)]) -> Func {
let cons: Expr::Cons;
let thunk: Expr::Thunk;
let num: Expr::Num;
let comm: Expr::Comm;
let head_is_fun = eq_tag(head, fun);
let head_is_cons = eq_tag(head, cons);
let head_is_thunk = eq_tag(head, thunk);
let head_is_num = eq_tag(head, num);
let head_is_comm = eq_tag(head, comm);
let acc = or(head_is_fun, head_is_cons);
let acc = or(acc, head_is_thunk);
let acc = or(acc, head_is_num);
let acc = or(acc, head_is_comm);
if acc {
let t = Symbol("t");
return (t)
Expand Down Expand Up @@ -1759,8 +1762,8 @@ mod tests {
expect_eq(func.slots_count.commitment, expect!["1"]);
expect_eq(func.slots_count.bit_decomp, expect!["3"]);
expect_eq(cs.num_inputs(), expect!["1"]);
expect_eq(cs.aux().len(), expect!["9107"]);
expect_eq(cs.num_constraints(), expect!["11044"]);
expect_eq(cs.aux().len(), expect!["9110"]);
expect_eq(cs.num_constraints(), expect!["11048"]);
assert_eq!(func.num_constraints(&store), cs.num_constraints());
}
}
24 changes: 24 additions & 0 deletions src/lem/tests/eval_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,30 @@ fn evaluate_comm_callable2() {
);
}

#[test]
fn evaluate_comm_callable3() {
let s = &Store::<Fr>::default();
let comm_id_expr = s
.read_with_default_state("(commit (lambda (x) x))")
.unwrap();
let (io, ..) = evaluate_simple::<_, Coproc<Fr>>(None, comm_id_expr, s, 100).unwrap();
let comm_id = io[0];
let expr = s.list([comm_id, s.intern_nil()]);

let expected = s.intern_nil();
let terminal = s.cont_terminal();
do_test_aux::<Coproc<Fr>>(
s,
&expr,
Some(expected),
None,
Some(terminal),
None,
&expect!["4"],
&None,
);
}

#[test]
fn evaluate_num_callable() {
let s = &Store::<Fr>::default();
Expand Down

1 comment on commit d91b5e2

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Table of Contents

Overview

This benchmark report shows the Fibonacci GPU benchmark.
NVIDIA L4
Intel(R) Xeon(R) CPU @ 2.20GHz
32 vCPUs
125 GB RAM
Workflow run: https://github.com/lurk-lab/lurk-rs/actions/runs/8026323620

Benchmark Results

LEM Fibonacci Prove - rc = 100

ref=0d8de4d3afa1de26a2100851402c06c64ffee4da ref=d91b5e27e526632aa56e3b1108012c232726b165
num-100 1.45 s (✅ 1.00x) 1.46 s (✅ 1.01x slower)
num-200 2.78 s (✅ 1.00x) 2.79 s (✅ 1.00x slower)

LEM Fibonacci Prove - rc = 600

ref=0d8de4d3afa1de26a2100851402c06c64ffee4da ref=d91b5e27e526632aa56e3b1108012c232726b165
num-100 1.84 s (✅ 1.00x) 1.81 s (✅ 1.02x faster)
num-200 3.05 s (✅ 1.00x) 3.02 s (✅ 1.01x faster)

Made with criterion-table

Please sign in to comment.