-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for NIVC stuttering (#916)
- Loading branch information
1 parent
3b9c434
commit e5abcc5
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod eval_tests; | ||
mod misc; | ||
mod nivc_stutter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
use pasta_curves::pallas::Scalar as Fr; | ||
|
||
use crate::{ | ||
coprocessor::test::DumbCoprocessor, | ||
eval::lang::Lang, | ||
lem::{ | ||
eval::{evaluate, make_cprocs_funcs_from_lang, make_eval_step_from_config, EvalConfig}, | ||
store::Store, | ||
Tag, | ||
}, | ||
state::user_sym, | ||
tag::ExprTag, | ||
}; | ||
|
||
#[test] | ||
fn test_nivc_stutter() { | ||
let mut lang = Lang::<Fr, DumbCoprocessor<Fr>>::new(); | ||
let dumb = DumbCoprocessor::new(); | ||
let name = user_sym("cproc-dumb"); | ||
|
||
let store = Store::<Fr>::default(); | ||
lang.add_coprocessor(name, dumb); | ||
|
||
let lurk_step = make_eval_step_from_config(&EvalConfig::new_nivc(&lang)); | ||
let cprocs = make_cprocs_funcs_from_lang(&lang); | ||
|
||
assert_eq!(cprocs.len(), 1); | ||
let cproc = &cprocs[0]; | ||
|
||
// 9^2 + 8 = 89 | ||
let expr = "(cproc-dumb 9 8)"; | ||
let expr = store.read_with_default_state(expr).unwrap(); | ||
|
||
let (frames, _) = evaluate(Some((&lurk_step, &lang)), expr, &store, 10).unwrap(); | ||
|
||
assert_eq!(frames.len(), 5); | ||
|
||
// `cproc` can't reduce the first input | ||
let first_input = &frames[0].input; | ||
let output = &cproc | ||
.call_simple(first_input, &store, &lang, 0) | ||
.unwrap() | ||
.output; | ||
assert_eq!(first_input, output); | ||
|
||
// `lurk_step` can't reduce the cproc input | ||
let mut cproc_input = frames[3].input.clone(); | ||
assert!(matches!(cproc_input[0].tag(), Tag::Expr(ExprTag::Cproc))); | ||
let output = &lurk_step | ||
.call_simple(&cproc_input, &store, &lang, 0) | ||
.unwrap() | ||
.output; | ||
assert_eq!(&cproc_input, output); | ||
|
||
// `cproc` can reduce the cproc input | ||
let output = &cproc | ||
.call_simple(&cproc_input, &store, &lang, 0) | ||
.unwrap() | ||
.output; | ||
assert_ne!(&cproc_input, output); | ||
|
||
// swapping the cproc name | ||
let cont = cproc_input.pop().unwrap(); | ||
let env = cproc_input.pop().unwrap(); | ||
let expr = cproc_input.pop().unwrap(); | ||
|
||
let idx = expr.get_index2().unwrap(); | ||
let (_, args) = store.expect_2_ptrs(idx); | ||
let new_name = user_sym("cproc-dumb-not"); | ||
let expr = store.intern_2_ptrs( | ||
Tag::Expr(ExprTag::Cproc), | ||
store.intern_symbol(&new_name), | ||
*args, | ||
); | ||
|
||
// `cproc` can't reduce the altered cproc input (with the wrong name) | ||
let cproc_input = vec![expr, env, cont]; | ||
let output = &cproc | ||
.call_simple(&cproc_input, &store, &lang, 0) | ||
.unwrap() | ||
.output; | ||
assert_eq!(&cproc_input, output); | ||
} |
e5abcc5
There was a problem hiding this comment.
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
125.78 GB RAM
Workflow run: https://github.com/lurk-lab/lurk-rs/actions/runs/6963509057
Benchmark Results
LEM Fibonacci Prove - rc = 100
fib-ref=3b9c434a37ed04b4f0fc048af15bde7e6536350a
fib-ref=e5abcc5cc1e75688e4f4a4c03e05d345c4e5bb57
num-100
4.77 s
(✅ 1.00x)4.84 s
(✅ 1.01x slower)num-200
9.87 s
(✅ 1.00x)9.90 s
(✅ 1.00x slower)LEM Fibonacci Prove - rc = 600
fib-ref=3b9c434a37ed04b4f0fc048af15bde7e6536350a
fib-ref=e5abcc5cc1e75688e4f4a4c03e05d345c4e5bb57
num-100
3.99 s
(✅ 1.00x)4.01 s
(✅ 1.00x slower)num-200
9.05 s
(✅ 1.00x)9.05 s
(✅ 1.00x slower)Made with criterion-table