xref: /aosp_15_r20/external/executorch/extension/llm/custom_ops/spinquant/third-party/FFHT/fht_impl.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 #ifndef _FHT_IMPL_H__
2 #define _FHT_IMPL_H__
3 
4 #include "fast_copy.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #ifdef __aarch64__
11 #include "fht_neon.c"
12 #define VECTOR_WIDTH (16u)
13 #else
14 #ifdef __AVX__
15 #include "fht_avx.c"
16 #define VECTOR_WIDTH (32u)
17 #else
18 #include "fht_sse.c"
19 #define VECTOR_WIDTH (16u)
20 #endif
21 #endif
22 
fht_float_oop(float * in,float * out,int log_n)23 int fht_float_oop(float* in, float* out, int log_n) {
24   fast_copy(out, in, sizeof(float) << log_n);
25   return fht_float(out, log_n);
26 }
27 
28 #ifndef __aarch64__
fht_double_oop(double * in,double * out,int log_n)29 int fht_double_oop(double* in, double* out, int log_n) {
30   fast_copy(out, in, sizeof(double) << log_n);
31   return fht_double(out, log_n);
32 }
33 #endif
34 
35 #ifdef __cplusplus
36 } // extern "C"
37 #endif
38 
39 #endif // ifndef _FHT_IMPL_H__
40