Skip to content

Commit

Permalink
perf(crypto): optimize TwoAdicFri::CreateOpeningProof()
Browse files Browse the repository at this point in the history
- parallelize copy.
- merge `ReverseMatrixIndexBits()` into one single parallel loop.
  • Loading branch information
chokobole committed Oct 31, 2024
1 parent 87116f9 commit 73b5319
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tachyon/crypto/commitments/fri/two_adic_fri.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ class TwoAdicFRI {
reduced_openings[log_num_rows];
CHECK_EQ(reduced_opening_for_log_num_rows.size(), num_rows);

math::RowMajorMatrix<F> block =
mat.topRows(num_rows >> config_.log_blowup);
ReverseMatrixIndexBits(block);
math::RowMajorMatrix<F> block;
block.resize(num_rows >> config_.log_blowup, mat.cols());
OMP_PARALLEL_FOR(size_t row = 0; row < num_rows >> config_.log_blowup;
++row) {
block.row(row) = mat.row(base::bits::ReverseBitsLen(
row, log_num_rows - config_.log_blowup));
}
std::vector<ExtF> reduced_rows = DotExtPowers(mat, alpha);

// TODO(ashjeong): Determine if using a matrix is a better fit.
Expand Down

0 comments on commit 73b5319

Please sign in to comment.