TMP: Be more DRY

This commit is contained in:
Rohit Goswami 2024-03-17 02:22:36 +00:00 committed by Mateusz Sokół
parent e9a3897174
commit c76e7c6b95
1 changed files with 58 additions and 35 deletions

View File

@ -5,7 +5,7 @@ _rk = ['s', 'd']
_ck = ['c', 'z']
_std_dk = _rk + _ck # Standard precisions
# TODO: Actually test and set this
if fma3
if true
fma3_flag = '-mfma'
endif
# TODO: This is currently following x86_64 generic for src and dir, but it needs
@ -16,7 +16,7 @@ endif
# undef --> -Uwhatever
# def --> -Dwhatever
# addl --> passed AS IS
kops_array = [
base_kops = [
# Level 1 BLAS
{
'base': 'rot',
@ -25,14 +25,11 @@ kops_array = [
's' : {
'dir': 'arm',
'kernel': 'rot.c',
'undef': ['COMPLEX', 'DOUBLE'],
'addl': [fma3_flag],
},
'd' : {
'dir': 'arm',
'kernel': 'rot.c',
'undef': ['COMPLEX'],
'def': ['DOUBLE'],
'addl': [fma3_flag],
},
'q' : {
@ -41,6 +38,8 @@ kops_array = [
'undef': ['COMPLEX'],
'def': ['DXDOUBLE'],
},
# TODO: rot is nonstandard in this instance, taking cs zd xq
# The others (scal, swap) take c z x
'cs' : {
'dir': 'arm',
'kernel': 'zrot.c',
@ -59,40 +58,64 @@ kops_array = [
},
},
},
{'symb': 'swap',
'src': {'real': 'swap', 'cmplx': 'zswap', 'ext': '.c'},
'dir': 'arm', 'precs': _std_dk },
{'symb': 'scal',
'src': {'real': 'scal', 'cmplx': 'zscal', 'ext': '.c'},
'dir': 'arm', 'precs': _std_dk },
{'symb': 'copy',
'src': {'real': 'copy', 'cmplx': 'zcopy', 'ext': '.c'},
'dir': 'arm', 'precs': _std_dk },
{'symb': 'axpy',
'src': {'real': 'axpy', 'cmplx': 'zaxpy', 'ext': '.c'},
'dir': 'arm', 'precs': _std_dk },
{'symb': 'dot',
'src': {'real': 'dot', 'cmplx': 'zdot', 'ext': '.c'},
'dir': 'arm', 'precs': _std_dk },
# {'symb': 'swap',
# 'src': {'real': 'swap', 'cmplx': 'zswap', 'ext': '.c'},
# 'dir': 'arm', 'precs': _std_dk },
# {'symb': 'scal',
# 'src': {'real': 'scal', 'cmplx': 'zscal', 'ext': '.c'},
# 'dir': 'arm', 'precs': _std_dk },
# {'symb': 'copy',
# 'src': {'real': 'copy', 'cmplx': 'zcopy', 'ext': '.c'},
# 'dir': 'arm', 'precs': _std_dk },
# {'symb': 'axpy',
# 'src': {'real': 'axpy', 'cmplx': 'zaxpy', 'ext': '.c'},
# 'dir': 'arm', 'precs': _std_dk },
# {'symb': 'dot',
# 'src': {'real': 'dot', 'cmplx': 'zdot', 'ext': '.c'},
# 'dir': 'arm', 'precs': _std_dk },
]
kernel_confs = []
foreach root : blas1_roots
fname = root + '.S'
defs = []
foreach prec : real_kinds
name = prec + fname + '_k'
kernel_confs += {'defs': defs, 'name': name, 'src': fname}
foreach _kop : base_kops
foreach pkey, pval : _kop['precs']
kcfg = {
'name': pkey + _kop['base'] + '_k',
# TODO: This should probably be in files() after this is ready
# dictionaries with files can't be printed with message
'src': pval['dir'] + '/' + pval['kernel'],
}
if pval.has_key('addl')
kcfg += {'addl': pval['addl']}
endif
if 's' == pkey
kcfg += {'undef': ['COMPLEX', 'DOUBLE']}
endif
if 'd' == pkey
kcfg += {
'undef': ['COMPLEX'],
'def': ['DOUBLE'],
}
endif
message(kcfg)
endforeach
endforeach
_static_libs = []
foreach conf: kernel_confs
_static_libs += static_library(
conf['name'],
conf['src'],
include_directories: _inc,
c_args: conf['defs'],
)
endforeach
# foreach root : blas1_roots
# fname = root + '.S'
# defs = []
# foreach prec : real_kinds
# name = prec + fname + '_k'
# kernel_confs += {'defs': defs, 'name': name, 'src': fname}
# endforeach
# endforeach
# _static_libs = []
# foreach conf: kernel_confs
# _static_libs += static_library(
# conf['name'],
# conf['src'],
# include_directories: _inc,
# c_args: conf['defs'],
# )
# endforeach