From 1a6fe7c059fd5a35fa9bcd82e72bb952110c3f16 Mon Sep 17 00:00:00 2001 From: Ohad Agadi Date: Tue, 29 Oct 2024 16:36:55 +0200 Subject: [PATCH] batch inverse vectorised --- crates/prover/src/core/backend/simd/very_packed_m31.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/prover/src/core/backend/simd/very_packed_m31.rs b/crates/prover/src/core/backend/simd/very_packed_m31.rs index e7617b020..781212d6f 100644 --- a/crates/prover/src/core/backend/simd/very_packed_m31.rs +++ b/crates/prover/src/core/backend/simd/very_packed_m31.rs @@ -7,7 +7,7 @@ use super::cm31::PackedCM31; use super::m31::{PackedM31, N_LANES}; use super::qm31::PackedQM31; use crate::core::fields::cm31::CM31; -use crate::core::fields::m31::{pow2147483645, M31}; +use crate::core::fields::m31::M31; use crate::core::fields::qm31::QM31; use crate::core::fields::FieldExpOps; @@ -246,9 +246,8 @@ impl One for Vectorized { impl FieldExpOps for Vectorized { fn inverse(&self) -> Self { - Vectorized::from_fn(|i| { - assert!(!self.0[i].is_zero(), "0 has no inverse"); - pow2147483645(self.0[i]) - }) + let mut dst = [A::zero(); N]; + A::batch_inverse(&self.0, &mut dst); + dst.into() } }