https://llvm.org/bugs/show_bug.cgi?id=28919
Bug ID: 28919 Summary: Use of undeclared identifier 'surf2Dwrite' Product: clang Version: trunk Hardware: Macintosh OS: Linux Status: NEW Severity: normal Priority: P Component: CUDA Assignee: unassignedclangb...@nondot.org Reporter: llvm.org_thaek...@pmoreau.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16923 --> https://llvm.org/bugs/attachment.cgi?id=16923&action=edit File containing the CUDA kernel Hello, I wanted to give clang a go on compiling my CUDA kernels. I was able to get the example at bit.ly/llvm-cuda to compile and run properly, but when I tried the attached code, I got the error message "error: use of undeclared identifier 'surf2Dwrite'". Versions used: * CUDA: 7.5 * clang: 3.8 and 63240447ac6e ("[analyzer] Try to fix coverity CID 1360469.") * llvm: 3.8 and 04876e5fe54e ("[X86][XOP] Add support for combining target shuffles to VPERMIL2PD/VPERMIL2PS") The compilation command as well as the output look as follow (with both previously mentioned versions of clang+LLVM): ``` % clang++ -std=c++11 --cuda-path=/opt/cuda --cuda-gpu-arch=sm_30 -c surface.cu surface.cu:15:3: error: use of undeclared identifier 'surf2Dwrite' surf2Dwrite(make_float4(0.0f, 0.0f, 0.0f, 1.0f), result_surface, index.x * sizeof(float4), index.y); ^ 1 error generated ``` If I include directly `surface_indirect_functions.h` which defines `surf2Dwrite`, then the program does compile (well, sort of depending on the clang version, but that looks like a different bug, so different bug report). Playing with the CUDA headers, I added some `#error "foo"` inside `device_functions.h` which is included by `cuda_runtime.h`, and in turns includes `surface_indirect_functions.h`: so one right after the `#define __DEVICE_FUNCTIONS_H__`, and another one (with a different message) in an else clause to the `#ifdef __DEVICE_FUNCTIONS_H__`. To resume, this is how the modified `device_functions.h` looks like: ``` #ifndef __DEVICE_FUNCTIONS_H__ #define __DEVICE_FUNCTIONS_H__ #error "foo" // [snip] untouched content #else #error "bar" #endif // __DEVICE_FUNCTIONS_H__ ``` And here is the corresponding compilation output with clang: ``` % clang++ -std=c++11 --cuda-path=/opt/cuda --cuda-gpu-arch=sm_30 -c surface.cu In file included from <built-in>:1: In file included from /home/pmoreau/privat/userspace/llvm/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:98: In file included from /opt/cuda/include/cuda_runtime.h:115: /opt/cuda/include/device_functions.h:4247:2: error: "bar" #error "bar" ^ In file included from <built-in>:1: In file included from /home/pmoreau/privat/userspace/llvm/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:156: In file included from /opt/cuda/include/math_functions.hpp:1065: /opt/cuda/include/device_functions.h:4247:2: error: "bar" #error "bar" ^ 2 errors generated. ``` Apparently `__DEVICE_FUNCTIONS_H__` is getting defined by another file since we do not get an `error: "foo"`. Thank you in advance! Pierre -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs