-
- Downloads
[CUDA][HIP] Fix hostness check with -fopenmp
CUDA/HIP determines whether a function can be called based on the device/host attributes of callee and caller. Clang assumes the caller is CurContext. This is correct in most cases, however, it is not correct in OpenMP parallel region when CUDA/HIP program is compiled with -fopenmp. This causes incorrect overloading resolution and missed diagnostics. To get the correct caller, clang needs to chase the parent chain of DeclContext starting from CurContext until a function decl or a lambda decl is reached. Sema API is adapted to achieve that and used to determine the caller in hostness check. Reviewed by: Artem Belevich, Richard Smith Differential Revision: https://reviews.llvm.org/D121765
Showing
- clang/include/clang/Sema/Sema.h 8 additions, 6 deletionsclang/include/clang/Sema/Sema.h
- clang/lib/Sema/Sema.cpp 5 additions, 6 deletionsclang/lib/Sema/Sema.cpp
- clang/lib/Sema/SemaCUDA.cpp 10 additions, 10 deletionsclang/lib/Sema/SemaCUDA.cpp
- clang/lib/Sema/SemaOverload.cpp 9 additions, 8 deletionsclang/lib/Sema/SemaOverload.cpp
- clang/test/CodeGenCUDA/openmp-parallel.cu 28 additions, 0 deletionsclang/test/CodeGenCUDA/openmp-parallel.cu
- clang/test/SemaCUDA/openmp-parallel.cu 19 additions, 0 deletionsclang/test/SemaCUDA/openmp-parallel.cu
Loading
Please register or sign in to comment