Skip to content

Commit

Permalink
Added aligned_array
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Jul 18, 2024
1 parent a6462b3 commit faa0592
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/detwfa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ TRGSWFFT<P> TRGSWFFTOneGen()
return ApplyFFT2trgsw<P>(trgsw);
}

alignas(32) const TRGSWFFT<lvl1param> trgswonelvl1 =
alignas(64) const TRGSWFFT<lvl1param> trgswonelvl1 =
TRGSWFFTOneGen<lvl1param>();
alignas(32) const TRGSWFFT<lvl2param> trgswonelvl2 =
alignas(64) const TRGSWFFT<lvl2param> trgswonelvl2 =
TRGSWFFTOneGen<lvl2param>();

template <class bkP>
Expand Down
4 changes: 3 additions & 1 deletion include/params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace TFHEpp {

template<class T, size_t N> struct alignas( 64 ) aligned_array : public std::array<T,N> { };

enum class ErrorDistribution { ModularGaussian, CenteredBinomial };

// Use old 80bit security parameters. It is faster, but not recommended.
Expand Down Expand Up @@ -106,7 +108,7 @@ using TRLWERAINTT = std::array<PolynomialRAINTT<P>, P::k + 1>;
template <class P>
using TRGSW = std::array<TRLWE<P>, (P::k + 1) * P::l>;
template <class P>
using TRGSWFFT = std::array<TRLWEInFD<P>, (P::k + 1) * P::l>;
using TRGSWFFT = aligned_array<TRLWEInFD<P>, (P::k + 1) * P::l>;
template <class P>
using TRGSWNTT = std::array<TRLWENTT<P>, (P::k + 1) * P::l>;
template <class P>
Expand Down
1 change: 1 addition & 0 deletions include/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,5 @@ inline void Automorphism(Polynomial<P> &res, const Polynomial<P> &poly,
res[index & Nmask] += poly[i];
}
}

} // namespace TFHEpp
2 changes: 1 addition & 1 deletion test/circuitbootstrapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main()
for (int i = 0; i < num_test; i++) pones[i] = true;
alignas(64) std::vector<TFHEpp::TRLWE<typename privksP::targetP>> ca(num_test);
alignas(64) std::vector<TFHEpp::TLWE<typename iksP::domainP>> cones(num_test);
std::vector<TFHEpp::TRGSWFFT<typename privksP::targetP>,TFHEpp::AlignedAllocator<TFHEpp::TRGSWFFT<typename privksP::targetP>,64>> bootedTGSW(
std::vector<TFHEpp::TRGSWFFT<typename privksP::targetP>> bootedTGSW(
num_test);

for (int i = 0; i < num_test; i++)
Expand Down

0 comments on commit faa0592

Please sign in to comment.