From 8c51a02bd5291135c489f4d262b301f7ade5054e Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Sun, 7 Nov 2021 18:44:12 +0000 Subject: [PATCH] Restore IPP support as an option, and add it (perhaps temporarily) to perfbuild table --- .hgignore | 1 + meson.build | 42 ++++++++++++++++++++++++++++++++++++---- meson_options.txt | 9 ++++++++- scripts/run-perftests.sh | 15 ++++++++++++-- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/.hgignore b/.hgignore index 8c313bc..84dffcc 100644 --- a/.hgignore +++ b/.hgignore @@ -12,3 +12,4 @@ mlmon.out *.orig test-sml *-dump-out.csv +tmp_perfbuild* diff --git a/meson.build b/meson.build index c3cc661..55efaf9 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,9 @@ project( system = host_machine.system() architecture = host_machine.cpu_family() +ipp_path = get_option('ipp_path') +sml_buildtype = get_option('sml_buildtype') + run_target( 'doc', command: meson.current_source_dir() / 'scripts/doc.sh' @@ -53,6 +56,19 @@ if system == 'windows' '-L../ext/turbotdeps/win32-msvc/lib', '-lportaudio', '-lsamplerate', '-lopusfile', '-lopusenc', '-lopus', '-logg', '-lmfplat', '-lmfreadwrite', '-lmfuuid', '-lpropsys', '-lws2_32', '-lgdi32', '-lcomdlg32', '-loleaut32', '-limm32', '-lwinmm', '-lwinspool', '-lole32', '-luser32', '-ladvapi32', '-lmsimg32', '-lshell32', '-lnetapi32', '-lwtsapi32', '-lkernel32', '-lversion', '-ldwmapi', '-luserenv', '-luuid', ] + + if ipp_path != '' + platform_feature_defines += [ + '-DHAVE_IPP', + ] + platform_feature_includedirs += [ + ipp_path / 'include' + ] + platform_feature_libs += [ + '-L' + (ipp_path / 'lib/intel64'), + '-lippsmt', '-lippvmmt', '-lippcoremt', + ] + endif elif system == 'darwin' @@ -116,6 +132,10 @@ elif system == 'darwin' '-lc++' ] + if ipp_path != '' + error('IPP is not used on this platform, ipp_path should be left empty') + endif + elif system == 'linux' platform_feature_defines = [ @@ -140,6 +160,20 @@ elif system == 'linux' platform_general_libs = [ '-lpthread', '-lstdc++', ] + + if ipp_path != '' + platform_feature_defines += [ + '-DHAVE_IPP', + ] + platform_feature_includedirs += [ + ipp_path / 'include' + ] + platform_feature_libs += [ + '-L' + (ipp_path / 'lib/intel64'), + '-Wl,-Bstatic', '-lipps', '-lippvm', '-lippcore', '-Wl,-Bdynamic', + ] + endif # end ipp_path + endif @@ -191,7 +225,7 @@ perftest_output = [ bsq_perftest_name ] -if get_option('sml_buildtype') == 'polyml' +if sml_buildtype == 'polyml' bsq_test_target = custom_target( 'bsq_test', @@ -221,7 +255,7 @@ if get_option('sml_buildtype') == 'polyml' build_by_default: true, ) -elif get_option('sml_buildtype') == 'mlton_noffi' +elif sml_buildtype == 'mlton_noffi' bsq_test_target = custom_target( 'bsq_test', @@ -372,7 +406,7 @@ else endforeach mlton_profile_opts = [] - if get_option('sml_buildtype') == 'mlton_profile' + if sml_buildtype == 'mlton_profile' mlton_profile_opts = [ '-profile', 'time', '-profile-stack', 'true', @@ -382,7 +416,7 @@ else endif mlton_debug_opts = [] - if get_option('sml_buildtype') == 'mlton_debug' + if sml_buildtype == 'mlton_debug' mlton_debug_opts = [ '-const', 'Exn.keepHistory true', '-cc-opt', '-g', diff --git a/meson_options.txt b/meson_options.txt index ababa0b..0480727 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,5 +4,12 @@ option( choices: [ 'mlton_release', 'mlton_profile', 'mlton_debug', 'mlton_noffi', 'polyml' ], - value: 'polyml' + value: 'polyml', + description: 'Compiler and build mode to use for SML code. The polyml and mlton_noffi builds are pure SML; the rest use C/C++ FFI code.' +) +option( + 'ipp_path', + type: 'string', + value: '', + description: 'Path to Intel IPP libraries, if IPP is to be used. Leave empty otherwise. Only relevant to MLton builds using FFI.' ) diff --git a/scripts/run-perftests.sh b/scripts/run-perftests.sh index 43c85f8..7d22809 100755 --- a/scripts/run-perftests.sh +++ b/scripts/run-perftests.sh @@ -17,11 +17,22 @@ fi # long to build (even longer than mlton_release) buildtypes="polyml mlton_noffi mlton_release" +ippdir=/opt/intel/ipp +if [ -d "$ippdir" ]; then + buildtypes="$buildtypes mlton_ipp" +fi + for b in $buildtypes; do + sml_buildtype="$b" + extra_args="" + if [ "$b" = "mlton_ipp" ]; then + sml_buildtype="mlton_release" + extra_args="-Dipp_path=$ippdir" + fi if [ -f "tmp_perfbuild_$b/build.ninja" ]; then - meson "tmp_perfbuild_$b" -D"sml_buildtype=$b" --reconfigure + meson "tmp_perfbuild_$b" -D"sml_buildtype=$sml_buildtype" $extra_args --reconfigure else - meson "tmp_perfbuild_$b" -D"sml_buildtype=$b" + meson "tmp_perfbuild_$b" -D"sml_buildtype=$sml_buildtype" $extra_args fi time ninja -C "tmp_perfbuild_$b" bsq_perftest echo