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

feat: single page index scan with predicate #58

Merged
merged 63 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
eed044d
feat: sorted_limbs chip checking each limb less than limb_bits bits
bfan05 May 29, 2024
023c034
feat: completed sorted_limbs chip with tests
bfan05 May 30, 2024
4c21140
Merge branch 'main' into feat/sort-limbs
bfan05 May 30, 2024
a5c0982
feat: SortedLimbsChip with LessThan subchip
bfan05 May 31, 2024
06ada4b
feat: less_than subchip refactored
bfan05 May 31, 2024
0caddfd
chore: merge main
bfan05 May 31, 2024
b349571
feat: rename SortedLimbsChip to AssertSortedChip and write LessThanCh…
bfan05 May 31, 2024
dbada83
chore: change name of assert sorted chip
bfan05 May 31, 2024
b62172a
chore: fix names in tests for AssertSortedChip
bfan05 May 31, 2024
0cf5509
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 3, 2024
451f4c4
chore: address comments
bfan05 Jun 3, 2024
d77fd08
chore: cleanup
bfan05 Jun 3, 2024
c320b27
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 3, 2024
3c81318
chore: change MAX from generic to instance field for LessThanChip and…
bfan05 Jun 3, 2024
296b66f
feat: IsLessThanChip to compare two numbers
bfan05 Jun 4, 2024
c860b80
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 4, 2024
3610e0d
feat: IsLessThanTuple subchip for different limb_bits
bfan05 Jun 4, 2024
50d54a4
feat: IsLessThanTupleChip subchip in AssertSortedChip
bfan05 Jun 4, 2024
d0ae2cf
chore: address comments first pass
bfan05 Jun 5, 2024
81494d9
Merge branch 'main' into feat/sort-limbs
bfan05 Jun 5, 2024
6ca339f
chore: refactor AssertSorted, IsEqual, IsLessThan, and IsLessThanTupl…
bfan05 Jun 5, 2024
aef744a
chore: address comments
bfan05 Jun 5, 2024
38d5dec
chore: eliminate high dim poly from IsLessThanTupleChip
bfan05 Jun 5, 2024
d76a94d
chore: fix tests
bfan05 Jun 5, 2024
eca7ef3
chore: address comments for AssertSortedChip
bfan05 Jun 6, 2024
4890798
chore: cleanup AssertSorted
bfan05 Jun 6, 2024
a086260
chore: cleanup
bfan05 Jun 6, 2024
6896610
chore: include roundtrip flatten and from_slice tests
bfan05 Jun 6, 2024
7c23b03
feat: flatten and from_slice for IO and Aux columns
bfan05 Jun 6, 2024
1bf59eb
create files
bfan05 Jun 6, 2024
2acecf6
Merge branch 'feat/sort-limbs'
bfan05 Jun 6, 2024
5b713a8
chore: begin PageIndexScanChip
bfan05 Jun 7, 2024
cd28555
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 7, 2024
daad3de
feat: prototype
bfan05 Jun 7, 2024
867b40b
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 7, 2024
e464812
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 10, 2024
0a8882c
feat: rename Chip to AirBridge
bfan05 Jun 10, 2024
a3f5c7b
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 10, 2024
24a8771
feat: single page index scan chip for less than predicate
bfan05 Jun 10, 2024
d250e99
feat: partitioned main
bfan05 Jun 10, 2024
3b75032
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 10, 2024
b7c479e
chore: cleanup index scan for less than predicate
bfan05 Jun 10, 2024
c8274a8
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 10, 2024
bf28bc0
merge main
bfan05 Jun 11, 2024
04a31dd
feat: x as public value
bfan05 Jun 11, 2024
567923b
feat: page index scan with comparator enum
bfan05 Jun 11, 2024
cffc568
feat: page index scan for greater than predicate
bfan05 Jun 11, 2024
62fe907
feat: page index scan for equal to predicates
bfan05 Jun 11, 2024
f924741
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 11, 2024
e651024
feat: page index scan for less than or equal to predicate
bfan05 Jun 11, 2024
bf78f34
feat: page index scan for greater than or equal to predicate
bfan05 Jun 11, 2024
a13547d
chore: cleanup some branches
bfan05 Jun 11, 2024
b5a5990
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 12, 2024
50e150b
chore: refactor code to reduce repetition
bfan05 Jun 12, 2024
99d1f98
chore: cleanup PageIndexScanInputChip
bfan05 Jun 12, 2024
aeb206a
chore: fix test
bfan05 Jun 12, 2024
6c75696
Merge branch 'main' into feat/page-index-scan
bfan05 Jun 17, 2024
9d72619
merge IsEqualVec columns
bfan05 Jun 17, 2024
7789793
remove range_max from PageIndexScan chips
bfan05 Jun 17, 2024
d830f5f
chore: address comments
bfan05 Jun 17, 2024
6751b3e
feat: use FinalPage
bfan05 Jun 17, 2024
d269ad7
chore: refactor index_scan_test
bfan05 Jun 17, 2024
6d3f039
chore: address comments
bfan05 Jun 18, 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
35 changes: 35 additions & 0 deletions chips/src/is_equal_vec/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,47 @@ pub struct IsEqualVecIOCols<T> {
pub prod: T,
}

