Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 09f1f82

Browse files
author
Commitfest Bot
committed
[CF 5607] v1 - SIMD optimization for list_sort
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5607 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/CO1PR11MB506056215E799493EC5F42E8EDFE2@CO1PR11MB5060.namprd11.prod.outlook.com Author(s): Rakshit R
2 parents 764d501 + 21d68a8 commit 09f1f82

21 files changed

+1176
-7
lines changed

configure

Lines changed: 222 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,9 @@ with_zstd
701701
LZ4_LIBS
702702
LZ4_CFLAGS
703703
with_lz4
704+
SIMDSORT_LIBS
705+
SIMDSORT_CFLAGS
706+
with_simdsort
704707
with_zlib
705708
with_system_tzdata
706709
with_libxslt
@@ -809,6 +812,7 @@ infodir
809812
docdir
810813
oldincludedir
811814
includedir
815+
runstatedir
812816
localstatedir
813817
sharedstatedir
814818
sysconfdir
@@ -876,6 +880,7 @@ with_libxml
876880
with_libxslt
877881
with_system_tzdata
878882
with_zlib
883+
with_simdsort
879884
with_lz4
880885
with_zstd
881886
with_ssl
@@ -909,6 +914,8 @@ LIBCURL_LIBS
909914
XML2_CONFIG
910915
XML2_CFLAGS
911916
XML2_LIBS
917+
SIMDSORT_CFLAGS
918+
SIMDSORT_LIBS
912919
LZ4_CFLAGS
913920
LZ4_LIBS
914921
ZSTD_CFLAGS
@@ -957,6 +964,7 @@ datadir='${datarootdir}'
957964
sysconfdir='${prefix}/etc'
958965
sharedstatedir='${prefix}/com'
959966
localstatedir='${prefix}/var'
967+
runstatedir='${localstatedir}/run'
960968
includedir='${prefix}/include'
961969
oldincludedir='/usr/include'
962970
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1209,6 +1217,15 @@ do
12091217
| -silent | --silent | --silen | --sile | --sil)
12101218
silent=yes ;;
12111219

1220+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1221+
| --runstate | --runstat | --runsta | --runst | --runs \
1222+
| --run | --ru | --r)
1223+
ac_prev=runstatedir ;;
1224+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1225+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1226+
| --run=* | --ru=* | --r=*)
1227+
runstatedir=$ac_optarg ;;
1228+
12121229
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
12131230
ac_prev=sbindir ;;
12141231
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1346,7 +1363,7 @@ fi
13461363
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
13471364
datadir sysconfdir sharedstatedir localstatedir includedir \
13481365
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1349-
libdir localedir mandir
1366+
libdir localedir mandir runstatedir
13501367
do
13511368
eval ac_val=\$$ac_var
13521369
# Remove trailing slashes.
@@ -1499,6 +1516,7 @@ Fine tuning of the installation directories:
14991516
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
15001517
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
15011518
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1519+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
15021520
--libdir=DIR object code libraries [EPREFIX/lib]
15031521
--includedir=DIR C header files [PREFIX/include]
15041522
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1593,6 +1611,7 @@ Optional Packages:
15931611
--with-system-tzdata=DIR
15941612
use system time zone data in DIR
15951613
--without-zlib do not use Zlib
1614+
--with-simdsort build with SIMDSORT support
15961615
--with-lz4 build with LZ4 support
15971616
--with-zstd build with ZSTD support
15981617
--with-ssl=LIB use LIB for SSL/TLS support (openssl)
@@ -1632,6 +1651,10 @@ Some influential environment variables:
16321651
XML2_CONFIG path to xml2-config utility
16331652
XML2_CFLAGS C compiler flags for XML2, overriding pkg-config
16341653
XML2_LIBS linker flags for XML2, overriding pkg-config
1654+
SIMDSORT_CFLAGS
1655+
C compiler flags for SIMDSORT, overriding pkg-config
1656+
SIMDSORT_LIBS
1657+
linker flags for SIMDSORT, overriding pkg-config
16351658
LZ4_CFLAGS C compiler flags for LZ4, overriding pkg-config
16361659
LZ4_LIBS linker flags for LZ4, overriding pkg-config
16371660
ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
@@ -9337,6 +9360,147 @@ fi
93379360

93389361

93399362

