Skip to content

Commit 0d028a4

Browse files
committed
configury: enhance short float detection with clang
With clang, short float support requires --rtlib=compiler-rt to be passed to the linker. In order to avoid a false positive, it is necessary have the runtime called in the test program. The test program was hence updated with the function below that generates a call to the __extendhfsf2() runtime function. float extend (_Float16 v) { return (float)v; } Thanks Blaise Bourdin for reporting this. Refs: #13181 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent 32bfff1 commit 0d028a4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

config/opal_check_alt_short_float.m4

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2018-2021 FUJITSU LIMITED. All rights reserved.
4-
dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
4+
dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
5+
dnl Copyright (c) 2025 Research Organization for Information Science
6+
dnl and Technology (RIST). All rights reserved.
57
dnl $COPYRIGHT$
68
dnl
79
dnl Additional copyrights may follow
@@ -50,8 +52,12 @@ AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
5052
AS_IF([test $opal_alt_short_float_exists -eq 1],
5153
[AC_MSG_CHECKING([if compiler supports arithmetic operations on $opal_short_float_type])
5254
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
53-
static $opal_short_float_type a = 2.5, b = 3.8;
54-
a += b;]])],
55+
static $opal_short_float_type a = 2.5, b = 3.8;
56+
a += b;
57+
}
58+
59+
float extend ($opal_short_float_type v) {
60+
return (float)v;]])],
5561
[AC_MSG_RESULT([yes])
5662
opal_enable_short_float=1],
5763
[AC_MSG_RESULT([no])

ompi/mpiext/shortfloat/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ to the Open MPI `configure` script.
2525
NOTE: The Clang 6.0.x and 7.0.x compilers support the `_Float16` type
2626
(via software emulation), but require an additional linker flag to
2727
function properly. If you wish to enable Clang 6.0.x or 7.0.x's
28-
software emulation of `_Float16`, use the following CLI options to Open
29-
MPI configure script:
28+
software emulation of `_Float16`, or recent Clang, use the
29+
following CLI options to Open MPI configure script:
3030

3131
```
3232
./configure \

0 commit comments

Comments
 (0)