impl<T: Clone> IsEqualVecIOCols<T> {
pub fn flatten(&self) -> Vec<T> {
let mut res: Vec<T> = self.x.iter().chain(self.y.iter()).cloned().collect();
res.push(self.prod.clone());
res
}

pub fn from_slice(slc: &[T], vec_len: usize) -> Self {
let x = slc[0..vec_len].to_vec();
let y = slc[vec_len..2 * vec_len].to_vec();
let prod = slc[2 * vec_len].clone();
Self { x, y, prod }
}

pub fn get_width(vec_len: usize) -> usize {
vec_len + vec_len + 1
}
}

#[derive(Default)]
pub struct IsEqualVecAuxCols<T> {
pub prods: Vec<T>,
pub invs: Vec<T>,
}

impl<T: Clone> IsEqualVecAuxCols<T> {
pub fn flatten(&self) -> Vec<T> {
self.prods.iter().chain(self.invs.iter()).cloned().collect()
}

pub fn from_slice(slc: &[T], vec_len: usize) -> Self {
let prods = slc[0..vec_len].to_vec();
let invs = slc[vec_len..2 * vec_len].to_vec();
Self { prods, invs }
}

pub fn get_width(vec_len: usize) -> usize {
vec_len + vec_len
}
}

#[derive(Default)]
pub struct IsEqualVecCols<T> {
pub io: IsEqualVecIOCols<T>,
Expand Down
4 changes: 4 additions & 0 deletions chips/src/is_equal_vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub struct IsEqualVecAir {
}

impl IsEqualVecAir {
pub fn new(vec_len: usize) -> Self {
Self { vec_len }
}

pub fn request<F: Clone + PartialEq>(&self, x: &[F], y: &[F]) -> bool {
x == y
}
Expand Down
1 change: 1 addition & 0 deletions chips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod page_controller;
pub mod page_read;
pub mod range;
pub mod range_gate;
pub mod single_page_index_scan;
pub mod sub_chip;
pub mod sum;
mod utils;
Expand Down
12 changes: 12 additions & 0 deletions chips/src/range_gate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ impl RangeCheckerGateChip {
}
}

pub fn bus_index(&self) -> usize {
self.air.bus_index
}

pub fn range_max(&self) -> u32 {
self.air.range_max
}

pub fn air_width(&self) -> usize {
2
}

pub fn add_count(&self, val: u32) {
let val_atomic = &self.count[val as usize];
val_atomic.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Expand Down
4 changes: 2 additions & 2 deletions chips/src/range_gate/trace.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use p3_field::PrimeField64;
use p3_field::PrimeField;
use p3_matrix::dense::RowMajorMatrix;

use super::{columns::NUM_RANGE_GATE_COLS, RangeCheckerGateChip};

impl RangeCheckerGateChip {
pub fn generate_trace<F: PrimeField64>(&self) -> RowMajorMatrix<F> {
pub fn generate_trace<F: PrimeField>(&self) -> RowMajorMatrix<F> {
let rows = self
.count
.iter()
Expand Down
6 changes: 6 additions & 0 deletions chips/src/single_page_index_scan/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub mod page_controller;
pub mod page_index_scan_input;
pub mod page_index_scan_output;

#[cfg(test)]
pub mod tests;
Loading
Loading