|
64 | 64 | #endif
|
65 | 65 |
|
66 | 66 | // Make largest subset of device functions available during host
|
67 |
| -// compilation -- SM_35 for the time being. |
| 67 | +// compilation. |
68 | 68 | #ifndef __CUDA_ARCH__
|
69 |
| -#define __CUDA_ARCH__ 350 |
| 69 | +#define __CUDA_ARCH__ 9999 |
70 | 70 | #endif
|
71 | 71 |
|
72 | 72 | #include "__clang_cuda_builtin_vars.h"
|
@@ -330,6 +330,34 @@ static inline __device__ void __brkpt(int __c) { __brkpt(); }
|
330 | 330 |
|
331 | 331 | #pragma pop_macro("__host__")
|
332 | 332 |
|
| 333 | +// __clang_cuda_texture_intrinsics.h must be included first in order to provide |
| 334 | +// implementation for __nv_tex_surf_handler that CUDA's headers depend on. |
| 335 | +// The implementation requires c++11 and only works with CUDA-9 or newer. |
| 336 | +#if __cplusplus >= 201103L && CUDA_VERSION >= 9000 |
| 337 | +// clang-format off |
| 338 | +#include <__clang_cuda_texture_intrinsics.h> |
| 339 | +// clang-format on |
| 340 | +#else |
| 341 | +#if CUDA_VERSION >= 9000 |
| 342 | +// Provide a hint that texture support needs C++11. |
| 343 | +template <typename T> struct __nv_tex_needs_cxx11 { |
| 344 | + const static bool value = false; |
| 345 | +}; |
| 346 | +template <class T> |
| 347 | +__host__ __device__ void __nv_tex_surf_handler(const char *name, T *ptr, |
| 348 | + cudaTextureObject_t obj, |
| 349 | + float x) { |
| 350 | + _Static_assert(__nv_tex_needs_cxx11<T>::value, |
| 351 | + "Texture support requires C++11"); |
| 352 | +} |
| 353 | +#else |
| 354 | +// Textures in CUDA-8 and older are not supported by clang.There's no |
| 355 | +// convenient way to intercept texture use in these versions, so we can't |
| 356 | +// produce a meaningful error. The source code that attempts to use textures |
| 357 | +// will continue to fail as it does now. |
| 358 | +#endif // CUDA_VERSION |
| 359 | +#endif // __cplusplus >= 201103L && CUDA_VERSION >= 9000 |
| 360 | +#include "texture_fetch_functions.h" |
333 | 361 | #include "texture_indirect_functions.h"
|
334 | 362 |
|
335 | 363 | // Restore state of __CUDA_ARCH__ and __THROW we had on entry.
|
|
0 commit comments