From 59bf0c15cf20644b69de3b7b049d85ce1ed1db76 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Wed, 8 May 2024 11:29:26 +0800 Subject: [PATCH] Fix runtime wrapper Signed-off-by: Jiang, Zhiwei --- clang/lib/Headers/__clang_cuda_runtime_wrapper.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/lib/Headers/__clang_cuda_runtime_wrapper.h b/clang/lib/Headers/__clang_cuda_runtime_wrapper.h index fdcbe5110914..eb8f86f64532 100644 --- a/clang/lib/Headers/__clang_cuda_runtime_wrapper.h +++ b/clang/lib/Headers/__clang_cuda_runtime_wrapper.h @@ -53,20 +53,19 @@ // WARNING: Preprocessor hacks below are based on specific details of // CUDA-7.x headers and are not expected to work with any other // version of CUDA headers. -#include "cuda.h" #ifdef SYCLomatic_CUSTOMIZATION -#if !defined(CUDA_VERSION) -#error "cuda.h did not define CUDA_VERSION" -#elif CUDA_VERSION < 7000 -#error "Unsupported CUDA version!" -#endif +// In some projects, there is a header file also named cuda.h but with different +// content. To include the correct cuda.h, we try to use a folder name to +// distinguish those two cases. +#include "crt/../cuda.h" #else +#include "cuda.h" +#endif // SYCLomatic_CUSTOMIZATION #if !defined(CUDA_VERSION) #error "cuda.h did not define CUDA_VERSION" #elif CUDA_VERSION < 7000 #error "Unsupported CUDA version!" #endif -#endif // SYCLomatic_CUSTOMIZATION #if defined(SYCLomatic_CUSTOMIZATION) && CUDA_VERSION >= 10000 #pragma push_macro("__clang_major__")