ENH,BLD: Finalize interface meson.build
This commit is contained in:
parent
998602062a
commit
ea55287038
|
@ -1,29 +1,3 @@
|
||||||
_kinds = []
|
|
||||||
real_kinds = ['s', 'd']
|
|
||||||
if get_option('exprecision')
|
|
||||||
real_kinds += 'q'
|
|
||||||
endif
|
|
||||||
complex_kinds = ['c', 'z', 'x']
|
|
||||||
extended_kinds = ['dx', 'bf16']
|
|
||||||
|
|
||||||
blas_roots = []
|
|
||||||
blas1_roots = [
|
|
||||||
# These don't exist as roots.
|
|
||||||
# ismax amax isamax amin ismin isamin
|
|
||||||
# TODO: Why is dsdot in sblas1objs!?
|
|
||||||
'axpy', 'swap', 'copy', 'scal', 'dot', 'dsdot', 'asum', 'sum', 'nrm2', 'max',
|
|
||||||
'rot'#, 'rotg', 'rotm', 'rotmg', 'axpby',
|
|
||||||
]
|
|
||||||
blas2_roots = [
|
|
||||||
'gemv', 'ger', 'trsv', 'trmv', 'symv', 'syr', 'syr2', 'gbmv', 'sbmv',
|
|
||||||
'spmv', 'spr', 'spr2', 'tbsv', 'tbmv', 'tpsv', 'tpmv',
|
|
||||||
]
|
|
||||||
blas3_roots = [
|
|
||||||
# TODO: trmm is trsm with a flag
|
|
||||||
'gemm', 'symm', 'trsm', 'syrk', 'syr2k', 'omatcopy', 'imatcopy', 'geadd',
|
|
||||||
'gemmt'
|
|
||||||
]
|
|
||||||
|
|
||||||
_blas_roots = [
|
_blas_roots = [
|
||||||
# NOTE: q, qx, x, xq do not have cblas_ rules in the Makefile
|
# NOTE: q, qx, x, xq do not have cblas_ rules in the Makefile
|
||||||
# NOTE: https://developer.arm.com/documentation/101004/2310/BLAS-Basic-Linear-Algebra-Subprograms/CBLAS-functions?lang=en
|
# NOTE: https://developer.arm.com/documentation/101004/2310/BLAS-Basic-Linear-Algebra-Subprograms/CBLAS-functions?lang=en
|
||||||
|
@ -377,72 +351,72 @@ _blas_roots = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# addl_srcs = {
|
_interface_libs = []
|
||||||
# 'symm': '-DHEMM'
|
foreach conf : _blas_roots
|
||||||
# }
|
foreach type : conf['_types']
|
||||||
|
# Seed with common args
|
||||||
|
compiler_args = [_cargs]
|
||||||
|
# Set the type arguments
|
||||||
|
if precision_mappings.get(type).has_key('def')
|
||||||
|
foreach d : precision_mappings[type]['def']
|
||||||
|
compiler_args += ['-D' + d]
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
if precision_mappings.get(type).has_key('undef')
|
||||||
|
foreach u : precision_mappings[type]['undef']
|
||||||
|
compiler_args += ['-U' + u]
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
|
||||||
# Generated
|
# Construct the actual symbol names
|
||||||
# NOTE: Remember to check sourcesets as a simpler mechanism
|
sym_name = conf['base'].replace('?', type)
|
||||||
# TODO: Generated the imax and max via use_abs use_min
|
if conf.get('cblas', false)
|
||||||
interface_confs = []
|
cblas_sym_name = 'cblas_' + sym_name
|
||||||
blas_roots += blas1_roots
|
endif
|
||||||
blas_roots += blas2_roots
|
|
||||||
blas_roots += blas3_roots
|
|
||||||
_kinds += real_kinds
|
|
||||||
foreach root : blas1_roots
|
|
||||||
fname = root + '.c'
|
|
||||||
defs = []
|
|
||||||
# if root in addl_srcs
|
|
||||||
# defs += addl_srcs[root]
|
|
||||||
# endif
|
|
||||||
foreach prec : real_kinds
|
|
||||||
_defs = []
|
|
||||||
name = prec + fname
|
|
||||||
if prec == 'd'
|
|
||||||
_defs += ['-UCOMPLEX', '-DDOUBLE']
|
|
||||||
elif prec == 's'
|
|
||||||
_defs += ['-UCOMPLEX', '-UDOUBLE']
|
|
||||||
elif prec == 'cs'
|
|
||||||
_defs += ['-DCOMPLEX', '-UDOUBLE']
|
|
||||||
endif
|
|
||||||
interface_confs += {'defs': _defs,
|
|
||||||
'name': prec + root,
|
|
||||||
'src': fname}
|
|
||||||
interface_confs += {'defs': _defs + '-DCBLAS',
|
|
||||||
'name': 'cblas_' + prec + root,
|
|
||||||
'src': fname}
|
|
||||||
endforeach
|
|
||||||
endforeach
|
|
||||||
message(interface_confs)
|
|
||||||
|
|
||||||
# if get_option('bfloat16')
|
# Construct conditionals
|
||||||
# TODO: Handle bfloat16
|
if conf.has_key('def')
|
||||||
# sblas1_srcs += files('sbdot.c')
|
foreach d : conf['def']
|
||||||
# sblas2_srcs += files('sbgemv.c')
|
compiler_args += ['-D' + d]
|
||||||
# sblas3_srcs += files(['sbgemm.c', 'sbgemmt.c'])
|
endforeach
|
||||||
# endif
|
foreach u : conf['undef']
|
||||||
|
compiler_args += ['-U' + u]
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
|
||||||
_static_libs = []
|
# Make mangled symbols
|
||||||
foreach conf: interface_confs
|
# TODO: This might be conditional on other options
|
||||||
sym_name = conf['name']
|
sym_underscored = f'@sym_name@_'
|
||||||
sym_underscored = f'@sym_name@_'
|
compiler_args += [
|
||||||
_static_libs += static_library(
|
|
||||||
sym_name,
|
|
||||||
conf['src'],
|
|
||||||
include_directories: _inc,
|
|
||||||
c_args: [
|
|
||||||
conf['defs'],
|
|
||||||
_cargs,
|
|
||||||
f'-DASMNAME=@sym_name@',
|
f'-DASMNAME=@sym_name@',
|
||||||
f'-DASMFNAME=@sym_underscored@',
|
f'-DASMFNAME=@sym_underscored@',
|
||||||
f'-DNAME=@sym_underscored@',
|
f'-DNAME=@sym_underscored@',
|
||||||
f'-DCNAME=@sym_name@',
|
f'-DCNAME=@sym_name@',
|
||||||
f'-DCHAR_NAME="@sym_underscored@"',
|
f'-DCHAR_NAME="@sym_underscored@"',
|
||||||
f'-DCHAR_CNAME="@sym_name@"',
|
f'-DCHAR_CNAME="@sym_name@"'
|
||||||
],
|
]
|
||||||
)
|
|
||||||
|
# Create the static library for each symbol
|
||||||
|
lib = static_library(
|
||||||
|
sym_name,
|
||||||
|
sources: conf['fname'],
|
||||||
|
include_directories: _inc,
|
||||||
|
c_args: compiler_args
|
||||||
|
)
|
||||||
|
_interface_libs += lib
|
||||||
|
|
||||||
|
# If it's a CBLAS symbol, also create that
|
||||||
|
if conf.get('cblas', false)
|
||||||
|
cblas_lib = static_library(
|
||||||
|
cblas_sym_name,
|
||||||
|
sources: conf['fname'],
|
||||||
|
include_directories: _inc,
|
||||||
|
c_args: compiler_args + ['-DCBLAS']
|
||||||
|
)
|
||||||
|
_interface_libs += cblas_lib
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
_interface = static_library('_interface',
|
# Create a combined static library linking all individual static libraries
|
||||||
c_args: _cargs,
|
_interface = static_library('_interface', link_whole: _interface_libs)
|
||||||
link_whole: _static_libs)
|
|
||||||
|
|
22
meson.build
22
meson.build
|
@ -256,14 +256,22 @@ endif
|
||||||
# Also see:
|
# Also see:
|
||||||
# L1: https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-1/blas-level-1-routines-and-functions.html
|
# L1: https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-1/blas-level-1-routines-and-functions.html
|
||||||
precision_mappings = {
|
precision_mappings = {
|
||||||
's': {'undef': ['COMPLEX', 'DOUBLE'], 'def': []},
|
's': {'undef': ['COMPLEX', 'DOUBLE']},
|
||||||
'd': {'undef': ['COMPLEX'], 'def': ['DOUBLE']},
|
'd': {'undef': ['COMPLEX'], 'def': ['DOUBLE']},
|
||||||
'q': {'undef': ['COMPLEX'], 'def': ['XDOUBLE']},
|
'q': {'undef': ['COMPLEX'], 'def': ['XDOUBLE']},
|
||||||
'c': {'undef': ['DOUBLE'], 'def': ['COMPLEX']},
|
'c': {'undef': ['DOUBLE'], 'def': ['COMPLEX']},
|
||||||
'z': {'undef': [], 'def': ['COMPLEX', 'DOUBLE']},
|
'z': {'def': ['COMPLEX', 'DOUBLE']},
|
||||||
'x': {'undef': [], 'def': ['COMPLEX', 'XDOUBLE']},
|
'x': {'def': ['COMPLEX', 'XDOUBLE']},
|
||||||
'cs': {'undef': ['DOUBLE'], 'def': ['COMPLEX']},
|
'cs': {'undef': ['DOUBLE'], 'def': ['COMPLEX']},
|
||||||
# zd is the same as z
|
'sc': {'undef': ['DOUBLE'], 'def': ['COMPLEX']},
|
||||||
|
'dz': {'def': ['COMPLEX', 'DOUBLE']},
|
||||||
|
'zd': {'def': ['COMPLEX', 'DOUBLE']},
|
||||||
|
'qx': {'def': ['COMPLEX', 'DOUBLE']},
|
||||||
|
'xq': {'def': ['COMPLEX', 'DOUBLE']},
|
||||||
|
'': {}, # special case, for cblas_?dot*_sub
|
||||||
|
# xq / qx == x
|
||||||
|
# sc / cs == c
|
||||||
|
# zd / dz is the same as z
|
||||||
# 'zd': {'undef': [], 'def': ['COMPLEX', 'DOUBLE']},
|
# 'zd': {'undef': [], 'def': ['COMPLEX', 'DOUBLE']},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +279,7 @@ precision_mappings = {
|
||||||
_inc = include_directories('.')
|
_inc = include_directories('.')
|
||||||
# subdir('lapack-netlib')
|
# subdir('lapack-netlib')
|
||||||
subdir('interface')
|
subdir('interface')
|
||||||
subdir('kernel')
|
# subdir('kernel')
|
||||||
|
|
||||||
_openblas = static_library('openblas',
|
# _openblas = static_library('openblas',
|
||||||
link_whole: [ _interface, _kern])
|
# link_whole: [ _interface, _kern])
|
||||||
|
|
Loading…
Reference in New Issue