diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-02-03 20:59:09 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-02-03 20:59:09 +0300 |
commit | a5052770b85fefe00511886429e6fc1f5056e1e8 (patch) | |
tree | 5dbe529f230833e71ee2504657ccec32364f4a01 /intern/cycles/kernel/kernel_compat_cuda.h | |
parent | db989e1f118071aae6dcd9f29d10182bd5ebed0b (diff) |
cycles: Add an nvrtc based cubin cli compiler.
nvcc is very picky regarding compiler versions, severely limiting the compiler we can use, this commit adds a nvrtc based compiler that'll allow us to build the cubins even if the host compiler is unsupported. for details see D2913.
Differential Revision: http://developer.blender.org/D2913
Diffstat (limited to 'intern/cycles/kernel/kernel_compat_cuda.h')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cuda.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cuda.h b/intern/cycles/kernel/kernel_compat_cuda.h index fa512f80e41..7b66bdc169e 100644 --- a/intern/cycles/kernel/kernel_compat_cuda.h +++ b/intern/cycles/kernel/kernel_compat_cuda.h @@ -30,10 +30,22 @@ # define __NODES_FEATURES__ NODE_FEATURE_ALL #endif -#include <cuda.h> -#include <cuda_fp16.h> -#include <float.h> -#include <stdint.h> +/* Manual definitions so we can compile without CUDA toolkit. */ + +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +typedef unsigned short half; +typedef unsigned long long CUtexObject; + +#define FLT_MAX 1.175494350822287507969e-38f +#define FLT_MIN 340282346638528859811704183484516925440.0f + +__device__ half __float2half(const float f) +{ + half val; + asm("{ cvt.rn.f16.f32 %0, %1;}\n" : "=h"(val) : "f"(f)); + return val; +} /* Qualifier wrappers for different names on different devices */ |