Skip to content
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

Prepare to call jit from block machine. #2098

Merged
merged 31 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fbdabca
Use contiguous data for finalized rows.
chriseth Nov 13, 2024
71d2ebd
Remove last row.
chriseth Nov 13, 2024
f66c5c2
Fix extend.
chriseth Nov 14, 2024
934ebb1
clippy
chriseth Nov 14, 2024
19d544f
remove unused functiion
chriseth Nov 14, 2024
6b83811
Allow non-sorted column IDs.
chriseth Nov 14, 2024
80c24f9
Jit driver and machine.
chriseth Nov 14, 2024
5528a4f
reserve block
chriseth Nov 15, 2024
4d4111c
revie
chriseth Nov 15, 2024
0076d2c
review
chriseth Nov 15, 2024
3c577c1
review
chriseth Nov 15, 2024
4e83830
Add "remove_last_row"
chriseth Nov 15, 2024
9f3130a
Re-added one case.
chriseth Nov 15, 2024
1aadfe0
Merge branch 'improve_finalizable' into call_jit_from_block
chriseth Nov 15, 2024
056a904
jitedijit
chriseth Nov 15, 2024
f2fee46
jitjit
chriseth Nov 15, 2024
9415cc3
Remove try_remove_last_row.
chriseth Nov 15, 2024
ec5d110
compact data ref.
chriseth Nov 15, 2024
7cbbb8d
Remove unwrap.
chriseth Nov 15, 2024
4490dcd
Cleanup
chriseth Nov 15, 2024
7ffdad9
Merge remote-tracking branch 'origin/improve_finalizable' into call_j…
chriseth Nov 15, 2024
09863e8
cleanup
chriseth Nov 15, 2024
cf51774
cleanup
chriseth Nov 15, 2024
825d0eb
Merge remote-tracking branch 'origin/main' into call_jit_from_block
chriseth Nov 15, 2024
d470fd7
Remove type constraints.
chriseth Nov 22, 2024
b8864c8
Avoid dyn iter.
chriseth Nov 22, 2024
ca38415
Correct typo.
chriseth Nov 22, 2024
d47f695
Update executor/src/witgen/data_structures/finalizable_data.rs
chriseth Dec 9, 2024
d482821
Review comments.
chriseth Dec 9, 2024
68be580
Merge remote-tracking branch 'origin/main' into call_jit_from_block
chriseth Dec 10, 2024
46860a1
Merge remote-tracking branch 'origin/main' into call_jit_from_block
chriseth Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
chriseth committed Nov 15, 2024
commit 4490dcdcf17e85ed12c671364d06991b7663a2e6
2 changes: 1 addition & 1 deletion executor/src/witgen/data_structures/finalizable_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl<T: FieldElement> FinalizableData<T> {
}
}

pub fn append_new_finalized_rows<'a>(&'a mut self, count: usize) -> CompactDataRef<'a, T> {
pub fn append_new_finalized_rows(&mut self, count: usize) -> CompactDataRef<'_, T> {
assert!(self.post_finalized_data.is_empty());
let row_zero = self.finalized_data.len();
self.finalized_data.append_new_rows(count);
Expand Down
1 change: 0 additions & 1 deletion executor/src/witgen/machines/block_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::witgen::sequence_iterator::{
use crate::witgen::util::try_to_simple_poly;
use crate::witgen::{machines::Machine, EvalError, EvalValue, IncompleteCause};
use crate::witgen::{MutableState, QueryCallback};
use bit_vec::BitVec;
use powdr_ast::analyzed::{DegreeRange, PolyID, PolynomialType};
use powdr_number::{DegreeType, FieldElement};

Expand Down
38 changes: 27 additions & 11 deletions executor/src/witgen/machines/jit_machine_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use bit_vec::BitVec;
use powdr_number::FieldElement;

use crate::witgen::{
data_structures::finalizable_data::{CompactData, CompactDataRef},
EvalError, FixedData, MutableState, QueryCallback,
data_structures::finalizable_data::CompactDataRef, util::try_to_simple_poly, EvalError,
FixedData, MutableState, QueryCallback,
};

use super::{LookupCell, MachineParts};

pub struct JitMachineDriver<'a, T: FieldElement> {
fixed_data: &'a FixedData<'a, T>,
_fixed_data: &'a FixedData<'a, T>,
parts: MachineParts<'a, T>,
block_size: usize,
_block_size: usize,
latch_row: usize,
}

Expand All @@ -23,25 +23,41 @@ impl<'a, T: FieldElement> JitMachineDriver<'a, T> {
latch_row: usize,
) -> Self {
JitMachineDriver {
fixed_data,
_fixed_data: fixed_data,
parts,
block_size,
_block_size: block_size,
latch_row,
}
}

pub fn can_answer_lookup(&self, identity_id: u64, known_inputs: &BitVec) -> bool {
// TODO
pub fn can_answer_lookup(&self, _identity_id: u64, _known_inputs: &BitVec) -> bool {
// TODO call the JIT compiler here.
false
}

pub fn process_lookup_direct<'b, 'c, 'd, Q: QueryCallback<T>>(
&self,
_mutable_state: &'b mut MutableState<'a, 'b, T, Q>,
identity_id: u64,
connection_id: u64,
values: Vec<LookupCell<'c, T>>,
data: CompactDataRef<'d, T>,
mut data: CompactDataRef<'d, T>,
) -> Result<bool, EvalError<T>> {
todo!();
// Transfer inputs.
let right = self.parts.connections[&connection_id].right;
for (e, v) in right.expressions.iter().zip(&values) {
match v {
LookupCell::Input(&v) => {
let col = try_to_simple_poly(e).unwrap();
data.set(self.latch_row as i32, col.poly_id.id as u32, v);
}
LookupCell::Output(_) => {}
}
}

// Just some code here to avoid "unused" warnings.
// This code will not be called as long as `can_answer_lookup` returns false.
data.get(self.latch_row as i32, 0);

unimplemented!();
}
}
Loading