Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cutorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/THC/THCHalf.h')
-rw-r--r--lib/THC/THCHalf.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/THC/THCHalf.h b/lib/THC/THCHalf.h
index b20b05c..d87647b 100644
--- a/lib/THC/THCHalf.h
+++ b/lib/THC/THCHalf.h
@@ -3,7 +3,17 @@
#include "THCGeneral.h"
+// We compile with CudaHalfTensor support if we have this:
#if CUDA_VERSION >= 7050 || CUDA_HAS_FP16
+#define CUDA_HALF_TENSOR 1
+#endif
+
+// Native fp16 ALU instructions are available if we have this:
+#if defined(CUDA_HALF_TENSOR) && (__CUDA_ARCH__ >= 530)
+#define CUDA_HALF_INSTRUCTIONS 1
+#endif
+
+#ifdef CUDA_HALF_TENSOR
#include <cuda_fp16.h>
#include <stdint.h>
@@ -13,6 +23,6 @@ THC_EXTERNC void THCHalf2Float(THCState *state, float *out, half *in, long len);
THC_EXTERNC half THC_float2half(float a);
THC_EXTERNC float THC_half2float(half a);
-#endif
+#endif // CUDA_HALF_TENSOR
#endif