1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
/*
-- MAGMA (version 2.9.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date January 2025
@author Ahmad Abdelfattah
*/
#include "magma_internal.h"
#ifdef MAGMA_HAVE_CUDA
#include"./gbtrf_tuning/dgbtrf_batch_a100.h"
#else
#include"./gbtrf_tuning/dgbtrf_batch_mi250x.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
// =============================================================================
/// @addtogroup magma_tuning
/// @{
////////////////////////////////////////////////////////////////////////////////
// auxiliary function to determine the parameters of batch zgbtrf
void
magma_get_zgbtrf_batched_params(
magma_int_t m, magma_int_t n,
magma_int_t kl, magma_int_t ku,
magma_int_t *nb, magma_int_t *threads)
{
// get index for kl, ku based on the rounded-up even
// values of the input bandwidths
int ikl = (kl + 1) / 2;
int iku = (ku + 1) / 2;
ikl--;
iku--;
// make sure kl and ku are in the range [0, 16]
ikl = min( max(ikl, 0), 15 );
iku = min( max(iku, 0), 15 );
// the tuning data for nb and threads are stored in 2D
// array of size 16x16. Each entry is for the even values
// of (kl, ku) in the range [2, 4, 6, ..., 32]
// TODO: generate tuning data for z-precision
#ifdef MAGMA_HAVE_CUDA
*nb = dgbtrf_batch_nb_a100[ikl][iku];
*threads = dgbtrf_batch_th_a100[ikl][iku];
#else
*nb = dgbtrf_batch_nb_mi250x[ikl][iku];
*threads = dgbtrf_batch_th_mi250x[ikl][iku];
#endif
}
////////////////////////////////////////////////////////////////////////////////
// auxiliary function to determine the parameters of batch cgbtrf
void
magma_get_cgbtrf_batched_params(
magma_int_t m, magma_int_t n,
magma_int_t kl, magma_int_t ku,
magma_int_t *nb, magma_int_t *threads)
{
// get index for kl, ku based on the rounded-up even
// values of the input bandwidths
int ikl = (kl + 1) / 2;
int iku = (ku + 1) / 2;
ikl--;
iku--;
// make sure kl and ku are in the range [0, 16]
ikl = min( max(ikl, 0), 15 );
iku = min( max(iku, 0), 15 );
// the tuning data for nb and threads are stored in 2D
// array of size 16x16. Each entry is for the even values
// of (kl, ku) in the range [2, 4, 6, ..., 32]
// TODO: generate tuning data for c-precision
#ifdef MAGMA_HAVE_CUDA
*nb = dgbtrf_batch_nb_a100[ikl][iku];
*threads = dgbtrf_batch_th_a100[ikl][iku];
#else
*nb = dgbtrf_batch_nb_mi250x[ikl][iku];
*threads = dgbtrf_batch_th_mi250x[ikl][iku];
#endif
}
////////////////////////////////////////////////////////////////////////////////
// auxiliary function to determine the parameters of batch dgbtrf
void
magma_get_dgbtrf_batched_params(
magma_int_t m, magma_int_t n,
magma_int_t kl, magma_int_t ku,
magma_int_t *nb, magma_int_t *threads)
{
// get index for kl, ku based on the rounded-up even
// values of the input bandwidths
int ikl = (kl + 1) / 2;
int iku = (ku + 1) / 2;
ikl--;
iku--;
// make sure kl and ku are in the range [0, 16]
ikl = min( max(ikl, 0), 15 );
iku = min( max(iku, 0), 15 );
// the tuning data for nb and threads are stored in 2D
// array of size 16x16. Each entry is for the even values
// of (kl, ku) in the range [2, 4, 6, ..., 32]
#ifdef MAGMA_HAVE_CUDA
*nb = dgbtrf_batch_nb_a100[ikl][iku];
*threads = dgbtrf_batch_th_a100[ikl][iku];
#else
*nb = dgbtrf_batch_nb_mi250x[ikl][iku];
*threads = dgbtrf_batch_th_mi250x[ikl][iku];
#endif
}
////////////////////////////////////////////////////////////////////////////////
// auxiliary function to determine the parameters of batch sgbtrf
void
magma_get_sgbtrf_batched_params(
magma_int_t m, magma_int_t n,
magma_int_t kl, magma_int_t ku,
magma_int_t *nb, magma_int_t *threads)
{
// get index for kl, ku based on the rounded-up even
// values of the input bandwidths
int ikl = (kl + 1) / 2;
int iku = (ku + 1) / 2;
ikl--;
iku--;
// make sure kl and ku are in the range [0, 16]
ikl = min( max(ikl, 0), 15 );
iku = min( max(iku, 0), 15 );
// the tuning data for nb and threads are stored in 2D
// array of size 16x16. Each entry is for the even values
// of (kl, ku) in the range [2, 4, 6, ..., 32]
// TODO: generate tuning data for s-precision
#ifdef MAGMA_HAVE_CUDA
*nb = dgbtrf_batch_nb_a100[ikl][iku];
*threads = dgbtrf_batch_th_a100[ikl][iku];
#else
*nb = dgbtrf_batch_nb_mi250x[ikl][iku];
*threads = dgbtrf_batch_th_mi250x[ikl][iku];
#endif
}
#ifdef __cplusplus
} // extern "C"
#endif
|