HIP icon indicating copy to clipboard operation
HIP copied to clipboard

hip headers generate a lot of warnings

Open sthibaul opened this issue 3 years ago • 1 comments

Hello,

Just compiling this:

#include <hip/hip_runtime.h>
#include <hip/hip_runtime_api.h>

int main(void) {
	return 0;
}

with

gcc test.c -o test -Wall -Wextra $(hipconfig -C)

generates a lot of warnings:

In file included from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip_runtime_api.h:5698,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/nvidia_detail/nvidia_hip_runtime.h:28,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip_runtime.h:64,
                 from test.c:1:
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h: In function ‘hipMemcpyToArray’:
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h:1319:9: warning: ‘cudaMemcpyToArray’ is deprecated [-Wdeprecated-declarations]
 1319 |         cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind));
      |         ^~~~~~~~~~~~~~~~~
In file included from /usr/include/cuda_runtime.h:96,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/nvidia_detail/nvidia_hip_runtime.h:26,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip_runtime.h:64,
                 from test.c:1:
/usr/include/cuda_runtime_api.h:7385:57: note: declared here
 7385 | extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t count, enum cudaMemcpyKind kind);
      |                                                         ^~~~~~~~~~~~~~~~~
[...]
 7427 | extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, enum cudaMemcpyKind kind);
      |                                                         ^~~~~~~~~~~~~~~~~~~
In file included from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip_runtime_api.h:5698,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/nvidia_detail/nvidia_hip_runtime.h:28,
                 from /net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip_runtime.h:64,
                 from test.c:1:
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h: In function ‘hipPointerGetAttributes’:
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h:1731:14: warning: type defaults to ‘int’ in declaration of ‘memType’ [-Wimplicit-int]
 1731 |         auto memType = cPA.type;
      |              ^~~~~~~
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h: In function ‘hipCtxDetach’:
/net/inria/soft/x86_64/rocm-5.1.0/hip/include/hip/hip/nvidia_detail/nvidia_hip_runtime_api.h:1980:5: warning: ‘cuCtxDetach’ is deprecated [-Wdeprecated-declarations]
 1980 |     return hipCUResultTohipError(cuCtxDetach(ctx));
      |     ^~~~~~
[...]

this is polluting the build logs of hip applications

sthibaul avatar Jun 08 '22 07:06 sthibaul

@sthibaul, Thanks for reporting it. I could see a total of 10 warnings, out of that 8 are deprecation warnings which Cuda has added for those APIs. Unfortunately, we have to live with those warnings until Cuda drops them. The remaining two warnings are genuine misses which should be addressed in the next release.

BTW, there are ways to suppress unwanted warnings let me know if you need any information for the same.

SarbojitAMD avatar Jun 23 '22 09:06 SarbojitAMD