summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2019-08-17 20:14:16 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2019-08-17 20:14:16 +0000
commit27e3cc4503251ffbd0d318ff287fc7cb8242b402 (patch)
treecde9bfbc275f38ab76eec25de332c0d9cdd52576
parentFix URL. (diff)
New port: devel/fp16: Conversion to/from half-precision floating point formats
-rw-r--r--devel/Makefile1
-rw-r--r--devel/fp16/Makefile40
-rw-r--r--devel/fp16/distinfo3
-rw-r--r--devel/fp16/files/patch-CMakeLists.txt72
-rw-r--r--devel/fp16/files/patch-include_fp16.h11
-rw-r--r--devel/fp16/pkg-descr12
6 files changed, 139 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 74eb6c373126..3705c9c70464 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -670,6 +670,7 @@
SUBDIR += fortytwo-encore
SUBDIR += fossil
SUBDIR += fossology-nomos-standalone
+ SUBDIR += fp16
SUBDIR += fpc-bfd
SUBDIR += fpc-dbus
SUBDIR += fpc-fcl-async
diff --git a/devel/fp16/Makefile b/devel/fp16/Makefile
new file mode 100644
index 000000000000..e6b14100ed65
--- /dev/null
+++ b/devel/fp16/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+PORTNAME= fp16
+PORTVERSION= g20181128
+CATEGORIES= devel
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Conversion to/from half-precision floating point formats
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${RUN_DEPENDS}
+RUN_DEPENDS= ${LOCALBASE}/include/psimd.h:devel/psimd
+
+USES= cmake
+USE_GITHUB= yes
+GH_ACCOUNT= Maratyszcza
+GH_PROJECT= ${PORTNAME:tu}
+GH_TAGNAME= febbb1c
+
+CMAKE_OFF= FP16_BUILD_TESTS FP16_BUILD_BENCHMARKS
+
+NO_BUILD= yes
+NO_ARCH= yes
+
+PLIST_FILES= include/fp16.h \
+ include/fp16/__init__.py \
+ include/fp16/avx.py \
+ include/fp16/avx2.py \
+ include/fp16/bitcasts.h \
+ include/fp16/fp16.h
+
+do-test:
+ @cd ${BUILD_WRKSRC} && \
+ ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DFP16_BUILD_TESTS:BOOL=ON ${CMAKE_SOURCE_PATH} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} test
+
+.include <bsd.port.mk>
diff --git a/devel/fp16/distinfo b/devel/fp16/distinfo
new file mode 100644
index 000000000000..537b9daf8720
--- /dev/null
+++ b/devel/fp16/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1566071714
+SHA256 (Maratyszcza-FP16-g20181128-febbb1c_GH0.tar.gz) = 71d00148641a3a03d9bcfc79485f8325de433f2af10b33f1cdf75d6a6d7a6331
+SIZE (Maratyszcza-FP16-g20181128-febbb1c_GH0.tar.gz) = 71061
diff --git a/devel/fp16/files/patch-CMakeLists.txt b/devel/fp16/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..ed4a97a032b4
--- /dev/null
+++ b/devel/fp16/files/patch-CMakeLists.txt
@@ -0,0 +1,72 @@
+--- CMakeLists.txt.orig 2018-11-28 18:36:19 UTC
++++ CMakeLists.txt
+@@ -33,7 +33,7 @@ SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/
+ SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps
+ CACHE PATH "Confu-style dependencies binary directory")
+
+-IF(NOT DEFINED PSIMD_SOURCE_DIR)
++IF(FALSE AND NOT DEFINED PSIMD_SOURCE_DIR)
+ MESSAGE(STATUS "Downloading PSimd to ${CONFU_DEPENDENCIES_SOURCE_DIR}/psimd (define PSIMD_SOURCE_DIR to avoid it)")
+ CONFIGURE_FILE(cmake/DownloadPSimd.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/psimd-download/CMakeLists.txt")
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
+@@ -68,8 +68,7 @@ IF(${CMAKE_VERSION} VERSION_LESS "3.0")
+ ADD_LIBRARY(fp16 STATIC
+ include/fp16.h
+ include/fp16/fp16.h
+- include/fp16/bitcasts.h
+- include/fp16/psimd.h)
++ include/fp16/bitcasts.h)
+ SET_TARGET_PROPERTIES(fp16 PROPERTIES LINKER_LANGUAGE C)
+ ELSE()
+ ADD_LIBRARY(fp16 INTERFACE)
+@@ -83,14 +82,13 @@ INSTALL(FILES include/fp16.h
+ INSTALL(FILES
+ include/fp16/bitcasts.h
+ include/fp16/fp16.h
+- include/fp16/psimd.h
+ include/fp16/__init__.py
+ include/fp16/avx.py
+ include/fp16/avx2.py
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fp16)
+
+ # ---[ Configure psimd
+-IF(NOT TARGET psimd)
++IF(FALSE AND NOT TARGET psimd)
+ ADD_SUBDIRECTORY(
+ "${PSIMD_SOURCE_DIR}"
+ "${CONFU_DEPENDENCIES_BINARY_DIR}/psimd")
+@@ -154,28 +152,28 @@ IF(FP16_BUILD_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()
diff --git a/devel/fp16/files/patch-include_fp16.h b/devel/fp16/files/patch-include_fp16.h
new file mode 100644
index 000000000000..dde0c757a81b
--- /dev/null
+++ b/devel/fp16/files/patch-include_fp16.h
@@ -0,0 +1,11 @@
+--- include/fp16.h.orig 2019-08-17 20:08:49 UTC
++++ include/fp16.h
+@@ -5,7 +5,7 @@
+ #include <fp16/fp16.h>
+
+ #if defined(PSIMD_H)
+-#include <fp16/psimd.h>
++#include <psimd.h>
+ #endif
+
+ #endif /* FP16_H */
diff --git a/devel/fp16/pkg-descr b/devel/fp16/pkg-descr
new file mode 100644
index 000000000000..24eafcb03048
--- /dev/null
+++ b/devel/fp16/pkg-descr
@@ -0,0 +1,12 @@
+Header-only library for conversion to/from half-precision floating point
+formats.
+
+Features:
+* Supports IEEE and ARM alternative half-precision floating-point format
+ o Property converts infinities and NaNs
+ o Properly converts denormal numbers, even on systems without denormal support
+* Header-only library, no installation or build required
+* Compatible with C99 and C++11
+* Fully covered with unit tests and microbenchmarks
+
+WWW: https://github.com/Maratyszcza/FP16