-
Notifications
You must be signed in to change notification settings - Fork 97
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
Enable Bus in tests #2289
Enable Bus in tests #2289
Conversation
@@ -22,7 +22,8 @@ fn slice_to_vec<T: FieldElement>(arr: &[i32]) -> Vec<T> { | |||
fn sqrt_asm() { | |||
let f = "asm/sqrt.asm"; | |||
let i = [3]; | |||
let pipeline: Pipeline<GoldilocksField> = make_prepared_pipeline(f, slice_to_vec(&i), vec![]); | |||
let pipeline: Pipeline<GoldilocksField> = | |||
make_prepared_pipeline(f, slice_to_vec(&i), vec![], LinkerMode::Bus); |
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.
So these are only testing with bus mode?
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.
Yes, I think it should be the default now, whenever possible.
@@ -110,7 +111,8 @@ fn fibonacci() { | |||
fn fibonacci_with_public() { | |||
// Public references are not supported by the backends yet, but we can test witness generation. | |||
let f = "pil/fibonacci_with_public.pil"; | |||
let mut pipeline: Pipeline<GoldilocksField> = make_prepared_pipeline(f, vec![], vec![]); | |||
let mut pipeline: Pipeline<GoldilocksField> = | |||
make_prepared_pipeline(f, vec![], vec![], LinkerMode::Bus); |
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.
Why only bus?
.. | ||
}) => self.process_call(can_process, *id, multiplicity, &tuple.0, row_offset), | ||
// TODO(bus_interaction) | ||
Identity::PhantomBusInteraction(_) => ProcessResult::empty(), |
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.
Bug: Witgen filters out Bus interactions, so processing a call here leads to witgen not being able to find the called machine by the identity ID. This is also not trivial, because we'd probably want to use the receiving bus interaction.
Right now, all bus interactions also come with a phantom lookup / permutation, so they can safely be ignored. // TODO(bus_interaction)
mark the places that need to be adjusted once this is removed as part of #2184.
@@ -445,7 +445,7 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> { | |||
|
|||
let updates = updates.report_side_effect(); | |||
|
|||
let global_latch_row_index = self.data.len() - 1 - self.block_size + self.latch_row; | |||
let global_latch_row_index = self.data.len() - self.block_size + self.latch_row; |
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.
Bug: This -1
is just wrong.
let latch_row = self.data.len() - 1; | ||
// The block we just added contains the first row of the next block, | ||
// so the latch row is the second-to-last row. | ||
let latch_row = self.data.len() - 2; |
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.
Bug: See comment.
refs.path = SymbolPath::from_parts( | ||
once(Part::Named(namespace.clone())).chain(refs.path.clone().into_parts()), | ||
); | ||
if !refs.path.is_std() { |
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.
Bug: We used to namespace std
namespaces as well. So, if there was a lookup from main
into main_sub
, using something in std::*
in its expressions, it would turn into main::std::*
.
test_mock_backend(pipeline_gl_native.clone()); | ||
run_pilcom_with_backend_variant(pipeline_gl_native, BackendVariant::Composite).unwrap(); | ||
|
||
let pipeline_gl_bus = |
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.
Note that this means we now run steps such as constant generation, witgen, etc twice, once for each linker mode.
@@ -127,6 +129,8 @@ fn empty() { | |||
} | |||
|
|||
#[test] | |||
// TODO: https://github.com/powdr-labs/powdr/issues/2292 |
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.
I don't think this is really worth fixing, see my comment in #2292. But in principle, we could track which namespace identities are generated in.
col witness w; | ||
w = w * w; |
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.
Somehow, without this, the columns generated by the bus interaction end up in the std::well_known
namespace, which doesn't have a degree... I thought it's not worth fixing it, because a machine without a column is very unrealistic.
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20
.
Benchmark suite | Current: 737bd78 | Previous: 2ad6c4f | Ratio |
---|---|---|---|
evaluator-benchmark/sqrt_879882356 |
36805 ns/iter (± 23 ) |
29318 ns/iter (± 28 ) |
1.26 |
evaluator-benchmark/sqrt_1882356 |
31520 ns/iter (± 16 ) |
24558 ns/iter (± 16 ) |
1.28 |
evaluator-benchmark/sqrt_1187956 |
31052 ns/iter (± 13 ) |
24467 ns/iter (± 27 ) |
1.27 |
evaluator-benchmark/sqrt_56 |
22249 ns/iter (± 8 ) |
17424 ns/iter (± 9 ) |
1.28 |
This comment was automatically generated by workflow using github-action-benchmark.
This reverts commit 6b949ad.
Hmm, I reverted 6b949ad, because I'm getting a panic in the RISC-V executor. Guess that can be done in another PR. |
@@ -263,9 +270,6 @@ fn dynamic_vadcop() { | |||
assert_eq!(witness_by_name["main_arith::y"].len(), 32); | |||
assert_eq!(witness_by_name["main_memory::m_addr"].len(), 32); | |||
|
|||
// Because machines have different lengths, this can only be proven | |||
// with a composite proof. | |||
run_pilcom_with_backend_variant(pipeline_gl.clone(), BackendVariant::Composite).unwrap(); |
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.
Not sure if it is important to test PILCOM here? If we already have the mock prover? If yes, we'd have to make a new pipeline with LinkerMode::Native
(which implies re-computing everything until the witness).
With a bus, PILCOM ends in some infinite loop. See this CI run.
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.
Looks good to me
This PR uses
LinkerMode::Bus
in all tests which:This is true for most tests.
Doing so, I came across a few bugs. I added comments for them below.