9363+
#
9364+
# SIMDSORT
9365+
#
9366+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with SIMDSORT support" >&5
9367+
$as_echo_n "checking whether to build with SIMDSORT support... " >&6; }
9368+
9369+
9370+
9371+
# Check whether --with-simdsort was given.
9372+
if test "${with_simdsort+set}" = set; then :
9373+
withval=$with_simdsort;
9374+
case $withval in
9375+
yes)
9376+
9377+
$as_echo "#define USE_SIMDSORT 1" >>confdefs.h
9378+
9379+
;;
9380+
no)
9381+
:
9382+
;;
9383+
*)
9384+
as_fn_error $? "no argument expected for --with-simdsort option" "$LINENO" 5
9385+
;;
9386+
esac
9387+
9388+
else
9389+
with_simdsort=no
9390+
9391+
fi
9392+
9393+
9394+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_simdsort" >&5
9395+
$as_echo "$with_simdsort" >&6; }
9396+
9397+
9398+
if test "$with_simdsort" = yes; then
9399+
9400+
pkg_failed=no
9401+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86simdsortcpp" >&5
9402+
$as_echo_n "checking for x86simdsortcpp... " >&6; }
9403+
9404+
if test -n "$SIMDSORT_CFLAGS"; then
9405+
pkg_cv_SIMDSORT_CFLAGS="$SIMDSORT_CFLAGS"
9406+
elif test -n "$PKG_CONFIG"; then
9407+
if test -n "$PKG_CONFIG" && \
9408+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x86simdsortcpp\""; } >&5
9409+
($PKG_CONFIG --exists --print-errors "x86simdsortcpp") 2>&5
9410+
ac_status=$?
9411+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9412+
test $ac_status = 0; }; then
9413+
pkg_cv_SIMDSORT_CFLAGS=`$PKG_CONFIG --cflags "x86simdsortcpp" 2>/dev/null`
9414+
test "x$?" != "x0" && pkg_failed=yes
9415+
else
9416+
pkg_failed=yes
9417+
fi
9418+
else
9419+
pkg_failed=untried
9420+
fi
9421+
if test -n "$SIMDSORT_LIBS"; then
9422+
pkg_cv_SIMDSORT_LIBS="$SIMDSORT_LIBS"
9423+
elif test -n "$PKG_CONFIG"; then
9424+
if test -n "$PKG_CONFIG" && \
9425+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x86simdsortcpp\""; } >&5
9426+
($PKG_CONFIG --exists --print-errors "x86simdsortcpp") 2>&5
9427+
ac_status=$?
9428+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9429+
test $ac_status = 0; }; then
9430+
pkg_cv_SIMDSORT_LIBS=`$PKG_CONFIG --libs "x86simdsortcpp" 2>/dev/null`
9431+
test "x$?" != "x0" && pkg_failed=yes
9432+
else
9433+
pkg_failed=yes
9434+
fi
9435+
else
9436+
pkg_failed=untried
9437+
fi
9438+
9439+
9440+
9441+
if test $pkg_failed = yes; then
9442+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9443+
$as_echo "no" >&6; }
9444+
9445+
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
9446+
_pkg_short_errors_supported=yes
9447+
else
9448+
_pkg_short_errors_supported=no
9449+
fi
9450+
if test $_pkg_short_errors_supported = yes; then
9451+
SIMDSORT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x86simdsortcpp" 2>&1`
9452+
else
9453+
SIMDSORT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x86simdsortcpp" 2>&1`
9454+
fi
9455+
# Put the nasty error message in config.log where it belongs
9456+
echo "$SIMDSORT_PKG_ERRORS" >&5
9457+
9458+
as_fn_error $? "Package requirements (x86simdsortcpp) were not met:
9459+
9460+
$SIMDSORT_PKG_ERRORS
9461+
9462+
Consider adjusting the PKG_CONFIG_PATH environment variable if you
9463+
installed software in a non-standard prefix.
9464+
9465+
Alternatively, you may set the environment variables SIMDSORT_CFLAGS
9466+
and SIMDSORT_LIBS to avoid the need to call pkg-config.
9467+
See the pkg-config man page for more details." "$LINENO" 5
9468+
elif test $pkg_failed = untried; then
9469+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9470+
$as_echo "no" >&6; }
9471+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
9472+
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
9473+
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
9474+
is in your PATH or set the PKG_CONFIG environment variable to the full
9475+
path to pkg-config.
9476+
9477+
Alternatively, you may set the environment variables SIMDSORT_CFLAGS
9478+
and SIMDSORT_LIBS to avoid the need to call pkg-config.
9479+
See the pkg-config man page for more details.
9480+
9481+
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
9482+
See \`config.log' for more details" "$LINENO" 5; }
9483+
else
9484+
SIMDSORT_CFLAGS=$pkg_cv_SIMDSORT_CFLAGS
9485+
SIMDSORT_LIBS=$pkg_cv_SIMDSORT_LIBS
9486+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9487+
$as_echo "yes" >&6; }
9488+
9489+
fi
9490+
# We only care about -I, -D, and -L switches;
9491+
# note that -lsimdsort will be added by AC_CHECK_LIB below.
9492+
for pgac_option in $SIMDSORT_CFLAGS; do
9493+
case $pgac_option in
9494+
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
9495+
esac
9496+
done
9497+
for pgac_option in $SIMDSORT_LIBS; do
9498+
case $pgac_option in
9499+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
9500+
esac
9501+
done
9502+
fi
9503+
93409504
#
93419505
# LZ4
93429506
#
@@ -13101,6 +13265,56 @@ fi
1310113265

1310213266
fi
1310313267

13268+
if test "$with_simdsort" = yes ; then
13269+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for keyvalue_qsort_float_sizet in -lx86simdsortcpp" >&5
13270+
$as_echo_n "checking for keyvalue_qsort_float_sizet in -lx86simdsortcpp... " >&6; }
13271+
if ${ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet+:} false; then :
13272+
$as_echo_n "(cached) " >&6
13273+
else
13274+
ac_check_lib_save_LIBS=$LIBS
13275+
LIBS="-lx86simdsortcpp $LIBS"
13276+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13277+
/* end confdefs.h. */
13278+
13279+
/* Override any GCC internal prototype to avoid an error.
13280+
Use char because int might match the return type of a GCC
13281+
builtin and then its argument prototype would still apply. */
13282+
#ifdef __cplusplus
13283+
extern "C"
13284+
#endif
13285+
char keyvalue_qsort_float_sizet ();
13286+
int
13287+
main ()
13288+
{
13289+
return keyvalue_qsort_float_sizet ();
13290+
;
13291+
return 0;
13292+
}
13293+
_ACEOF
13294+
if ac_fn_c_try_link "$LINENO"; then :
13295+
ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet=yes
13296+
else
13297+
ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet=no
13298+
fi
13299+
rm -f core conftest.err conftest.$ac_objext \
13300+
conftest$ac_exeext conftest.$ac_ext
13301+
LIBS=$ac_check_lib_save_LIBS
13302+
fi
13303+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet" >&5
13304+
$as_echo "$ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet" >&6; }
13305+
if test "x$ac_cv_lib_x86simdsortcpp_keyvalue_qsort_float_sizet" = xyes; then :
13306+
cat >>confdefs.h <<_ACEOF
13307+
#define HAVE_LIBX86SIMDSORTCPP 1
13308+
_ACEOF
13309+
13310+
LIBS="-lx86simdsortcpp $LIBS"
13311+
13312+
else
13313+
as_fn_error $? "library 'x86simdsortcpp' is required for SIMDSORt support" "$LINENO" 5
13314+
fi
13315+
13316+
fi
13317+
1310413318
if test "$with_lz4" = yes ; then
1310513319
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_compress_default in -llz4" >&5
1310613320
$as_echo_n "checking for LZ4_compress_default in -llz4... " >&6; }
@@ -13202,6 +13416,8 @@ fi
1320213416
fi
1320313417

1320413418
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
13419+
# also, on AIX, we may need to have openssl in LIBS for this step.
13420+
1320513421
if test "$with_ldap" = yes ; then
1320613422
_LIBS="$LIBS"
1320713423
if test "$PORTNAME" != "win32"; then
@@ -15133,7 +15349,7 @@ else
1513315349
We can't simply define LARGE_OFF_T to be 9223372036854775807,
1513415350
since some C++ compilers masquerading as C compilers
1513515351
incorrectly reject 9223372036854775807. */
15136-
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15352+
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
1513715353
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
1513815354
&& LARGE_OFF_T % 2147483647 == 1)
1513915355
? 1 : -1];
@@ -15179,7 +15395,7 @@ else
1517915395
We can't simply define LARGE_OFF_T to be 9223372036854775807,
1518015396
since some C++ compilers masquerading as C compilers
1518115397
incorrectly reject 9223372036854775807. */
15182-
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15398+
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
1518315399
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
1518415400
&& LARGE_OFF_T % 2147483647 == 1)
1518515401
? 1 : -1];
@@ -15203,7 +15419,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1520315419
We can't simply define LARGE_OFF_T to be 9223372036854775807,
1520415420
since some C++ compilers masquerading as C compilers
1520515421
incorrectly reject 9223372036854775807. */
15206-
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15422+
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
1520715423
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
1520815424
&& LARGE_OFF_T % 2147483647 == 1)
1520915425
? 1 : -1];
@@ -15248,7 +15464,7 @@ else
1524815464
We can't simply define LARGE_OFF_T to be 9223372036854775807,
1524915465
since some C++ compilers masquerading as C compilers
1525015466
incorrectly reject 9223372036854775807. */
15251-
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15467+
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
1525215468
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
1525315469
&& LARGE_OFF_T % 2147483647 == 1)
1525415470
? 1 : -1];
@@ -15272,7 +15488,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1527215488
We can't simply define LARGE_OFF_T to be 9223372036854775807,
1527315489
since some C++ compilers masquerading as C compilers
1527415490
incorrectly reject 9223372036854775807. */
15275-
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15491+
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
1527615492
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
1527715493
&& LARGE_OFF_T % 2147483647 == 1)
1527815494
? 1 : -1];

0 commit comments

Comments
 (0)