File tree 3 files changed +66
-0
lines changed
3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright (C) 2024 Albin Ahlbäck
3
+
4
+ This file is part of FLINT.
5
+
6
+ FLINT is free software: you can redistribute it and/or modify it under
7
+ the terms of the GNU Lesser General Public License (LGPL) as published
8
+ by the Free Software Foundation; either version 3 of the License, or
9
+ (at your option) any later version. See <https://www.gnu.org/licenses/>.
10
+ */
11
+
12
+ #include "flint-mparam.h"
13
+ #include "mpn_extras.h"
14
+ #include "tune.h"
15
+
16
+ #undef FLINT_MPN_MULHIGH_K_TAB_SIZE
17
+ #undef FLINT_MPN_MULHIGH_K_TAB
18
+ #define TUNE_PROGRAM 1
19
+
20
+ #define FLINT_MPN_MULHIGH_K_TAB_SIZE FLINT_MPN_MULHIGH_K_TAB_MAX_SIZE
21
+ #define flint_mpn_mulhigh_k_tab flint_mpn_mulhigh_k_tab_0
22
+ #define _flint_mpn_mulhigh_n_mulders_recursive _flint_mpn_mulhigh_n_mulders_recursive_0
23
+ #define _flint_mpn_mulhigh_n_mulders _flint_mpn_mulhigh_n_mulders_0
24
+
25
+ #include "mpn_extras/mulhigh.c"
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright (C) 2024 Albin Ahlbäck
3
+
4
+ This file is part of FLINT.
5
+
6
+ FLINT is free software: you can redistribute it and/or modify it under
7
+ the terms of the GNU Lesser General Public License (LGPL) as published
8
+ by the Free Software Foundation; either version 3 of the License, or
9
+ (at your option) any later version. See <https://www.gnu.org/licenses/>.
10
+ */
11
+
12
+ #include "mpn_extras.h"
13
+ #include "tune.h"
14
+
15
+ #undef FLINT_MPN_MULHIGH_K_TAB_SIZE
16
+ #define FLINT_MPN_MULHIGH_K_TAB_SIZE FLINT_MPN_MULHIGH_K_TAB_MAX_SIZE
17
+
18
+ #define flint_mpn_mulhigh_k_tab flint_mpn_mulhigh_k_tab_0
19
+ #define _flint_mpn_mulhigh_n_mulders _flint_mpn_mulhigh_n_mulders_0
20
+
21
+ FLINT_DLL extern short flint_mpn_mulhigh_k_tab [FLINT_MPN_MULHIGH_K_TAB_SIZE ];
22
+ mp_limb_t _flint_mpn_mulhigh_n_mulders (mp_ptr , mp_srcptr , mp_srcptr , mp_size_t );
23
+
24
+ /* IDEA:
25
+
26
+ 1. Set all entries in flint_mpn_mulhigh_k_tab to zeroes.
27
+ 2. Skip any further altering of those entries having a corresponding
28
+ hardcoded version.
29
+ 3. When reasonable, check if basecase is faster.
30
+ 4. The sequence of k should be weakly increasing. We only need to consider k
31
+ between n / 2 and n.
32
+ TODO: How can we prune the search with this information?
33
+ 5. Run some warmups and run some hotlaps for each k. Only use the fastest
34
+ consistent time (see tune.c).
35
+ 6. Use the k that corresponds to the fastest k and push that to
36
+ flint_mpn_mulhigh_k_tab so that it can be used in consecutive runs.
37
+ */
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ void n_param_clear(void *);
42
42
double _tune_n_xgcd_0 (void * );
43
43
double _tune_n_xgcd_1 (void * );
44
44
45
+ /* mpn_extras ****************************************************************/
46
+
47
+ #define FLINT_MPN_MULHIGH_K_TAB_MAX_SIZE 4096
48
+
45
49
/* n_mod_vec *****************************************************************/
46
50
#if WANT_N_MOD
47
51
struct n_mod_vec_param_0
You can’t perform that action at this time.
0 commit comments