Open the-slow-one opened 1 month ago
@the-slow-one The test case has syntax error, it cannot be compiled by nvcc:
zhiwei@zhiwei-ubuntu:~/testfolder$ nvcc test.cu -c
test.cu(4): error: invalid redeclaration of type name "CUdeviceptr" (declared at line 262 of /usr/local/cuda-12.4/bin/../targets/x86_64-linux/include/cuda.h)
typedef uint64_t CUdeviceptr;
^
test.cu(7): error: argument of type "CUdeviceptr *" is incompatible with parameter of type "CUdeviceptr *"
ptr = cuMemAlloc_v2(&ptr, 1024);
^
2 errors detected in the compilation of "test.cu".
zhiwei@zhiwei-ubuntu:~/testfolder$
@the-slow-one The test case has syntax error, it cannot be compiled by nvcc:
zhiwei@zhiwei-ubuntu:~/testfolder$ nvcc test.cu -c test.cu(4): error: invalid redeclaration of type name "CUdeviceptr" (declared at line 262 of /usr/local/cuda-12.4/bin/../targets/x86_64-linux/include/cuda.h) typedef uint64_t CUdeviceptr; ^ test.cu(7): error: argument of type "CUdeviceptr *" is incompatible with parameter of type "CUdeviceptr *" ptr = cuMemAlloc_v2(&ptr, 1024); ^ 2 errors detected in the compilation of "test.cu". zhiwei@zhiwei-ubuntu:~/testfolder$
This is a Windows-only test. nvcc
compiles this file on Windows.
The following migrated code in DPCT have incompatiable cast operation. This isssue is only relavent on Windows. The sample below only compiles on Windows.
Orginal CUDA code is
Solution is to stop the underlying type lookup if the type is a defined by CUDA. (Existing implementation only looks if the source of defination is cuda.h but it's not sufficent as evident in the CUDA example above)