Skip to content

Commit

Permalink
Restore IPP support as an option, and add it (perhaps temporarily) to…
Browse files Browse the repository at this point in the history
… perfbuild table
  • Loading branch information
cannam committed Nov 7, 2021
1 parent f6fba88 commit 8c51a02
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
1 change: 1 addition & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ mlmon.out
*.orig
test-sml
*-dump-out.csv
tmp_perfbuild*
42 changes: 38 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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 = [
Expand All @@ -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


Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
9 changes: 8 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
)
15 changes: 13 additions & 2 deletions scripts/run-perftests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c51a02

Please sign in to comment.