Skip to content

Commit

Permalink
disable cl_khr_fp16 when __CLPY_ENABLE_CL_KHR_FP16 is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
vorj committed Apr 18, 2019
1 parent 5caa98b commit 85fc8bb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clpy/core/include/clpy/carray.clh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
#ifdef __CLPY_ENABLE_CL_KHR_FP16
#pragma OPENCL EXTENSION cl_khr_fp16: enable
#endif

// TODO: Implement common functions in OpenCL C
#if 0
Expand Down Expand Up @@ -532,13 +534,16 @@ static void __clpy_end_print_out() __attribute__((annotate("clpy_end_print_out")
#ifdef __ULTIMA
__attribute__((annotate("clpy_no_mangle"))) static half convert_float_to_half(float x);
#else
#ifdef __CLPY_ENABLE_CL_KHR_FP16
#include "fp16.clh"
typedef half __clpy__half;
#endif
#endif

#ifdef __ULTIMA
__attribute__((annotate("clpy_no_mangle"))) static half clpy_nextafter_fp16(half x1, half x2);
#else
#ifdef __CLPY_ENABLE_CL_KHR_FP16
static int isnan_fp16(half x){
unsigned short const* x_raw = (unsigned short const*)&x;
return (*x_raw & 0x7c00u) == 0x7c00u && (*x_raw & 0x03ffu) != 0x0000u;
Expand Down Expand Up @@ -581,3 +586,4 @@ static half clpy_nextafter_fp16(half x1, half x2){
return *(half*)&ret_raw_;
}
#endif
#endif

0 comments on commit 85fc8bb

Please sign in to comment.