Skip to content

Commit a23c00b

Browse files
authored
Initial f16 support (#2413)
* Implement f16 support * Add half support for gemm * Add half support for JIT * Add support functions for half data type * Add half support to reductions. * Add support for join * Add support for transpose
1 parent 8146d91 commit a23c00b

File tree

144 files changed

+5914
-420
lines changed

Some content is hidden

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

144 files changed

+5914
-420
lines changed

CMakeModules/FileToString.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include(CMakeParseArguments)
2828
set(BIN2CPP_PROGRAM "bin2cpp")
2929

3030
function(FILE_TO_STRING)
31-
cmake_parse_arguments(RTCS "" "VARNAME;EXTENSION;OUTPUT_DIR;TARGETS;NAMESPACE;BINARY;NULLTERM" "SOURCES" ${ARGN})
31+
cmake_parse_arguments(RTCS "WITH_EXTENSION;NULLTERM" "VARNAME;EXTENSION;OUTPUT_DIR;TARGETS;NAMESPACE;BINARY" "SOURCES" ${ARGN})
3232

3333
set(_output_files "")
3434
foreach(_input_file ${RTCS_SOURCES})
@@ -42,14 +42,18 @@ function(FILE_TO_STRING)
4242
if(${RTCS_BINARY})
4343
set(_binary "--binary")
4444
endif(${RTCS_BINARY})
45-
if(${RTCS_NULLTERM})
45+
if(RTCS_NULLTERM)
4646
set(_nullterm "--nullterm")
47-
endif(${RTCS_NULLTERM})
47+
endif(RTCS_NULLTERM)
4848

4949
string(REPLACE "." "_" var_name ${var_name})
5050

5151
set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/${RTCS_OUTPUT_DIR}")
52-
set(_output_file "${_output_path}/${_name_we}.${RTCS_EXTENSION}")
52+
if(RTCS_WITH_EXTENSION)
53+
set(_output_file "${_output_path}/${var_name}.${RTCS_EXTENSION}")
54+
else()
55+
set(_output_file "${_output_path}/${_name_we}.${RTCS_EXTENSION}")
56+
endif()
5357

5458
add_custom_command(
5559
OUTPUT ${_output_file}

CMakeModules/InternalUtils.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ macro(arrayfire_set_cmake_default_variables)
172172
if(APPLE)
173173
set(CMAKE_INSTALL_RPATH "/opt/arrayfire/lib")
174174
endif()
175+
176+
include(WriteCompilerDetectionHeader)
177+
write_compiler_detection_header(
178+
FILE ${ArrayFire_BINARY_DIR}/include/compiler_header.h
179+
PREFIX AF
180+
COMPILERS MSVC GNU Clang AppleClang Intel
181+
FEATURES cxx_constexpr cxx_relaxed_constexpr cxx_alignas cxx_thread_local
182+
#[VERSION <version>]
183+
#[PROLOG <prolog>]
184+
#[EPILOG <epilog>]
185+
)
175186
endmacro()
176187

177188
mark_as_advanced(

LICENSES/Half(MIT) License.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2012-2017 Christian Rau
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

docs/details/device.dox

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ floating point operations
4646

4747
===============================================================================
4848

49+
\defgroup device_func_half isHalfAvailable
50+
\ingroup device_mat
51+
52+
\brief Check if half(16-bit) precision floating point support is available for
53+
specified device
54+
55+
These functions check if a device has support to perform half precision
56+
floating point operations
57+
58+
===============================================================================
59+
4960
\defgroup device_func_set setDevice
5061
\ingroup device_mat
5162

examples/benchmarks/blas.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ using namespace af;
1818
static array A; // populated before each timing
1919
static void fn() {
2020
array B = matmul(A, A); // matrix multiply
21-
B.eval(); // ensure evaluated
2221
}
2322

2423
int main(int argc, char** argv) {

0 commit comments

Comments
 (0)