aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2021-07-29 16:41:35 +0200
committerLudovic Courtès <ludo@gnu.org>2021-07-29 21:54:55 +0200
commit1daa66272258231f9fcbd9929ba42c688861b842 (patch)
treeb32b2a07bcdf2c6b18df0f27fd23245e4d542db1 /gnu/packages/patches
parent065d45e8a1c3af31889df53d6feb49973814009c (diff)
downloadguix-1daa66272258231f9fcbd9929ba42c688861b842.tar
guix-1daa66272258231f9fcbd9929ba42c688861b842.tar.gz
gnu: Add FP16.
* gnu/packages/patches/fp16-system-libraries.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/maths.scm (fp16): New variable.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/fp16-system-libraries.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/gnu/packages/patches/fp16-system-libraries.patch b/gnu/packages/patches/fp16-system-libraries.patch
new file mode 100644
index 0000000000..7f52936c14
--- /dev/null
+++ b/gnu/packages/patches/fp16-system-libraries.patch
@@ -0,0 +1,105 @@
+This patch allows the build process to use the provided dependencies instead
+of adding their source as CMake sub-directories (in which case "make install"
+would install googletest's and googlebenchmark's libraries and headers).
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5e7d127..4b269b9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -28,7 +28,7 @@ MACRO(FP16_TARGET_ENABLE_CXX11 target)
+ ENDMACRO()
+
+ # ---[ Download deps
+-IF(NOT DEFINED PSIMD_SOURCE_DIR)
++IF(FALSE)
+ MESSAGE(STATUS "Downloading PSimd to ${CMAKE_BINARY_DIR}/psimd-source (define PSIMD_SOURCE_DIR to avoid it)")
+ CONFIGURE_FILE(cmake/DownloadPSimd.cmake "${CMAKE_BINARY_DIR}/psimd-download/CMakeLists.txt")
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
+@@ -38,7 +38,7 @@ IF(NOT DEFINED PSIMD_SOURCE_DIR)
+ SET(PSIMD_SOURCE_DIR "${CMAKE_BINARY_DIR}/psimd-source" CACHE STRING "PSimd source directory")
+ ENDIF()
+
+-IF(FP16_BUILD_TESTS AND NOT DEFINED GOOGLETEST_SOURCE_DIR)
++IF(FALSE)
+ MESSAGE(STATUS "Downloading Google Test to ${CMAKE_BINARY_DIR}/googletest-source (define GOOGLETEST_SOURCE_DIR to avoid it)")
+ CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt")
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
+@@ -48,7 +48,7 @@ IF(FP16_BUILD_TESTS AND NOT DEFINED GOOGLETEST_SOURCE_DIR)
+ SET(GOOGLETEST_SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-source" CACHE STRING "Google Test source directory")
+ ENDIF()
+
+-IF(FP16_BUILD_BENCHMARKS AND NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
++IF(FALSE)
+ MESSAGE(STATUS "Downloading Google Benchmark to ${CMAKE_BINARY_DIR}/googlebenchmark-source (define GOOGLEBENCHMARK_SOURCE_DIR to avoid it)")
+ CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CMAKE_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt")
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
+@@ -84,22 +84,7 @@ INSTALL(FILES
+ include/fp16/avx2.py
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fp16)
+
+-# ---[ Configure psimd
+-IF(NOT TARGET psimd)
+- ADD_SUBDIRECTORY(
+- "${PSIMD_SOURCE_DIR}"
+- "${CMAKE_BINARY_DIR}/psimd")
+-ENDIF()
+-
+ IF(FP16_BUILD_TESTS)
+- # ---[ Build google test
+- IF(NOT TARGET gtest)
+- SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+- ADD_SUBDIRECTORY(
+- "${GOOGLETEST_SOURCE_DIR}"
+- "${CMAKE_BINARY_DIR}/googletest")
+- ENDIF()
+-
+ # ---[ Build FP16 unit tests
+ ADD_EXECUTABLE(ieee-to-fp32-bits-test test/ieee-to-fp32-bits.cc test/tables.cc)
+ TARGET_INCLUDE_DIRECTORIES(ieee-to-fp32-bits-test PRIVATE test)
+@@ -137,40 +122,32 @@ IF(FP16_BUILD_TESTS)
+ ENDIF()
+
+ IF(FP16_BUILD_BENCHMARKS)
+- # ---[ Build google benchmark
+- IF(NOT TARGET benchmark)
+- SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "")
+- ADD_SUBDIRECTORY(
+- "${GOOGLEBENCHMARK_SOURCE_DIR}"
+- "${CMAKE_BINARY_DIR}/googlebenchmark")
+- ENDIF()
+-
+ # ---[ Build FP16 benchmarks
+ ADD_EXECUTABLE(ieee-element-bench bench/ieee-element.cc)
+ TARGET_COMPILE_DEFINITIONS(ieee-element-bench PRIVATE FP16_COMPARATIVE_BENCHMARKS=1)
+ TARGET_INCLUDE_DIRECTORIES(ieee-element-bench PRIVATE ${PROJECT_SOURCE_DIR})
+- TARGET_LINK_LIBRARIES(ieee-element-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(ieee-element-bench fp16 benchmark)
+
+ ADD_EXECUTABLE(alt-element-bench bench/alt-element.cc)
+- TARGET_LINK_LIBRARIES(alt-element-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(alt-element-bench fp16 benchmark)
+
+ ADD_EXECUTABLE(from-ieee-array-bench bench/from-ieee-array.cc)
+ FP16_TARGET_ENABLE_CXX11(from-ieee-array-bench)
+ TARGET_COMPILE_DEFINITIONS(from-ieee-array-bench PRIVATE FP16_COMPARATIVE_BENCHMARKS=1)
+ TARGET_INCLUDE_DIRECTORIES(from-ieee-array-bench PRIVATE ${PROJECT_SOURCE_DIR})
+- TARGET_LINK_LIBRARIES(from-ieee-array-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(from-ieee-array-bench fp16 benchmark)
+
+ ADD_EXECUTABLE(from-alt-array-bench bench/from-alt-array.cc)
+ FP16_TARGET_ENABLE_CXX11(from-alt-array-bench)
+- TARGET_LINK_LIBRARIES(from-alt-array-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(from-alt-array-bench fp16 benchmark)
+
+ ADD_EXECUTABLE(to-ieee-array-bench bench/to-ieee-array.cc)
+ FP16_TARGET_ENABLE_CXX11(to-ieee-array-bench)
+ TARGET_COMPILE_DEFINITIONS(to-ieee-array-bench PRIVATE FP16_COMPARATIVE_BENCHMARKS=1)
+ TARGET_INCLUDE_DIRECTORIES(to-ieee-array-bench PRIVATE ${PROJECT_SOURCE_DIR})
+- TARGET_LINK_LIBRARIES(to-ieee-array-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(to-ieee-array-bench fp16 benchmark)
+
+ ADD_EXECUTABLE(to-alt-array-bench bench/to-alt-array.cc)
+ FP16_TARGET_ENABLE_CXX11(to-alt-array-bench)
+- TARGET_LINK_LIBRARIES(to-alt-array-bench fp16 psimd benchmark)
++ TARGET_LINK_LIBRARIES(to-alt-array-bench fp16 benchmark)
+ ENDIF()