diff --git a/benchmark/fft/fft_benchmark.cc b/benchmark/fft/fft_benchmark.cc index 1cbf8f7ad..090ad8f81 100644 --- a/benchmark/fft/fft_benchmark.cc +++ b/benchmark/fft/fft_benchmark.cc @@ -1,7 +1,8 @@ #include #include -#include +#include +#include // clang-format off #include "benchmark/fft/fft_config.h" @@ -59,7 +60,7 @@ template void CheckResult(bool check_result, const PolyOrEvals& tachyon_result, const PolyOrEvals& vendor_result) { if (check_result) { - CHECK_EQ(tachyon_result, vendor_result) << "Results not matched"; + CHECK_EQ(tachyon_result, vendor_result) << "Results do not match"; } } diff --git a/benchmark/fft/fft_benchmark_gpu.cc b/benchmark/fft/fft_benchmark_gpu.cc index ea66e0924..52e148afe 100644 --- a/benchmark/fft/fft_benchmark_gpu.cc +++ b/benchmark/fft/fft_benchmark_gpu.cc @@ -1,5 +1,6 @@ +#include +#include #if TACHYON_CUDA -#include // clang-format off #include "benchmark/fft/fft_config.h" @@ -79,7 +80,7 @@ void Run(const FFTConfig& config) { domain.get(), input, kShouldRecord, gpu_result); } if (config.check_results()) { - CHECK_EQ(cpu_result, gpu_result) << "Results not matched"; + CHECK_EQ(cpu_result, gpu_result) << "Results do not match"; } } diff --git a/benchmark/fft_batch/fft_batch_benchmark.cc b/benchmark/fft_batch/fft_batch_benchmark.cc index 1bdcc0a16..9a0733a7b 100644 --- a/benchmark/fft_batch/fft_batch_benchmark.cc +++ b/benchmark/fft_batch/fft_batch_benchmark.cc @@ -1,4 +1,5 @@ -#include +#include +#include #include "absl/strings/substitute.h" @@ -26,7 +27,7 @@ void CheckResults(bool check_results, const math::RowMajorMatrix& tachyon_result, const math::RowMajorMatrix& vendor_result) { if (check_results) { - CHECK_EQ(tachyon_result, vendor_result) << "Results not matched"; + CHECK_EQ(tachyon_result, vendor_result) << "Results do not match"; } } diff --git a/benchmark/fri/fri_benchmark.cc b/benchmark/fri/fri_benchmark.cc index 563de3537..84e4cc164 100644 --- a/benchmark/fri/fri_benchmark.cc +++ b/benchmark/fri/fri_benchmark.cc @@ -39,7 +39,7 @@ template void CheckResult(bool check_results, const Result& tachyon_result, const Result& vendor_result) { if (check_results) { - CHECK_EQ(tachyon_result, vendor_result) << "Results not matched"; + CHECK_EQ(tachyon_result, vendor_result) << "Results do not match"; } } diff --git a/benchmark/msm/msm_benchmark.cc b/benchmark/msm/msm_benchmark.cc index 1144d46fd..62c4e0f40 100644 --- a/benchmark/msm/msm_benchmark.cc +++ b/benchmark/msm/msm_benchmark.cc @@ -1,4 +1,6 @@ #include +#include +#include // clang-format off #include "benchmark/msm/msm_config.h" @@ -89,7 +91,7 @@ int RealMain(int argc, char** argv) { } if (config.check_results()) { - CHECK(results == results_vendor) << "Result not matched"; + CHECK(results == results_vendor) << "Results do not match"; } } diff --git a/benchmark/msm/msm_benchmark_gpu.cc b/benchmark/msm/msm_benchmark_gpu.cc index 2e4278d55..328a025c1 100644 --- a/benchmark/msm/msm_benchmark_gpu.cc +++ b/benchmark/msm/msm_benchmark_gpu.cc @@ -1,5 +1,6 @@ -#if TACHYON_CUDA #include +#include +#if TACHYON_CUDA // clang-format off #include "benchmark/msm/msm_config.h" @@ -66,7 +67,7 @@ int RealMain(int argc, char** argv) { tachyon_bn254_g1_destroy_msm_gpu(msm_gpu); if (config.check_results()) { - CHECK(results_cpu == results_gpu) << "Result not matched"; + CHECK(results_cpu == results_gpu) << "Results do not match"; } reporter.Show(); diff --git a/benchmark/poseidon/poseidon_benchmark.cc b/benchmark/poseidon/poseidon_benchmark.cc index 76dab3108..b0966f7bb 100644 --- a/benchmark/poseidon/poseidon_benchmark.cc +++ b/benchmark/poseidon/poseidon_benchmark.cc @@ -47,7 +47,7 @@ int RealMain(int argc, char** argv) { runner.RunExternal(Vendor::Arkworks(), run_poseidon_arkworks); if (config.check_results()) { - CHECK_EQ(result, result_arkworks) << "Result not matched"; + CHECK_EQ(result, result_arkworks) << "Results do not match"; } reporter.AddAverageAsLastColumn(); diff --git a/tachyon/crypto/commitments/fri/two_adic_fri.h b/tachyon/crypto/commitments/fri/two_adic_fri.h index 97ba1dc52..0bfbd6ab6 100644 --- a/tachyon/crypto/commitments/fri/two_adic_fri.h +++ b/tachyon/crypto/commitments/fri/two_adic_fri.h @@ -336,18 +336,19 @@ class TwoAdicFRI { for (size_t round = 0; round < num_rounds; ++round) { absl::Span>> matrices = matrices_by_round[round]; - const OpeningPointsForRound& points = points_by_round[round]; - for (const Eigen::Map>& matrix : matrices) { + const OpeningPointsForRound& points_vec_for_round = + points_by_round[round]; + for (size_t i = 0; i < matrices.size(); ++i) { + const Eigen::Map>& matrix = matrices[i]; + const std::vector& points_for_mat = points_vec_for_round[i]; uint32_t log_num_rows = base::bits::CheckedLog2(static_cast(matrix.rows())); max_log_num_rows = std::max(max_log_num_rows, log_num_rows); - for (const std::vector& point_list : points) { - for (const ExtF& point : point_list) { - const auto [it, inserted] = - max_log_num_rows_for_point.try_emplace(point, log_num_rows); - if (!inserted) { - it->second = std::max(it->second, log_num_rows); - } + for (const ExtF& point : points_for_mat) { + const auto [it, inserted] = + max_log_num_rows_for_point.try_emplace(point, log_num_rows); + if (!inserted) { + it->second = std::max(it->second, log_num_rows); } } } @@ -385,7 +386,7 @@ class TwoAdicFRI { // https://hackmd.io/@vbuterin/barycentric_evaluation template static std::vector InterpolateCoset( - const Eigen::MatrixBase& coset_evals, F shift, + const Eigen::MatrixBase& coset_evals, const F shift, const ExtF& point) { TRACE_EVENT("Utils", "InterpolateCoset"); size_t num_rows = static_cast(coset_evals.rows()); diff --git a/tachyon/crypto/commitments/fri/verify.h b/tachyon/crypto/commitments/fri/verify.h index 5820ec153..f23bb3386 100644 --- a/tachyon/crypto/commitments/fri/verify.h +++ b/tachyon/crypto/commitments/fri/verify.h @@ -97,10 +97,11 @@ template ro_num_rows; - std::vector ro_value; + std::vector ro_values; size_t index = challenger.SampleBits(log_max_num_rows); VLOG(2) << "FRI(index[" << i << "]): " << index; - open_input(index, proof.query_proofs[i].input_proof, ro_num_rows, ro_value); + open_input(index, proof.query_proofs[i].input_proof, ro_num_rows, + ro_values); #if DCHECK_IS_ON() // Check reduced openings sorted by |num_rows| descending @@ -114,7 +115,7 @@ template ::Commitment; using ProverData = typename MixedMatrixCommitmentSchemeTraits::ProverData; - using Digest = Commitment; - using Proof = std::vector; + using Proof = std::vector; ExtensionFieldMerkleTreeMMCS() = default; ExtensionFieldMerkleTreeMMCS(InnerMMCS&& inner) : inner_(std::move(inner)) {} diff --git a/tachyon/math/polynomials/univariate/radix2_evaluation_domain.h b/tachyon/math/polynomials/univariate/radix2_evaluation_domain.h index 8954a7a34..aafcf3ec4 100644 --- a/tachyon/math/polynomials/univariate/radix2_evaluation_domain.h +++ b/tachyon/math/polynomials/univariate/radix2_evaluation_domain.h @@ -113,7 +113,7 @@ class Radix2EvaluationDomain // For the second half, we flip the DIT, working in bit-reversed order. ReverseMatrixIndexBits(mat); - RunParallelRowChunksReversed(mat, cache_->rev_roots_vec, + RunParallelRowChunksReversed(mat, cache_->bitrev_roots_vec, cache_->packed_roots_vec[1]); ReverseMatrixIndexBits(mat); } @@ -145,7 +145,7 @@ class Radix2EvaluationDomain // For the second half, we flip the DIT, working in bit-reversed order. ReverseMatrixIndexBits(mat); - RunParallelRowChunksReversed(mat, cache_->rev_inv_roots_vec, + RunParallelRowChunksReversed(mat, cache_->bitrev_inv_roots_vec, cache_->packed_inv_roots_vec[1]); // We skip the final bit-reversal, since the next FFT expects bit-reversed // input. @@ -160,7 +160,7 @@ class Radix2EvaluationDomain // Reverse bits because |mat| is encoded in bit-reversed order size_t start = chunk_offset * chunk_size; F weight = this->size_inv_ * shift.Pow(start); - // NOTE: It is not possible to have empty chunk so this is safe + // NOTE: It is not possible to have an empty chunk so this is safe for (size_t row = start; row < start + len - 1; ++row) { mat.row(base::bits::ReverseBitsLen(row, this->log_size_of_group_)) *= weight; @@ -189,7 +189,7 @@ class Radix2EvaluationDomain // For the second half, we flip the DIT, working in bit-reversed order. ReverseMatrixIndexBits(out); - domain->RunParallelRowChunksReversed(out, domain->cache_->rev_roots_vec, + domain->RunParallelRowChunksReversed(out, domain->cache_->bitrev_roots_vec, domain->cache_->packed_roots_vec[1]); if (reverse_at_last) { ReverseMatrixIndexBits(out); diff --git a/tachyon/math/polynomials/univariate/radix2_twiddle_cache.h b/tachyon/math/polynomials/univariate/radix2_twiddle_cache.h index 2dbf6bc3e..4a219b6b1 100644 --- a/tachyon/math/polynomials/univariate/radix2_twiddle_cache.h +++ b/tachyon/math/polynomials/univariate/radix2_twiddle_cache.h @@ -27,8 +27,8 @@ class Radix2TwiddleCache { struct Item { // For small prime fields - std::vector rev_roots_vec; - std::vector rev_inv_roots_vec; + std::vector bitrev_roots_vec; + std::vector bitrev_inv_roots_vec; std::vector> packed_roots_vec; std::vector> packed_inv_roots_vec; // For all finite fields @@ -80,16 +80,16 @@ class Radix2TwiddleCache { packed_inv_roots_vec[0].resize(vec_largest_size); packed_roots_vec[1].resize(vec_largest_size); packed_inv_roots_vec[1].resize(vec_largest_size); - rev_roots_vec = SwapBitRevElements(largest); - rev_inv_roots_vec = SwapBitRevElements(largest_inv); + bitrev_roots_vec = SwapBitRevElements(largest); + bitrev_inv_roots_vec = SwapBitRevElements(largest_inv); OMP_PARALLEL_FOR(size_t i = 0; i < vec_largest_size; ++i) { packed_roots_vec[0][i] = PackedPrimeField::Broadcast(largest[i]); packed_inv_roots_vec[0][i] = PackedPrimeField::Broadcast(largest_inv[i]); packed_roots_vec[1][i] = - PackedPrimeField::Broadcast(rev_roots_vec[i]); + PackedPrimeField::Broadcast(bitrev_roots_vec[i]); packed_inv_roots_vec[1][i] = - PackedPrimeField::Broadcast(rev_inv_roots_vec[i]); + PackedPrimeField::Broadcast(bitrev_inv_roots_vec[i]); } }