-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Preprocessed Columns Struct to Preprocessed File
- Loading branch information
1 parent
535753b
commit 32d6c02
Showing
4 changed files
with
37 additions
and
45 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
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
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
40 changes: 0 additions & 40 deletions
40
stwo_cairo_prover/crates/prover/src/components/memory/mod.rs
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,46 +1,6 @@ | ||
use stwo_prover::constraint_framework::preprocessed_columns::PreProcessedColumnId; | ||
use stwo_prover::core::backend::simd::m31::{PackedM31, N_LANES}; | ||
use stwo_prover::core::backend::simd::SimdBackend; | ||
use stwo_prover::core::backend::Col; | ||
use stwo_prover::core::fields::m31::{BaseField, M31}; | ||
use stwo_prover::core::poly::circle::{CanonicCoset, CircleEvaluation}; | ||
use stwo_prover::core::poly::BitReversedOrder; | ||
|
||
use crate::components::range_check_vector::SIMD_ENUMERATION_0; | ||
|
||
pub mod memory_address_to_id; | ||
pub mod memory_id_to_big; | ||
|
||
/// Used for sanity checks and assertions. | ||
pub const LOG_MEMORY_ADDRESS_BOUND: u32 = 27; | ||
pub const MEMORY_ADDRESS_BOUND: usize = 1 << LOG_MEMORY_ADDRESS_BOUND; | ||
|
||
/// A column with the numbers [0..(2^log_size)-1]. | ||
#[derive(Debug, Clone)] | ||
pub struct Seq { | ||
pub log_size: u32, | ||
} | ||
impl Seq { | ||
pub const fn new(log_size: u32) -> Self { | ||
Self { log_size } | ||
} | ||
|
||
pub fn packed_at(&self, vec_row: usize) -> PackedM31 { | ||
assert!(vec_row < (1 << self.log_size) / N_LANES); | ||
PackedM31::broadcast(M31::from(vec_row * N_LANES)) | ||
+ unsafe { PackedM31::from_simd_unchecked(SIMD_ENUMERATION_0) } | ||
} | ||
|
||
pub fn gen_column_simd(&self) -> CircleEvaluation<SimdBackend, BaseField, BitReversedOrder> { | ||
let col = Col::<SimdBackend, BaseField>::from_iter( | ||
(0..(1 << self.log_size)).map(BaseField::from), | ||
); | ||
CircleEvaluation::new(CanonicCoset::new(self.log_size).circle_domain(), col) | ||
} | ||
|
||
pub fn id(&self) -> PreProcessedColumnId { | ||
PreProcessedColumnId { | ||
id: format!("preprocessed_seq_{}", self.log_size).to_string(), | ||
} | ||
} | ||
} |