Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Aug 29, 2024
2 parents 91c47a4 + 5207698 commit 3bc44a7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion thirdparties/randen/vector128.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define RANDEN_BIG_ENDIAN 1
#include <altivec.h>

#elif defined(__ARM_NEON) && defined(__ARM_FEATURE_CRYPTO)
#elif defined(__ARM_NEON) && defined(__ARM_FEATURE_AES)

#define RANDEN_ARM 1
#include <arm_neon.h>
Expand Down
29 changes: 27 additions & 2 deletions thirdparties/spqliox_aarch64/fft_processor_spqliox_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ void FFT_Processor_Spqliox_AArch64::execute_reverse_int(double *res,
for (size_t i = 0; i < N; i++) res[i] = real_inout[i];
}

void FFT_Processor_Spqliox_AArch64::execute_reverse_uint(double *res,
const uint32_t *a)
{
for (size_t i = 0; i < N; i++) real_inout[i] = (double)a[i];

ifft_(real_inout, NULL, NULL, &tables_reverse_, real_inout,
table_negation_reverse_.trig_tables);

for (size_t i = 0; i < N; i++) res[i] = real_inout[i];
}

void FFT_Processor_Spqliox_AArch64::execute_reverse_torus32(double *res,
const uint32_t *a)
{
Expand Down Expand Up @@ -236,7 +247,21 @@ void FFT_Processor_Spqliox_AArch64::execute_direct_torus32_rescale(
fft_(dst, sit, send, bla, &tables_direct_, real_inout,
table_negation_forward_.trig_tables);
for (int32_t i = 0; i < N; i++)
res[i] = uint32_t(int64_t(real_inout[i] / (Δ / 4)));
res[i] = uint32_t(int64_t(real_inout[i] / Δ));
}

void FFT_Processor_Spqliox_AArch64::execute_direct_torus64_rescale(
uint64_t *res, const double *a, const double Δ)
{
const double *sit = a;
const double *send = a + N;
static const double _2sN = double(2) / double(N);
const double *bla = &_2sN;
double *dst = real_inout;
fft_(dst, sit, send, bla, &tables_direct_, real_inout,
table_negation_forward_.trig_tables);
for (int32_t i = 0; i < N; i++)
res[i] = uint64_t(int64_t(real_inout[i] / Δ));
}

void FFT_Processor_Spqliox_AArch64::execute_direct_torus64(uint64_t *res,
Expand Down Expand Up @@ -267,4 +292,4 @@ void FFT_Processor_Spqliox_AArch64::execute_direct_torus64(uint64_t *res,
FFT_Processor_Spqliox_AArch64::~FFT_Processor_Spqliox_AArch64() {}

thread_local FFT_Processor_Spqliox_AArch64 fftplvl1(TFHEpp::lvl1param::n);
thread_local FFT_Processor_Spqliox_AArch64 fftplvl2(TFHEpp::lvl2param::n);
thread_local FFT_Processor_Spqliox_AArch64 fftplvl2(TFHEpp::lvl2param::n);
7 changes: 6 additions & 1 deletion thirdparties/spqliox_aarch64/fft_processor_spqliox_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ class FFT_Processor_Spqliox_AArch64 {

void execute_reverse_int(double *res, const int32_t *a);

void execute_reverse_uint(double *res, const uint32_t *a);

void execute_reverse_torus32(double *res, const uint32_t *a);

void execute_direct_torus32(uint32_t *res, const double *a);

void execute_direct_torus32_rescale(uint32_t *res, const double *a,
const double Δ);

void execute_direct_torus64_rescale(uint64_t *res, const double *a,
const double Δ);

void execute_reverse_torus64(double *res, const uint64_t *a);

void execute_direct_torus64(uint64_t *res, const double *a);
Expand All @@ -49,4 +54,4 @@ class FFT_Processor_Spqliox_AArch64 {
};

extern thread_local FFT_Processor_Spqliox_AArch64 fftplvl1;
extern thread_local FFT_Processor_Spqliox_AArch64 fftplvl2;
extern thread_local FFT_Processor_Spqliox_AArch64 fftplvl2;

0 comments on commit 3bc44a7

Please sign in to comment.