diff options
author | soumith <soumith@fb.com> | 2017-01-01 07:07:18 +0300 |
---|---|---|
committer | soumith <soumith@fb.com> | 2017-01-01 07:07:18 +0300 |
commit | 68a9535186111bf5c951a70bca178084d7930df1 (patch) | |
tree | 23ff378b2ef13eefb1839bec5301ac0fffb985e2 | |
parent | b77e5988491c611518aa50c4d4ec2b516b331068 (diff) |
TH_GENERIC_USE_HALF=1 by default, half enabled by defaulthalfgeneric
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/TH/THGeneral.h.in | 2 | ||||
-rw-r--r-- | lib/TH/THHalf.h | 11 |
3 files changed, 7 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fb2de09..611258b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,6 @@ IF(MSVC) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1) ENDIF(MSVC) -ADD_DEFINITIONS(-DTH_GENERIC_USE_HALF=1) - # OpenMP support? SET(WITH_OPENMP ON CACHE BOOL "OpenMP support if available?") IF (APPLE AND CMAKE_COMPILER_IS_GNUCC) diff --git a/lib/TH/THGeneral.h.in b/lib/TH/THGeneral.h.in index 6873db6..d45e06f 100644 --- a/lib/TH/THGeneral.h.in +++ b/lib/TH/THGeneral.h.in @@ -47,7 +47,7 @@ #endif #ifndef TH_GENERIC_USE_HALF -# define TH_GENERIC_USE_HALF 0 +# define TH_GENERIC_USE_HALF 1 #endif #ifndef TH_NATIVE_HALF diff --git a/lib/TH/THHalf.h b/lib/TH/THHalf.h index 930477d..0549d21 100644 --- a/lib/TH/THHalf.h +++ b/lib/TH/THHalf.h @@ -6,18 +6,18 @@ /* Neither built-in nor included from Cutorch, use our definition lifted from CUDA */ #if defined(__GNUC__) -#define __align__(n) __attribute__((aligned(n))) +#define __thalign__(n) __attribute__((aligned(n))) #elif defined(_WIN32) -#define __align__(n) __declspec(align(n)) +#define __thalign__(n) __declspec(align(n)) #else -#define __align__(n) +#define __thalign__(n) #endif -typedef struct __align__(2){ +typedef struct __thalign__(2){ unsigned short x; } __THHalf; -typedef struct __align__(4) { +typedef struct __thalign__(4) { unsigned int x; } __THHalf2; @@ -36,4 +36,5 @@ TH_API float TH_half2float(THHalf a); #define TH_HALF_MAX TH_HALF_BITS_TO_LITERAL(0x7BFF) +#undef __thalign__ #endif |