Skip to content

Commit ce7a57a

Browse files
authoredFeb 4, 2025
Initial implementation of float16 support (RFC100) (OSGeo#11180)
1 parent 7ed21aa commit ce7a57a

File tree

79 files changed

+3132
-967
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3132
-967
lines changed
 

‎.github/workflows/icc/build.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ set -eu
55
# for precompiled headers
66
ccache --set-config sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime
77

8+
# Set C and C++ compiler flags to disable `_Float16`. This is
9+
# necessary because the system C and C++ compilers don't support it,
10+
# and Python's `build_ext` will use the system compiler to build GDAL
11+
# Python extensions.
812
cmake ${GDAL_SOURCE_DIR:=..} \
913
-DCMAKE_BUILD_TYPE=Release \
1014
-DCMAKE_C_COMPILER=icx \
1115
-DCMAKE_CXX_COMPILER=icx \
12-
"-DUSE_PRECOMPILED_HEADERS=ON" \
16+
-DCMAKE_C_FLAGS=-DGDAL_DISABLE_FLOAT16 \
17+
-DCMAKE_CXX_FLAGS=-DGDAL_DISABLE_FLOAT16 \
18+
-DUSE_PRECOMPILED_HEADERS=ON \
1319
-DUSE_CCACHE=ON
1420
make -j$(nproc)
15-

‎CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ else()
111111
cmake_pop_check_state()
112112

113113
endif ()
114+
115+
# Check whether std::float16_t is available and is working
116+
include(CheckCXXSourceCompiles)
117+
check_cxx_source_compiles(
118+
"
119+
#include <cmath>
120+
#include <stdfloat>
121+
int main() {
122+
std::float16_t x = 0;
123+
using std::nextafter;
124+
std::float16_t y = nextafter(x, x);
125+
return y == 0 ? 0 : 1;
126+
}
127+
"
128+
HAVE_STD_FLOAT16_T
129+
)
130+
114131
#
115132
option(CLANG_TIDY_ENABLED "Run clang-tidy with the compiler." OFF)
116133
set(CLANG_TIDY_CHECKS

0 commit comments

Comments
 (0)
Please sign in to comment.