This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1787 from xsacha/FP16
Add FP16
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2016-2019, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
# !!! DO NOT PLACE HEADER GUARDS HERE !!! | ||
|
||
include(hunter_add_version) | ||
include(hunter_cacheable) | ||
include(hunter_download) | ||
include(hunter_pick_scheme) | ||
include(hunter_cmake_args) | ||
|
||
hunter_add_version( | ||
PACKAGE_NAME | ||
FP16 | ||
VERSION | ||
0.0.0-febbb1c-p0 | ||
URL | ||
"https://github.com/hunter-packages/FP16/archive/v0.0.0-febbb1c-p0.tar.gz" | ||
SHA1 | ||
86a7e35a2193e60440ea152628ade89eff4cd0cd | ||
) | ||
|
||
hunter_cmake_args(FP16 CMAKE_ARGS FP16_BUILD_BENCHMARKS=OFF FP16_BUILD_TESTS=OFF) | ||
|
||
hunter_pick_scheme(DEFAULT url_sha1_cmake) | ||
hunter_cacheable(FP16) | ||
hunter_download(PACKAGE_NAME FP16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. spelling:: | ||
|
||
FP | ||
|
||
.. index:: | ||
single: cpu ; FP16 | ||
|
||
.. _pkg.FP16: | ||
|
||
FP16 | ||
==== | ||
|
||
- `Official <https://github.com/Maratyszcza/FP16>`__ | ||
- `Hunterized <https://github.com/hunter-packages/FP16>`__ | ||
- `Example <https://github.com/ruslo/hunter/blob/master/examples/FP16/CMakeLists.txt>`__ | ||
- Added by `xsacha <https://github.com/xsacha>`__ (`pr-1787 <https://github.com/ruslo/hunter/pull/1787>`__) | ||
|
||
.. literalinclude:: /../examples/FP16/CMakeLists.txt | ||
:language: cmake | ||
:start-after: # DOCUMENTATION_START { | ||
:end-before: # DOCUMENTATION_END } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2016-2018, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.2) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-FP16) | ||
|
||
# DOCUMENTATION_START { | ||
hunter_add_package(FP16) | ||
find_package(FP16 REQUIRED) | ||
|
||
add_executable(boo boo.cpp) | ||
target_link_libraries(boo PUBLIC FP16::fp16) | ||
# DOCUMENTATION_END } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <fp16.h> | ||
|
||
int main() { | ||
// Test FP16 | ||
const uint16_t min_po2_f16 = UINT16_C(0x0400); | ||
const float min_po2_value = fp16_ieee_to_fp32_value(min_po2_f16); | ||
|
||
const uint16_t positive_infinity_f16 = UINT16_C(0x7C00); | ||
const uint16_t negative_infinity_f16 = UINT16_C(0xFC00); | ||
|
||
const uint32_t positive_infinity_f32 = UINT32_C(0x7F800000); | ||
const uint32_t negative_infinity_f32 = UINT32_C(0xFF800000); | ||
|
||
|
||
return 0; | ||
} |