BLD: `utest` port

This commit is contained in:
Mateusz Sokół 2024-07-24 16:37:30 +00:00
parent 4547456d9d
commit fa7ba3121c
4 changed files with 197 additions and 14 deletions

View File

@ -1,7 +1,7 @@
interface_args = ['-include', f'@bldroot@/simd_conf.h']
if not build_without_cblas
interface_args += '-DCBLAS'
endif
# if not build_without_cblas
# interface_args += '-DCBLAS'
# endif
_blas_roots = [
# 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

View File

@ -56,12 +56,18 @@ base_kops = [
'modes': {
's': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'saxpy.c'}}},
'd': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'daxpy.c'}}},
'c': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'caxpy.c'}}},
'z': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'zaxpy.c'}}},
'c': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'caxpy.c', 'addl': ['-UCONJ']}}},
'z': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'zaxpy.c', 'addl': ['-UCONJ']}}},
# 'q': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'axpy.S'}}},
# 'x': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'zaxpy.S'}}},
},
},
{ 'base': '?axpyc',
'modes': {
'c': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'caxpy.c', 'addl': ['-DCONJ']}}},
'z': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'zaxpy.c', 'addl': ['-DCONJ']}}},
},
},
{ 'base': '?dot',
'modes': {
's': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'sdot.c'}}},
@ -84,7 +90,7 @@ base_kops = [
{ 'base': '?dsdot',
'modes': {
's': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'sdot.c'}}},
'd': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'sdot.c'}}},
'': {'exts': {'_k': {'dir': 'x86_64', 'kernel': 'sdot.c', 'addl': ['-DDSDOT']}}},
},
},
# TODO(rg): Add dsdotkernel conditionals
@ -863,15 +869,82 @@ base_kops = [
{ 'base': '?omatcopy_k',
'modes': {
's': {'exts': {
'_cn': {'dir': 'arm', 'kernel': 'omatcopy_cn.c',
'addl': ['-UROWM']},
'_rn': {'dir': 'arm', 'kernel': 'omatcopy_rn.c',
'addl': ['-DROWM']},
'_ct': {'dir': 'arm', 'kernel': 'omatcopy_ct.c',
'addl': ['-UROWM']},
'_rt': {'dir': 'x86_64', 'kernel': 'omatcopy_rt.c',
'addl': ['-DROWM']},
'_cn': {'dir': 'arm', 'kernel': 'omatcopy_cn.c', 'addl': ['-UROWM']},
'_rn': {'dir': 'arm', 'kernel': 'omatcopy_rn.c', 'addl': ['-DROWM']},
'_ct': {'dir': 'arm', 'kernel': 'omatcopy_ct.c', 'addl': ['-UROWM']},
'_rt': {'dir': 'arm', 'kernel': 'omatcopy_rt.c', 'addl': ['-DROWM']},
}},
'd': {'exts': {
'_cn': {'dir': 'arm', 'kernel': 'omatcopy_cn.c', 'addl': ['-UROWM']},
'_rn': {'dir': 'arm', 'kernel': 'omatcopy_rn.c', 'addl': ['-DROWM']},
'_ct': {'dir': 'arm', 'kernel': 'omatcopy_ct.c', 'addl': ['-UROWM']},
'_rt': {'dir': 'arm', 'kernel': 'omatcopy_rt.c', 'addl': ['-DROWM']},
}},
'c': {'exts': {
'_cn': {'dir': 'arm', 'kernel': 'zomatcopy_cn.c', 'addl': ['-UROWM', '-UCONJ']},
'_rn': {'dir': 'arm', 'kernel': 'zomatcopy_rn.c', 'addl': ['-DROWM', '-UCONJ']},
'_ct': {'dir': 'arm', 'kernel': 'zomatcopy_ct.c', 'addl': ['-UROWM', '-UCONJ']},
'_rt': {'dir': 'arm', 'kernel': 'zomatcopy_rt.c', 'addl': ['-DROWM', '-UCONJ']},
'_cnc': {'dir': 'arm', 'kernel': 'zomatcopy_cnc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rnc': {'dir': 'arm', 'kernel': 'zomatcopy_rnc.c', 'addl': ['-DROWM', '-DCONJ']},
'_ctc': {'dir': 'arm', 'kernel': 'zomatcopy_ctc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rtc': {'dir': 'arm', 'kernel': 'zomatcopy_rtc.c', 'addl': ['-DROWM', '-DCONJ']},
}},
'z': {'exts': {
'_cn': {'dir': 'arm', 'kernel': 'zomatcopy_cn.c', 'addl': ['-UROWM', '-UCONJ']},
'_rn': {'dir': 'arm', 'kernel': 'zomatcopy_rn.c', 'addl': ['-DROWM', '-UCONJ']},
'_ct': {'dir': 'arm', 'kernel': 'zomatcopy_ct.c', 'addl': ['-UROWM', '-UCONJ']},
'_rt': {'dir': 'arm', 'kernel': 'zomatcopy_rt.c', 'addl': ['-DROWM', '-UCONJ']},
'_cnc': {'dir': 'arm', 'kernel': 'zomatcopy_cnc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rnc': {'dir': 'arm', 'kernel': 'zomatcopy_rnc.c', 'addl': ['-DROWM', '-DCONJ']},
'_ctc': {'dir': 'arm', 'kernel': 'zomatcopy_ctc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rtc': {'dir': 'arm', 'kernel': 'zomatcopy_rtc.c', 'addl': ['-DROWM', '-DCONJ']},
}},
},
},
{ 'base': '?imatcopy_k',
'modes': {
's': {'exts': {
'_cn': {'dir': 'generic', 'kernel': 'imatcopy_cn.c', 'addl': ['-UROWM']},
'_rn': {'dir': 'generic', 'kernel': 'imatcopy_rn.c', 'addl': ['-DROWM']},
'_ct': {'dir': 'generic', 'kernel': 'imatcopy_ct.c', 'addl': ['-UROWM']},
'_rt': {'dir': 'generic', 'kernel': 'imatcopy_rt.c', 'addl': ['-DROWM']},
}},
'd': {'exts': {
'_cn': {'dir': 'generic', 'kernel': 'imatcopy_cn.c', 'addl': ['-UROWM']},
'_rn': {'dir': 'generic', 'kernel': 'imatcopy_rn.c', 'addl': ['-DROWM']},
'_ct': {'dir': 'generic', 'kernel': 'imatcopy_ct.c', 'addl': ['-UROWM']},
'_rt': {'dir': 'generic', 'kernel': 'imatcopy_rt.c', 'addl': ['-DROWM']},
}},
'c': {'exts': {
'_cn': {'dir': 'generic', 'kernel': 'zimatcopy_cn.c', 'addl': ['-UROWM', '-UCONJ']},
'_rn': {'dir': 'generic', 'kernel': 'zimatcopy_rn.c', 'addl': ['-DROWM', '-UCONJ']},
'_ct': {'dir': 'generic', 'kernel': 'zimatcopy_ct.c', 'addl': ['-UROWM', '-UCONJ']},
'_rt': {'dir': 'generic', 'kernel': 'zimatcopy_rt.c', 'addl': ['-DROWM', '-UCONJ']},
'_cnc': {'dir': 'generic', 'kernel': 'zimatcopy_cnc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rnc': {'dir': 'generic', 'kernel': 'zimatcopy_rnc.c', 'addl': ['-DROWM', '-DCONJ']},
'_ctc': {'dir': 'generic', 'kernel': 'zimatcopy_ctc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rtc': {'dir': 'generic', 'kernel': 'zimatcopy_rtc.c', 'addl': ['-DROWM', '-DCONJ']},
}},
'z': {'exts': {
'_cn': {'dir': 'generic', 'kernel': 'zimatcopy_cn.c', 'addl': ['-UROWM', '-UCONJ']},
'_rn': {'dir': 'generic', 'kernel': 'zimatcopy_rn.c', 'addl': ['-DROWM', '-UCONJ']},
'_ct': {'dir': 'generic', 'kernel': 'zimatcopy_ct.c', 'addl': ['-UROWM', '-UCONJ']},
'_rt': {'dir': 'generic', 'kernel': 'zimatcopy_rt.c', 'addl': ['-DROWM', '-UCONJ']},
'_cnc': {'dir': 'generic', 'kernel': 'zimatcopy_cnc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rnc': {'dir': 'generic', 'kernel': 'zimatcopy_rnc.c', 'addl': ['-DROWM', '-DCONJ']},
'_ctc': {'dir': 'generic', 'kernel': 'zimatcopy_ctc.c', 'addl': ['-UROWM', '-DCONJ']},
'_rtc': {'dir': 'generic', 'kernel': 'zimatcopy_rtc.c', 'addl': ['-DROWM', '-DCONJ']},
}},
},
},
{
'base': '?geadd',
'modes': {
's': {'exts': {'_k': {'dir': 'generic', 'kernel': 'geadd.c', 'addl': ['-UROWM']}}},
'd': {'exts': {'_k': {'dir': 'generic', 'kernel': 'geadd.c', 'addl': ['-UROWM']}}},
'c': {'exts': {'_k': {'dir': 'generic', 'kernel': 'zgeadd.c', 'addl': ['-UROWM']}}},
'z': {'exts': {'_k': {'dir': 'generic', 'kernel': 'zgeadd.c', 'addl': ['-UROWM']}}},
},
},
{ 'base': '?gemm_small_kernel',

View File

@ -550,3 +550,7 @@ pkg.generate(_openblas,
description: 'OpenBLAS via meson build',
version: f'@pkg_ver@_meson',
)
if build_testing
subdir('utest')
endif

106
utest/meson.build Normal file
View File

@ -0,0 +1,106 @@
sources_utest = [
config_h,
'utest_main.c',
'test_min.c',
'test_amax.c',
'test_ismin.c',
'test_rotmg.c',
'test_axpy.c',
'test_dotu.c',
'test_dsdot.c',
'test_swap.c',
'test_rot.c',
'test_dnrm2.c',
'test_zscal.c',
'test_amin.c',
'test_axpby.c',
]
dir_ext = 'test_extensions'
sources_utest_ext = [
config_h,
'utest_main.c',
dir_ext / 'xerbla.c',
dir_ext / 'common.c',
dir_ext / 'test_isamin.c',
dir_ext / 'test_idamin.c',
dir_ext / 'test_icamin.c',
dir_ext / 'test_izamin.c',
dir_ext / 'test_ssum.c',
dir_ext / 'test_dsum.c',
dir_ext / 'test_scsum.c',
dir_ext / 'test_dzsum.c',
dir_ext / 'test_saxpby.c',
dir_ext / 'test_daxpby.c',
dir_ext / 'test_caxpby.c',
dir_ext / 'test_zaxpby.c',
dir_ext / 'test_zaxpyc.c',
dir_ext / 'test_caxpyc.c',
dir_ext / 'test_samin.c',
dir_ext / 'test_damin.c',
dir_ext / 'test_scamin.c',
dir_ext / 'test_dzamin.c',
dir_ext / 'test_scamax.c',
dir_ext / 'test_dzamax.c',
dir_ext / 'test_drotmg.c',
dir_ext / 'test_srotmg.c',
dir_ext / 'test_zrotg.c',
dir_ext / 'test_crotg.c',
dir_ext / 'test_crot.c',
dir_ext / 'test_zrot.c',
dir_ext / 'test_zscal.c',
dir_ext / 'test_cscal.c',
dir_ext / 'test_domatcopy.c',
dir_ext / 'test_somatcopy.c',
dir_ext / 'test_zomatcopy.c',
dir_ext / 'test_comatcopy.c',
dir_ext / 'test_simatcopy.c',
dir_ext / 'test_dimatcopy.c',
dir_ext / 'test_cimatcopy.c',
dir_ext / 'test_zimatcopy.c',
dir_ext / 'test_sgeadd.c',
dir_ext / 'test_dgeadd.c',
dir_ext / 'test_cgeadd.c',
dir_ext / 'test_zgeadd.c',
dir_ext / 'test_cgemv_t.c',
dir_ext / 'test_zgemv_t.c',
dir_ext / 'test_cgemv_n.c',
dir_ext / 'test_zgemv_n.c',
dir_ext / 'test_sgemmt.c',
dir_ext / 'test_dgemmt.c',
dir_ext / 'test_cgemmt.c',
dir_ext / 'test_zgemmt.c',
dir_ext / 'test_ztrmv.c',
dir_ext / 'test_ctrmv.c',
dir_ext / 'test_ztrsv.c',
dir_ext / 'test_ctrsv.c',
dir_ext / 'test_zgemm.c',
dir_ext / 'test_cgemm.c',
dir_ext / 'test_zgbmv.c',
dir_ext / 'test_cgbmv.c',
dir_ext / 'test_zspmv.c',
dir_ext / 'test_cspmv.c',
dir_ext / 'test_zsbmv.c',
dir_ext / 'test_csbmv.c',
]
openblas_utest_exec = executable(
'openblas_utest',
sources: sources_utest,
link_with: _openblas,
dependencies: [dependency('threads')],
include_directories: ['..', '.'],
c_args: _cargs,
)
openblas_utest_ext_exec = executable(
'openblas_utest_ext',
sources: sources_utest_ext,
link_with: _openblas,
dependencies: [dependency('threads')],
include_directories: ['..', '.'],
c_args: _cargs,
)
test('openblas_utest_tests', openblas_utest_exec)
test('openblas_utest_tests', openblas_utest_ext_exec)